@yext/visual-editor 1.4.11 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/SectionLibraryVisualEditorProvider-fUGYIhyC.js +108668 -0
  2. package/dist/SectionLibraryVisualEditorProvider.css +1 -0
  3. package/dist/cli/assets/directory-locator-source/components/contentBlocks/Address.tsx +251 -0
  4. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HeadingText.tsx +147 -0
  5. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursStatus.tsx +157 -0
  6. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursTable.tsx +164 -0
  7. package/dist/cli/assets/directory-locator-source/components/contentBlocks/MapboxStaticMap.tsx +205 -0
  8. package/dist/cli/assets/directory-locator-source/components/contentBlocks/Phone.tsx +155 -0
  9. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/EmptyImageState.tsx +168 -0
  10. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/Image.tsx +275 -0
  11. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/styling.ts +66 -0
  12. package/dist/cli/assets/directory-locator-source/components/contentBlocks/index.ts +13 -0
  13. package/dist/cli/assets/directory-locator-source/components/sections/Breadcrumbs.tsx +298 -0
  14. package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.test.tsx +872 -0
  15. package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.tsx +260 -0
  16. package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryCard.tsx +507 -0
  17. package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryWrapper.tsx +491 -0
  18. package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.test.tsx +226 -0
  19. package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.tsx +98 -0
  20. package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.test.tsx +147 -0
  21. package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.tsx +691 -0
  22. package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.test.tsx +1551 -0
  23. package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.tsx +541 -0
  24. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorFields.test.ts +43 -0
  25. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorResultCard.tsx +1594 -0
  26. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorWrapper.tsx +1157 -0
  27. package/dist/cli/assets/directory-locator-source/components/sections/locator/Map.tsx +304 -0
  28. package/dist/cli/assets/directory-locator-source/components/sections/locator/MapPinIcon.tsx +160 -0
  29. package/dist/cli/assets/directory-locator-source/components/sections/locator/Results.tsx +267 -0
  30. package/dist/cli/assets/directory-locator-source/sectionLibrarySupport.ts +245 -0
  31. package/dist/cli/yextve.js +16895 -0
  32. package/dist/index.d.ts +542 -6311
  33. package/dist/locales/page/cs/visual-editor.json +85 -0
  34. package/dist/locales/page/da/visual-editor.json +73 -0
  35. package/dist/locales/page/de/visual-editor.json +73 -0
  36. package/dist/locales/page/en/visual-editor.json +73 -0
  37. package/dist/locales/page/en-GB/visual-editor.json +73 -0
  38. package/dist/locales/page/es/visual-editor.json +79 -0
  39. package/dist/locales/page/et/visual-editor.json +73 -0
  40. package/dist/locales/page/fi/visual-editor.json +73 -0
  41. package/dist/locales/page/fr/visual-editor.json +79 -0
  42. package/dist/locales/page/hr/visual-editor.json +79 -0
  43. package/dist/locales/page/hu/visual-editor.json +73 -0
  44. package/dist/locales/page/it/visual-editor.json +79 -0
  45. package/dist/locales/page/ja/visual-editor.json +73 -0
  46. package/dist/locales/page/lt/visual-editor.json +85 -0
  47. package/dist/locales/page/lv/visual-editor.json +77 -0
  48. package/dist/locales/page/nb/visual-editor.json +73 -0
  49. package/dist/locales/page/nl/visual-editor.json +73 -0
  50. package/dist/locales/page/pl/visual-editor.json +85 -0
  51. package/dist/locales/page/pt/visual-editor.json +79 -0
  52. package/dist/locales/page/ro/visual-editor.json +79 -0
  53. package/dist/locales/page/sk/visual-editor.json +85 -0
  54. package/dist/locales/page/sv/visual-editor.json +73 -0
  55. package/dist/locales/page/tr/visual-editor.json +73 -0
  56. package/dist/locales/page/zh/visual-editor.json +73 -0
  57. package/dist/locales/page/zh-TW/visual-editor.json +73 -0
  58. package/dist/locales/platform/cs/visual-editor.json +531 -0
  59. package/dist/locales/platform/da/visual-editor.json +519 -0
  60. package/dist/locales/platform/de/visual-editor.json +519 -0
  61. package/dist/locales/platform/en/visual-editor.json +519 -0
  62. package/dist/locales/platform/en-GB/visual-editor.json +519 -0
  63. package/dist/locales/platform/es/visual-editor.json +525 -0
  64. package/dist/locales/platform/et/visual-editor.json +519 -0
  65. package/dist/locales/platform/fi/visual-editor.json +519 -0
  66. package/dist/locales/platform/fr/visual-editor.json +525 -0
  67. package/dist/locales/platform/hr/visual-editor.json +525 -0
  68. package/dist/locales/platform/hu/visual-editor.json +519 -0
  69. package/dist/locales/platform/it/visual-editor.json +525 -0
  70. package/dist/locales/platform/ja/visual-editor.json +519 -0
  71. package/dist/locales/platform/lt/visual-editor.json +531 -0
  72. package/dist/locales/platform/lv/visual-editor.json +523 -0
  73. package/dist/locales/platform/nb/visual-editor.json +519 -0
  74. package/dist/locales/platform/nl/visual-editor.json +519 -0
  75. package/dist/locales/platform/pl/visual-editor.json +531 -0
  76. package/dist/locales/platform/pt/visual-editor.json +525 -0
  77. package/dist/locales/platform/ro/visual-editor.json +525 -0
  78. package/dist/locales/platform/sk/visual-editor.json +531 -0
  79. package/dist/locales/platform/sv/visual-editor.json +519 -0
  80. package/dist/locales/platform/tr/visual-editor.json +519 -0
  81. package/dist/locales/platform/zh/visual-editor.json +519 -0
  82. package/dist/locales/platform/zh-TW/visual-editor.json +519 -0
  83. package/dist/locatorEntityTypes-s4dmT9l5.d.ts +1850 -0
  84. package/dist/plugin/internal/sectionLibraryValidation/builtInTranslationResources.d.ts +3 -0
  85. package/dist/plugin/internal/sectionLibraryValidation/stages/api/api.d.ts +7 -0
  86. package/dist/plugin/internal/sectionLibraryValidation/stages/api/libraryMetadata.d.ts +7 -0
  87. package/dist/plugin/internal/sectionLibraryValidation/stages/code/importRules.d.ts +13 -0
  88. package/dist/plugin/internal/sectionLibraryValidation/stages/code/validateCode.d.ts +10 -0
  89. package/dist/plugin/internal/sectionLibraryValidation/stages/code/xssRules.d.ts +7 -0
  90. package/dist/plugin/internal/sectionLibraryValidation/stages/structure/structure.d.ts +7 -0
  91. package/dist/plugin/internal/sectionLibraryValidation/types.d.ts +48 -0
  92. package/dist/plugin/internal/sectionLibraryValidation/validateSectionLibrary.d.ts +8 -0
  93. package/dist/plugin/internal/sectionLibraryValidation/validationError.d.ts +6 -0
  94. package/dist/plugin/plugin.js +2233 -5786
  95. package/dist/plugin/types/entityFields.d.ts +21 -0
  96. package/dist/plugin/types/images.d.ts +62 -0
  97. package/dist/plugin/types/sectionLibrary.d.ts +94 -0
  98. package/dist/plugin/types/types.d.ts +204 -0
  99. package/dist/plugin/types/videos.d.ts +24 -0
  100. package/dist/plugin/utils/i18n/locales.d.ts +5 -0
  101. package/dist/plugin/utils/i18n/translationResources.d.ts +41 -0
  102. package/dist/plugin/utils/normalizeLocale.d.ts +8 -0
  103. package/dist/plugin/utils/plainText.d.ts +6 -0
  104. package/dist/plugin/vite-plugin/index.d.ts +2 -0
  105. package/dist/plugin/vite-plugin/local-editor/artifacts.d.ts +18 -0
  106. package/dist/plugin/vite-plugin/local-editor/config.d.ts +11 -0
  107. package/dist/plugin/vite-plugin/local-editor/data.d.ts +10 -0
  108. package/dist/plugin/vite-plugin/local-editor/entityFields.d.ts +13 -0
  109. package/dist/plugin/vite-plugin/local-editor/fixtureData.d.ts +12 -0
  110. package/dist/plugin/vite-plugin/local-editor/generatedFiles.d.ts +34 -0
  111. package/dist/plugin/vite-plugin/local-editor/server.d.ts +18 -0
  112. package/dist/plugin/vite-plugin/local-editor/types.d.ts +109 -0
  113. package/dist/plugin/vite-plugin/local-editor/utils.d.ts +16 -0
  114. package/dist/plugin/vite-plugin/plugin.d.ts +8 -0
  115. package/dist/plugin/vite-plugin/section-library/migrationRegistry.d.ts +6 -0
  116. package/dist/plugin/vite-plugin/section-library/sectionFrontmatter.d.ts +3 -0
  117. package/dist/plugin/vite-plugin/section-library/sectionLibraryGenerator.d.ts +21 -0
  118. package/dist/plugin/vite-plugin/section-library/sharedComponentRegistry.d.ts +16 -0
  119. package/dist/section-library-support.js +158 -0
  120. package/dist/sectionLibrarySupport.d.ts +282 -0
  121. package/dist/style.css +1 -1
  122. package/dist/visual-editor-2Y77HmqL.js +718 -0
  123. package/dist/visual-editor-7P4U2T4q.js +694 -0
  124. package/dist/visual-editor-AXgoU7J5.js +694 -0
  125. package/dist/visual-editor-B-8ROr4n.js +694 -0
  126. package/dist/visual-editor-BDozYwKy.js +702 -0
  127. package/dist/visual-editor-BGMk-qTN.js +718 -0
  128. package/dist/visual-editor-BIqNAAcB.js +718 -0
  129. package/dist/visual-editor-BPI_dyYw.js +694 -0
  130. package/dist/visual-editor-BXYlpe7B.js +145 -0
  131. package/dist/visual-editor-Bkgub-3w.js +694 -0
  132. package/dist/visual-editor-Bo-tmHFc.js +694 -0
  133. package/dist/visual-editor-BuYrclmi.js +706 -0
  134. package/dist/visual-editor-Bxy81Ezy.js +145 -0
  135. package/dist/visual-editor-C0vq2BRM.js +145 -0
  136. package/dist/visual-editor-CCLIvOCf.js +694 -0
  137. package/dist/visual-editor-CCgmYV5S.js +169 -0
  138. package/dist/visual-editor-CE2J5pWp.js +694 -0
  139. package/dist/visual-editor-CERViyTJ.js +145 -0
  140. package/dist/visual-editor-CY2YjlX9.js +706 -0
  141. package/dist/visual-editor-CcuA4NSE.js +694 -0
  142. package/dist/visual-editor-Cd8yeRID.js +718 -0
  143. package/dist/visual-editor-CjORnP1D.js +169 -0
  144. package/dist/visual-editor-CmomGJB8.js +157 -0
  145. package/dist/visual-editor-CpCR_bSp.js +706 -0
  146. package/dist/visual-editor-Cymg8ID2.js +169 -0
  147. package/dist/visual-editor-D2Hk1nhM.js +145 -0
  148. package/dist/visual-editor-D8MRFn5x.js +157 -0
  149. package/dist/visual-editor-D96X4hBl.js +706 -0
  150. package/dist/visual-editor-DOXtCqRv.js +145 -0
  151. package/dist/visual-editor-DQEd3xwY.js +145 -0
  152. package/dist/visual-editor-DUngIOnE.js +157 -0
  153. package/dist/visual-editor-Dd-aD1iL.js +694 -0
  154. package/dist/visual-editor-DeZVZYfd.js +169 -0
  155. package/dist/visual-editor-DfJMZpiP.js +145 -0
  156. package/dist/visual-editor-DgAsQK9D.js +145 -0
  157. package/dist/visual-editor-Dhi__-7_.js +145 -0
  158. package/dist/visual-editor-DjN3MVkl.js +694 -0
  159. package/dist/visual-editor-DjdqpJU-.js +145 -0
  160. package/dist/visual-editor-DqddYaYq.js +694 -0
  161. package/dist/visual-editor-DrCmls4W.js +694 -0
  162. package/dist/visual-editor-DvuH3jyL.js +157 -0
  163. package/dist/visual-editor-TfVDfO5_.js +145 -0
  164. package/dist/visual-editor-VcrEkFyd.js +706 -0
  165. package/dist/visual-editor-W_ZDmMFn.js +145 -0
  166. package/dist/visual-editor-b7ALusk8.js +145 -0
  167. package/dist/visual-editor-bauJ9beX.js +694 -0
  168. package/dist/visual-editor-erGXf3kS.js +157 -0
  169. package/dist/visual-editor-hVELayZs.js +706 -0
  170. package/dist/visual-editor-xnDHZFuO.js +153 -0
  171. package/dist/visual-editor-yiWZqIH0.js +157 -0
  172. package/dist/visual-editor.css +1 -0
  173. package/dist/visual-editor.js +15074 -137463
  174. package/package.json +46 -25
  175. package/dist/editor.css +0 -1
  176. package/dist/visual-editor-1QC8zZX_.js +0 -221
  177. package/dist/visual-editor-5C5XV5rL.js +0 -221
  178. package/dist/visual-editor-B8-FoFxc.js +0 -1049
  179. package/dist/visual-editor-BJgCpnYV.js +0 -1073
  180. package/dist/visual-editor-BKLiin5z.js +0 -1049
  181. package/dist/visual-editor-BWbqw_QE.js +0 -233
  182. package/dist/visual-editor-Bb6upvTE.js +0 -221
  183. package/dist/visual-editor-BcZCBLFh.js +0 -1049
  184. package/dist/visual-editor-BecDYKH8.js +0 -1049
  185. package/dist/visual-editor-BllAUu_T.js +0 -1073
  186. package/dist/visual-editor-BmaYFuCe.js +0 -233
  187. package/dist/visual-editor-BnPFkJlo.js +0 -221
  188. package/dist/visual-editor-BoIXa-xl.js +0 -245
  189. package/dist/visual-editor-BtDJICJp.js +0 -1073
  190. package/dist/visual-editor-BwxWyr_L.js +0 -221
  191. package/dist/visual-editor-Bz7BlR_j.js +0 -221
  192. package/dist/visual-editor-CC0RAmib.js +0 -1049
  193. package/dist/visual-editor-CDY9slY9.js +0 -1061
  194. package/dist/visual-editor-CFebs6R8.js +0 -1049
  195. package/dist/visual-editor-CNL0HyVh.js +0 -1049
  196. package/dist/visual-editor-CYnzwNwX.js +0 -229
  197. package/dist/visual-editor-CZH605TK.js +0 -233
  198. package/dist/visual-editor-Cada46ZF.js +0 -1049
  199. package/dist/visual-editor-CheComxC.js +0 -1061
  200. package/dist/visual-editor-CuA8h_Xv.js +0 -221
  201. package/dist/visual-editor-CuRmgs-p.js +0 -245
  202. package/dist/visual-editor-D9_YWQQY.js +0 -1073
  203. package/dist/visual-editor-D9w4wRG8.js +0 -245
  204. package/dist/visual-editor-D9xTiOC0.js +0 -221
  205. package/dist/visual-editor-DA7CixSl.js +0 -1061
  206. package/dist/visual-editor-DAnBQ9H_.js +0 -221
  207. package/dist/visual-editor-DF8RsMvq.js +0 -233
  208. package/dist/visual-editor-DLrKYx7j.js +0 -1061
  209. package/dist/visual-editor-DQJc_Xok.js +0 -233
  210. package/dist/visual-editor-DTZFGKm7.js +0 -221
  211. package/dist/visual-editor-DXebihTA.js +0 -233
  212. package/dist/visual-editor-DZ4U1fk-.js +0 -221
  213. package/dist/visual-editor-Dg7P-vDv.js +0 -1057
  214. package/dist/visual-editor-Dh2cuwWt.js +0 -1049
  215. package/dist/visual-editor-DpetyO9o.js +0 -1049
  216. package/dist/visual-editor-Duav2tXb.js +0 -1061
  217. package/dist/visual-editor-DvYsu_s9.js +0 -221
  218. package/dist/visual-editor-DwlX3nnZ.js +0 -221
  219. package/dist/visual-editor-Dz5s66Og.js +0 -221
  220. package/dist/visual-editor-E57fPJMD.js +0 -1049
  221. package/dist/visual-editor-Fy_uEJju.js +0 -1061
  222. package/dist/visual-editor-G8e2TllW.js +0 -1049
  223. package/dist/visual-editor-HkfpXRw7.js +0 -1049
  224. package/dist/visual-editor-ZKG4e_Ey.js +0 -1049
  225. package/dist/visual-editor-rZRnDwgU.js +0 -245
