From 313cb4effcccf40b66682d123ef79f057ab09543 Mon Sep 17 00:00:00 2001 From: kaloster Date: Tue, 21 Nov 2023 09:35:00 -0500 Subject: [PATCH 1/2] chore: pin no publication to the bottom of publication filter --- .../WheresMyGeneV2/components/Filters/connect.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/WheresMyGeneV2/components/Filters/connect.ts b/frontend/src/views/WheresMyGeneV2/components/Filters/connect.ts index cb8d3da1e4c84..22c48ec34757d 100644 --- a/frontend/src/views/WheresMyGeneV2/components/Filters/connect.ts +++ b/frontend/src/views/WheresMyGeneV2/components/Filters/connect.ts @@ -260,6 +260,18 @@ export const useConnect = ({ sdsStyle: "minimal", } as Partial; + const sortedPublicationCitations = useMemo(() => { + const sortedCitations = [...publication_citations]; + sortedCitations.sort((a, b) => + a.name === "No Publication" + ? 1 + : b.name === "No Publication" + ? -1 + : a.name.localeCompare(b.name) + ); + return sortedCitations; + }, [publication_citations]); + return { handle: { tissuesChange: handleTissuesChange, @@ -280,7 +292,7 @@ export const useConnect = ({ terms: { tissue: tissue_terms, sex: sex_terms, - publication: publication_citations, + publication: sortedPublicationCitations, self_reported_ethnicity: self_reported_ethnicity_terms, disease: disease_terms, }, From 584b11e84e6a3501cbf2fb475edd857b9d66bcee Mon Sep 17 00:00:00 2001 From: kaloster Date: Tue, 21 Nov 2023 12:45:23 -0500 Subject: [PATCH 2/2] added e2e test --- .../wheresMyGene/tissueAutoExpand.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/frontend/tests/features/wheresMyGene/tissueAutoExpand.test.ts b/frontend/tests/features/wheresMyGene/tissueAutoExpand.test.ts index 9a07af0da4579..9603ae1e54918 100644 --- a/frontend/tests/features/wheresMyGene/tissueAutoExpand.test.ts +++ b/frontend/tests/features/wheresMyGene/tissueAutoExpand.test.ts @@ -293,6 +293,33 @@ describe("WMG tissue auto-expand", () => { await checkTissues(page, EXPECTED_FILTERED_TISSUES_WITH_DISEASE_FILTER); }); + test("Publication Filter - Verify that No Publication is pinned to the bottom of the list", async ({ + page, + }) => { + await tryUntil( + async () => { + await goToWMG(page); + await clickIntoFilter( + page, + PUBLICATION_FILTER_TEST_ID, + PUBLICATION_FILTER_LABEL + ); + const count = await page + .getByRole("listbox") + .getByRole("option") + .count(); + await expect( + page + .getByRole("tooltip") + .locator(`[data-option-index="${count - 1}"]`) + .locator("span") + .getByText("No Publication") + ).toBeVisible(); + }, + { page } + ); + }); + test("Share link with genes and cellTypes", async ({ page }) => { await Promise.all([ /**