@@ -95,4 +95,13 @@ describe('<HeaderTabs />', () => {
|
||||
await user.click(rendered.getByText('Docs'));
|
||||
expect(mockOnChange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should render 2 nav tabs', async () => {
|
||||
const rendered = await renderInTestApp(<HeaderTabs tabs={mockTabs} />);
|
||||
const tabs = rendered.queryAllByTestId(id => id.startsWith('header-tab'));
|
||||
expect(tabs).toHaveLength(2);
|
||||
tabs.forEach(tab => {
|
||||
expect(tab.tagName.toLocaleLowerCase('en-US')).toBe('a');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -97,9 +97,7 @@ export function HeaderTabs(props: HeaderTabsProps) {
|
||||
}
|
||||
}, [selectedIndex]);
|
||||
function removeLeadingSlash(path: string) {
|
||||
let newPath = path;
|
||||
newPath = path.replace(/^\//, '');
|
||||
return newPath;
|
||||
return path.replace(/^\//, '');
|
||||
}
|
||||
return (
|
||||
<Box className={styles.tabsWrapper}>
|
||||
|
||||
Reference in New Issue
Block a user