From 484b192b1ffaf08451eadaa0a1480b2300b35921 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Mon, 8 Jan 2024 20:25:54 +0000 Subject: [PATCH] wip: redirect from organism base page (#728) * redirect * no longer needed * fix * try to fix title issue * fix * import order fix * try this * fix * format * fix * fix * remove second test of title --- website/src/pages/[organism]/index.astro | 10 +--------- website/src/pages/[organism]/search/index.astro | 5 +++-- website/tests/pages/navigation.spec.ts | 6 +++--- website/tests/pages/search/index.spec.ts | 1 - 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/website/src/pages/[organism]/index.astro b/website/src/pages/[organism]/index.astro index afe0bbbae..8fd0c23b7 100644 --- a/website/src/pages/[organism]/index.astro +++ b/website/src/pages/[organism]/index.astro @@ -1,14 +1,6 @@ --- -import { BackButton } from '../../components/Navigation/BackButton'; import { cleanOrganism } from '../../components/Navigation/cleanOrganism'; -import BaseLayout from '../../layouts/BaseLayout.astro'; const { organism } = cleanOrganism(Astro.params.organism); +return Astro.redirect(`/${organism.key}/search`); --- - - -
- -

Organism {organism?.displayName}

-
-
diff --git a/website/src/pages/[organism]/search/index.astro b/website/src/pages/[organism]/search/index.astro index f9663fe54..542b41d7e 100644 --- a/website/src/pages/[organism]/search/index.astro +++ b/website/src/pages/[organism]/search/index.astro @@ -1,5 +1,6 @@ --- import { getData, getSearchFormFilters } from './search'; +import { cleanOrganism } from '../../../components/Navigation/cleanOrganism'; import { Pagination } from '../../../components/SearchPage/Pagination'; import { SearchForm } from '../../../components/SearchPage/SearchForm'; import { Table } from '../../../components/SearchPage/Table'; @@ -9,7 +10,7 @@ import BaseLayout from '../../../layouts/BaseLayout.astro'; import { pageSize } from '../../../settings'; const organism = Astro.params.organism!; - +const { organism: cleanedOrganism } = cleanOrganism(organism); const schema = getSchema(organism); const clientConfig = getRuntimeConfig().public; const getSearchParams = (field: string): string => { @@ -25,7 +26,7 @@ const offset = (page - 1) * pageSize; const data = await getData(organism, searchFormFilter, offset, pageSize); --- - +

Search

diff --git a/website/tests/pages/navigation.spec.ts b/website/tests/pages/navigation.spec.ts index b9065a146..ebdabd9af 100644 --- a/website/tests/pages/navigation.spec.ts +++ b/website/tests/pages/navigation.spec.ts @@ -9,7 +9,7 @@ const organismIndependentNavigationItems = [ ]; const organismNavigationItems = [ - { link: 'Search', title: 'Search' }, + { link: 'Search', title: '[Organism] - Browse' }, { link: 'Submit', title: 'Submit' }, { link: 'Revise', title: 'Revise' }, { link: 'User', title: 'Login' }, @@ -29,11 +29,11 @@ test.describe('Clicking the navigation links', () => { await navigationFixture.openOrganismNavigation(); await navigationFixture.clickLink(dummyOrganism.displayName); - await navigationFixture.expectTitle(dummyOrganism.displayName); + await navigationFixture.expectTitle(`${dummyOrganism.displayName} - Browse`); for (const { link, title } of organismNavigationItems) { await navigationFixture.clickLink(link); - await navigationFixture.expectTitle(title); + await navigationFixture.expectTitle(title.replace('[Organism]', dummyOrganism.displayName)); } }); }); diff --git a/website/tests/pages/search/index.spec.ts b/website/tests/pages/search/index.spec.ts index 034fd06b1..40de63411 100644 --- a/website/tests/pages/search/index.spec.ts +++ b/website/tests/pages/search/index.spec.ts @@ -6,7 +6,6 @@ import { baseUrl, dummyOrganism, expect, test, testSequenceEntry } from '../../e test.describe('The search page', () => { test('should show the search form with button and a table', async ({ searchPage }) => { await searchPage.goto(); - await expect(searchPage.page).toHaveTitle('Search'); await expect(searchPage.searchButton).toBeVisible(); await expect(searchPage.table).toBeVisible(); });