From e2f18ccc1f86b3cf260d23bc60bc2d04c8e0fac4 Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Wed, 8 Nov 2023 15:33:28 -0500 Subject: [PATCH] style fixes --- __test__/fixtures/testAggregations.js | 129 +++++++++++++++++- pages/search/advanced.tsx | 4 +- .../ItemFilters/ItemFilterButtons.tsx | 4 +- .../ItemFilters/ItemFilterLabel.tsx | 4 +- .../ItemFilters/ItemFilters.test.tsx | 95 ++++++------- src/utils/itemFilterUtils.ts | 9 +- src/utils/utilsTests/itemFilterUtils.test.tsx | 8 +- styles/components/ItemFilters.module.scss | 4 +- 8 files changed, 184 insertions(+), 73 deletions(-) diff --git a/__test__/fixtures/testAggregations.js b/__test__/fixtures/testAggregations.js index 7051400c7..f76108e37 100644 --- a/__test__/fixtures/testAggregations.js +++ b/__test__/fixtures/testAggregations.js @@ -1,4 +1,4 @@ -const aggs = [ +export const normalAggs = [ { "@type": "nypl:Aggregation", "@id": "res:location", @@ -80,4 +80,129 @@ const aggs = [ }, ] -export default aggs +export const aggsWithRepeatedValues = [ + { + "@type": "nypl:Aggregation", + "@id": "res:location", + id: "location", + field: "location", + values: [ + { + value: "loc:mym32", + count: 8, + label: "Performing Arts Research Collections - Music", + }, + ], + }, + { + "@type": "nypl:Aggregation", + "@id": "res:format", + id: "format", + field: "format", + values: [], + }, + { + "@type": "nypl:Aggregation", + "@id": "res:status", + id: "status", + field: "status", + values: [ + { + value: "status:a", + count: 4, + label: "Available", + }, + { + value: "status:a", + count: 4, + label: "Available ", + }, + ], + }, +] + +export const aggsWithMissingProperties = [ + { + "@id": "res:location", + "@type": "nypl:Aggregation", + field: "location", + id: "location", + values: [ + { + count: 4, + value: "loc:maj03", + label: "SASB M1 - General Research - Room 315", + }, + { + count: 12, + label: "Offsite", + value: "loc:rc2ma", + }, + { + count: 12, + label: "Off site", + value: "loc:rc2ma", + }, + { + count: 12, + label: "Off-site", + value: "loc:rc2ma", + }, + { + count: 12, + label: "off-site", + value: "loc:rc2ma", + }, + { + count: 12, + label: "off site", + value: "loc:rc2ma", + }, + { + count: 2, + value: "offsite", + label: "Offsite", + }, + { + count: 2, + value: "blank", + label: "", + }, + { + count: 2, + value: "blaaaank", + }, + ], + }, + { + "@id": "res:format", + "@type": "nypl:Aggregation", + field: "format", + id: "format", + values: [ + { + count: 12, + label: "Text", + value: "Text", + }, + ], + }, + { + "@id": "res:status", + "@type": "nypl:Aggregation", + field: "status", + id: "status", + values: [ + { + count: 12, + label: "Available", + value: "status:a", + }, + { + count: 12, + label: "Not Available (ReCAP", + value: "status:na", + }, + ], + }, +] diff --git a/pages/search/advanced.tsx b/pages/search/advanced.tsx index f5f2e8dd6..aebb66317 100644 --- a/pages/search/advanced.tsx +++ b/pages/search/advanced.tsx @@ -39,7 +39,7 @@ import type { import { getQueryString } from "../../src/utils/searchUtils" import ItemFilterContainer from "../../src/components/ItemFilters/FiltersContainer" -import testItemAggs from "../../__test__/fixtures/testAggregations" +import { normalAggs } from "../../__test__/fixtures/testAggregations" /** * The Advanced Search page is responsible for displaying the Advanced Search form fields and @@ -125,7 +125,7 @@ export default function AdvancedSearch() { } /> )} - + Advanced Search
Clear