@@ -162,14 +162,15 @@ describe('RoutedTabs', () => {
|
||||
});
|
||||
|
||||
it('should render the tabs as <a> links', async () => {
|
||||
const routes = [testRoute2, testRoute1, testRoute3];
|
||||
const routes = [testRoute1, testRoute2, testRoute3];
|
||||
const expectedHrefs = ['/', '/some-other-path', '/some-other-path-similar'];
|
||||
const rendered = await renderInTestApp(<RoutedTabs routes={routes} />);
|
||||
|
||||
const tabs = rendered.queryAllByRole('tab');
|
||||
|
||||
for (const [k, v] of Object.entries(tabs)) {
|
||||
expect(v.tagName).toBe('A');
|
||||
expect(v).toHaveAttribute('href', routes[Number(k)].path);
|
||||
expect(v).toHaveAttribute('href', expectedHrefs[Number(k)]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,9 +79,9 @@ export function RoutedTabs(props: { routes: SubRoute[] }) {
|
||||
id: path,
|
||||
label: title,
|
||||
tabProps: {
|
||||
...tabProps,
|
||||
component: Link,
|
||||
to,
|
||||
...tabProps,
|
||||
},
|
||||
};
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user