@@ -0,0 +1,98 @@
1
+ import * as React from "react";
2
+ import {
3
+ isDirectoryGrid,
4
+ sortAlphabetically,
5
+ } from "../../../utils/directory/utils.ts";
6
+
7
+ export type DirectoryChildReference = {
8
+ childIndex: number;
9
+ childId?: string;
10
+ };
11
+
12
+ type DirectoryChild = {
13
+ id?: string;
14
+ name?: string;
15
+ [key: string]: any;
16
+ };
17
+
18
+ const DirectoryChildrenContext = React.createContext<DirectoryChild[]>([]);
19
+
20
+ export const DirectoryChildrenProvider = ({
21
+ children,
22
+ directoryChildren,
23
+ }: {
24
+ children: React.ReactNode;
25
+ directoryChildren: DirectoryChild[];
26
+ }) => (
27
+ <DirectoryChildrenContext.Provider value={directoryChildren}>
28
+ {children}
29
+ </DirectoryChildrenContext.Provider>
30
+ );
31
+
32
+ export const useDirectoryChildren = (): DirectoryChild[] =>
33
+ React.useContext(DirectoryChildrenContext);
34
+
35
+ export const getSortedDirectoryChildren = (
36
+ directoryChildren: unknown
37
+ ): DirectoryChild[] => {
38
+ if (
39
+ !Array.isArray(directoryChildren) ||
40
+ !isDirectoryGrid(directoryChildren)
41
+ ) {
42
+ return [];
43
+ }
44
+
45
+ return sortAlphabetically([...directoryChildren], "name");
46
+ };
47
+
48
+ export const createDirectoryChildReference = (
49
+ child: DirectoryChild | undefined,
50
+ childIndex: number
51
+ ): DirectoryChildReference => ({
52
+ childIndex,
53
+ ...(typeof child?.id === "string" ? { childId: child.id } : {}),
54
+ });
55
+
56
+ export const matchesDirectoryChildReference = (
57
+ childReference: DirectoryChildReference | undefined,
58
+ child: DirectoryChild | undefined,
59
+ childIndex: number
60
+ ): boolean => {
61
+ if (!childReference || childReference.childIndex !== childIndex) {
62
+ return false;
63
+ }
64
+
65
+ if (childReference.childId && childReference.childId !== child?.id) {
66
+ return false;
67
+ }
68
+
69
+ return true;
70
+ };
71
+
72
+ export const resolveDirectoryChildFromReference = (
73
+ directoryChildren: DirectoryChild[],
74
+ childReference: DirectoryChildReference | undefined
75
+ ): DirectoryChild | undefined => {
76
+ if (!childReference) {
77
+ return undefined;
78
+ }
79
+
80
+ const childAtIndex = directoryChildren[childReference.childIndex];
81
+ if (
82
+ matchesDirectoryChildReference(
83
+ childReference,
84
+ childAtIndex,
85
+ childReference.childIndex
86
+ )
87
+ ) {
88
+ return childAtIndex;
89
+ }
90
+
91
+ if (childReference.childId) {
92
+ return directoryChildren.find(
93
+ (child) => child?.id === childReference.childId
94
+ );
95
+ }
96
+
97
+ return childAtIndex;
98
+ };
@@ -0,0 +1,147 @@
1
+ import React from "react";
2
+ import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it, vi } from "vitest";
4
+ import { FilterModal } from "./Filters.tsx";
5
+
6
+ vi.mock("react-i18next", async () => {
7
+ const actual = await vi.importActual("react-i18next");
8
+ return {
9
+ ...actual,
10
+ useTranslation: () => ({
11
+ t: (_key: string, defaultValue: string) => defaultValue,
12
+ i18n: { language: "fr" },
13
+ }),
14
+ };
15
+ });
16
+
17
+ vi.mock("@yext/search-headless-react", async () => {
18
+ const actual = await vi.importActual<
19
+ typeof import("@yext/search-headless-react")
20
+ >("@yext/search-headless-react");
21
+ return {
22
+ ...actual,
23
+ useSearchState: (selector: (state: any) => unknown) =>
24
+ selector({
25
+ filters: {
26
+ facets: [
27
+ {
28
+ fieldId: "keywords",
29
+ options: [{ matcher: actual.Matcher.Equals, value: "retail" }],
30
+ },
31
+ {
32
+ fieldId: "services",
33
+ options: [{ matcher: actual.Matcher.Equals, value: "delivery" }],
34
+ },
35
+ {
36
+ fieldId: "languages",
37
+ options: [{ matcher: actual.Matcher.Equals, value: "French" }],
38
+ },
39
+ {
40
+ fieldId: "yearsOfExperience",
41
+ options: [
42
+ {
43
+ matcher: actual.Matcher.Between,
44
+ value: {
45
+ start: {
46
+ matcher: actual.Matcher.GreaterThanOrEqualTo,
47
+ value: 5,
48
+ },
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ },
55
+ }),
56
+ };
57
+ });
58
+
59
+ vi.mock("@yext/search-ui-react", async () => {
60
+ const actual = await vi.importActual<typeof import("@yext/search-ui-react")>(
61
+ "@yext/search-ui-react"
62
+ );
63
+
64
+ return {
65
+ ...actual,
66
+ AppliedFilters: () => null,
67
+ Facets: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
68
+ StandardFacet: ({
69
+ fieldId,
70
+ label,
71
+ }: {
72
+ fieldId: string;
73
+ label?: string;
74
+ }) => (
75
+ <div
76
+ data-testid={`facet-${fieldId}`}
77
+ data-label={label}
78
+ data-type="standard"
79
+ />
80
+ ),
81
+ NumericalFacet: ({
82
+ fieldId,
83
+ label,
84
+ }: {
85
+ fieldId: string;
86
+ label?: string;
87
+ }) => (
88
+ <div
89
+ data-testid={`facet-${fieldId}`}
90
+ data-label={label}
91
+ data-type="numerical"
92
+ />
93
+ ),
94
+ };
95
+ });
96
+
97
+ const renderFilterModal = (
98
+ keywordsDisplayName?: React.ComponentProps<
99
+ typeof FilterModal
100
+ >["keywordsDisplayName"]
101
+ ) =>
102
+ render(
103
+ <FilterModal
104
+ showFilterModal={true}
105
+ showOpenNowOption={false}
106
+ isOpenNowSelected={false}
107
+ showDistanceOptions={false}
108
+ selectedDistanceOption={null}
109
+ handleCloseModalClick={vi.fn()}
110
+ handleOpenNowClick={vi.fn()}
111
+ handleDistanceClick={vi.fn()}
112
+ handleClearFiltersClick={vi.fn()}
113
+ accentColorCssValue="#000"
114
+ closeButtonRef={React.createRef<HTMLButtonElement>()}
115
+ keywordsDisplayName={keywordsDisplayName}
116
+ />
117
+ );
118
+
119
+ describe("FilterModal", () => {
120
+ it("uses the current-locale display name only for the Keywords facet", () => {
121
+ renderFilterModal({
122
+ en: "Store Type",
123
+ fr: "Type de magasin",
124
+ hasLocalizedValue: "true",
125
+ });
126
+
127
+ expect(screen.getByTestId("facet-keywords").dataset.label).toBe(
128
+ "Type de magasin"
129
+ );
130
+ expect(screen.getByTestId("facet-services").dataset.label).toBeUndefined();
131
+ expect(screen.getByTestId("facet-languages").dataset.label).toBeUndefined();
132
+ expect(screen.getByTestId("facet-yearsOfExperience").dataset).toMatchObject(
133
+ {
134
+ type: "numerical",
135
+ }
136
+ );
137
+ });
138
+
139
+ it("leaves the Keywords label undefined when the current locale is missing", () => {
140
+ renderFilterModal({
141
+ en: "Store Type",
142
+ hasLocalizedValue: "true",
143
+ });
144
+
145
+ expect(screen.getByTestId("facet-keywords").dataset.label).toBeUndefined();
146
+ });
147
+ });