Skip to content

Commit

Permalink
fix: hide link to non existent about route (#3588)
Browse files Browse the repository at this point in the history
fix: hide link to non existent about route

Only show link if about page exists and info in page is describes catalogue

Closes #3555
  • Loading branch information
connoratrug authored Apr 3, 2024
1 parent 78d453b commit 602dcd0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/nuxt3-ssr/components/header/Catalogue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (cohortOnly.value) {
label: "About",
link: `/${route.params.schema}/ssr-catalogue/${catalogueRouteParam}/about`,
});
} else {
} else if (catalogueRouteParam && catalogueRouteParam !== "all") {
menu.push({
label: "About",
link: `/${route.params.schema}/ssr-catalogue/${catalogueRouteParam}/networks/${catalogueRouteParam}`,
Expand Down
13 changes: 13 additions & 0 deletions e2e/tests/catalogue/about-link-visibility.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test, expect } from '@playwright/test';

test('should not show about menu item on non catalogue spesific page', async ({ page }) => {
await page.goto('/catalogue-demo/ssr-catalogue/all');
await page.getByRole('button', { name: 'Accept' }).click();
await expect(page.getByRole('link', { name: 'About' })).toHaveCount(0);
});

test('should show about menu item on catalogue spesific page', async ({ page }) => {
await page.goto('/catalogue-demo/ssr-catalogue/IPEC');
await page.getByRole('button', { name: 'Accept' }).click();
await expect(page.getByRole('link', { name: 'About' })).toHaveCount(1);
});

0 comments on commit 602dcd0

Please sign in to comment.