From 069c1ad85a0f8241a74ea3d916d9a5229c7721e3 Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Mon, 21 Oct 2024 15:22:06 +0200 Subject: [PATCH 1/2] [Enhancement #536] Support search by examples in faceted search. --- src/component/search/facet/FacetedSearch.tsx | 37 ++++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/component/search/facet/FacetedSearch.tsx b/src/component/search/facet/FacetedSearch.tsx index a87eb96f..02b53734 100644 --- a/src/component/search/facet/FacetedSearch.tsx +++ b/src/component/search/facet/FacetedSearch.tsx @@ -36,6 +36,11 @@ INITIAL_STATE[VocabularyUtils.SKOS_NOTATION] = { value: [""], matchType: MatchType.EXACT_MATCH, }; +INITIAL_STATE[VocabularyUtils.SKOS_EXAMPLE] = { + property: VocabularyUtils.SKOS_EXAMPLE, + value: [""], + matchType: MatchType.SUBSTRING, +}; INITIAL_STATE[VocabularyUtils.RDF_TYPE] = { property: VocabularyUtils.RDF_TYPE, value: [], @@ -96,33 +101,43 @@ const FacetedSearch: React.FC = () => { - - - - + - + - + + + + + + + + + From 6f50a9bb239a969ca020f7bc7d6f2d451d1c08fa Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Mon, 21 Oct 2024 15:25:24 +0200 Subject: [PATCH 2/2] [Enhancement #536] Update faceted search tests. --- .../search/facet/__tests__/FacetedSearch.test.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component/search/facet/__tests__/FacetedSearch.test.tsx b/src/component/search/facet/__tests__/FacetedSearch.test.tsx index de676e67..83e464cc 100644 --- a/src/component/search/facet/__tests__/FacetedSearch.test.tsx +++ b/src/component/search/facet/__tests__/FacetedSearch.test.tsx @@ -46,7 +46,7 @@ describe("FacetedSearch", () => { matchType: MatchType.SUBSTRING, }; await act(async () => { - wrapper.find(TextFacet).prop("onChange")(firstNotationValue); + wrapper.find(TextFacet).at(0).prop("onChange")(firstNotationValue); }); wrapper.update(); act(() => { @@ -58,7 +58,7 @@ describe("FacetedSearch", () => { matchType: MatchType.SUBSTRING, }; await act(async () => { - wrapper.find(TextFacet).prop("onChange")(secondNotationValue); + wrapper.find(TextFacet).at(0).prop("onChange")(secondNotationValue); }); wrapper.update(); expect(wrapper.find(SimplePagination).prop("page")).toEqual(0); @@ -84,7 +84,7 @@ describe("FacetedSearch", () => { matchType: MatchType.SUBSTRING, }; await act(async () => { - wrapper.find(TextFacet).prop("onChange")(firstNotationValue); + wrapper.find(TextFacet).at(0).prop("onChange")(firstNotationValue); }); wrapper.update(); (SearchActions.executeFacetedTermSearch as jest.Mock).mockReset(); @@ -140,7 +140,7 @@ describe("FacetedSearch", () => { expect(wrapper.exists(FacetedSearchResults)).toBeFalsy(); expect(wrapper.exists(SimplePagination)).toBeFalsy(); await act(async () => { - wrapper.find(TextFacet).prop("onChange")(firstNotationValue); + wrapper.find(TextFacet).at(0).prop("onChange")(firstNotationValue); }); wrapper.update(); act(() => { @@ -155,7 +155,7 @@ describe("FacetedSearch", () => { matchType: MatchType.SUBSTRING, }; act(() => { - wrapper.find(TextFacet).prop("onChange")(secondNotationValue); + wrapper.find(TextFacet).at(0).prop("onChange")(secondNotationValue); }); await act(async () => { wrapper.update();