@salesforcedevs/dx-components 0.26.1 → 0.27.1

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 (255) hide show
  1. package/lwc.config.json +2 -1
  2. package/package.json +2 -6
  3. package/src/modules/{utils-internal → base-elements}/archiveCard/archiveCard.ts +0 -0
  4. package/src/modules/{utils-internal → base-elements}/headerBase/headerBase.ts +0 -0
  5. package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +1 -1
  6. package/src/modules/dx/cardCallout/cardCallout.ts +1 -1
  7. package/src/modules/dx/cardContent/cardContent.ts +2 -2
  8. package/src/modules/dx/cardDocs/cardDocs.ts +1 -1
  9. package/src/modules/dx/cardExpanded/cardExpanded.ts +1 -1
  10. package/src/modules/dx/cardMinimal/cardMinimal.ts +1 -1
  11. package/src/modules/dx/cardNews/cardNews.ts +1 -1
  12. package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +1 -1
  13. package/src/modules/dx/cardSmall/cardSmall.ts +1 -1
  14. package/src/modules/dx/codeBlock/codeBlock.ts +1 -1
  15. package/src/modules/dx/dropdown/dropdown.ts +1 -1
  16. package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +1 -1
  17. package/src/modules/dx/groupText/groupText.ts +1 -1
  18. package/src/modules/dx/header/header.ts +1 -1
  19. package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +1 -1
  20. package/src/modules/dx/headerSearch/headerSearch.ts +1 -1
  21. package/src/modules/dx/icon/icon.ts +1 -1
  22. package/src/modules/dx/iconBadge/iconBadge.ts +1 -1
  23. package/src/modules/dx/input/input.ts +1 -1
  24. package/src/modules/dx/modalDrawer/modalDrawer.css +40 -0
  25. package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
  26. package/src/modules/dx/modalDrawer/modalDrawer.ts +27 -0
  27. package/src/modules/dx/podcastSubscription/podcastSubscription.css +1 -2
  28. package/src/modules/dx/popover/popover.ts +1 -1
  29. package/src/modules/dx/section/section.ts +1 -1
  30. package/src/modules/dx/sidebar/sidebar.ts +1 -1
  31. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +2 -5
  32. package/src/modules/dx/slackCta/slackCta.css +14 -8
  33. package/src/modules/dx/slackCta/slackCta.html +2 -2
  34. package/src/modules/dx/slackCta/slackCta.ts +0 -1
  35. package/src/modules/dx/typeBadge/typeBadge.ts +1 -1
  36. package/src/modules/{utils-internal → utils}/coveo/coveo.ts +0 -0
  37. package/src/modules/{utils-internal → utils}/css/css.ts +0 -0
  38. package/src/modules/{utils-internal → utils}/devices/devices.ts +0 -0
  39. package/src/modules/utils/highlight/highlight.ts +1 -1
  40. package/src/modules/{utils-internal → utils}/options/options.ts +0 -0
  41. package/src/modules/{utils-internal → utils}/prismjs/prismjs.html +0 -0
  42. package/src/modules/{utils-internal → utils}/prismjs/prismjs.ts +0 -0
  43. package/src/modules/{utils-internal → utils}/recentSearches/recentSearches.ts +0 -0
  44. package/src/modules/{utils-internal → utils}/regexps/regexps.ts +0 -0
  45. package/src/modules/{utils-internal → utils}/seo/seo.ts +0 -0
  46. package/src/modules/{utils-internal → utils}/slot/slot.ts +0 -0
  47. package/src/modules/{utils-internal → utils}/wordpress/wordpress.ts +0 -0
  48. package/src/modules/dx/banner/__tests__/banner.test.ts +0 -33
  49. package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +0 -49
  50. package/src/modules/dx/brandThemeProvider/brandThemeProvider.stories.ts +0 -321
  51. package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +0 -140
  52. package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +0 -28
  53. package/src/modules/dx/breadcrumbs/breadcrumbs.stories.ts +0 -39
  54. package/src/modules/dx/button/__tests__/button.test.ts +0 -107
  55. package/src/modules/dx/button/button.stories.ts +0 -150
  56. package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +0 -26
  57. package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +0 -12
  58. package/src/modules/dx/cardBlogPost/cardBlogPost.stories.ts +0 -164
  59. package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +0 -34
  60. package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +0 -44
  61. package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +0 -20
  62. package/src/modules/dx/cardCallout/__tests__/mockProps.ts +0 -7
  63. package/src/modules/dx/cardCallout/cardCallout.stories.ts +0 -33
  64. package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +0 -100
  65. package/src/modules/dx/cardContent/__tests__/mockProps.ts +0 -13
  66. package/src/modules/dx/cardContent/cardContent.stories.ts +0 -127
  67. package/src/modules/dx/cardDemo/cardDemo.stories.ts +0 -115
  68. package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +0 -48
  69. package/src/modules/dx/cardDocs/__tests__/mockProps.ts +0 -9
  70. package/src/modules/dx/cardDocs/cardDocs.stories.ts +0 -299
  71. package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +0 -95
  72. package/src/modules/dx/cardEvent/__tests__/mockProps.ts +0 -10
  73. package/src/modules/dx/cardEvent/cardEvent.stories.ts +0 -153
  74. package/src/modules/dx/cardExpanded/__tests__/cardExpanded.test.ts +0 -193
  75. package/src/modules/dx/cardExpanded/__tests__/mockProps.ts +0 -21
  76. package/src/modules/dx/cardExpanded/cardExpanded.stories.ts +0 -59
  77. package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +0 -431
  78. package/src/modules/dx/cardGrid/__tests__/mockProps.ts +0 -15
  79. package/src/modules/dx/cardGrid/cardGrid.stories.ts +0 -111
  80. package/src/modules/dx/cardMinimal/__tests__/cardMinimal.test.ts +0 -87
  81. package/src/modules/dx/cardMinimal/__tests__/mockProps.ts +0 -10
  82. package/src/modules/dx/cardMinimal/cardMinimal.stories.ts +0 -32
  83. package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +0 -58
  84. package/src/modules/dx/cardNews/__tests__/mockProps.ts +0 -7
  85. package/src/modules/dx/cardNews/cardNews.stories.ts +0 -115
  86. package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +0 -68
  87. package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.stories.ts +0 -31
  88. package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +0 -36
  89. package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +0 -50
  90. package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +0 -66
  91. package/src/modules/dx/cardSmall/__tests__/mockProps.ts +0 -8
  92. package/src/modules/dx/cardSmall/cardSmall.stories.ts +0 -166
  93. package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +0 -46
  94. package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +0 -18
  95. package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +0 -11
  96. package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.stories.ts +0 -122
  97. package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +0 -22
  98. package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +0 -11
  99. package/src/modules/dx/cardVideoPreview/cardVideoPreview.stories.ts +0 -147
  100. package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +0 -85
  101. package/src/modules/dx/checkbox/__tests__/mockProps.ts +0 -5
  102. package/src/modules/dx/checkbox/checkbox.stories.ts +0 -38
  103. package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +0 -80
  104. package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +0 -14
  105. package/src/modules/dx/checkboxGroup/checkboxGroup.stories.ts +0 -33
  106. package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +0 -238
  107. package/src/modules/dx/codeBlock/__tests__/mockProps.ts +0 -160
  108. package/src/modules/dx/codeBlock/codeBlock.stories.ts +0 -143
  109. package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +0 -165
  110. package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +0 -96
  111. package/src/modules/dx/dropdown/__tests__/mockOptions.ts +0 -10
  112. package/src/modules/dx/dropdown/__tests__/mockProps.ts +0 -6
  113. package/src/modules/dx/dropdown/dropdown.stories.ts +0 -89
  114. package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +0 -112
  115. package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +0 -20
  116. package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +0 -52
  117. package/src/modules/dx/emptyState/__tests__/mockProps.ts +0 -4
  118. package/src/modules/dx/emptyState/emptyState.stories.ts +0 -45
  119. package/src/modules/dx/feature/__tests__/feature.test.ts +0 -51
  120. package/src/modules/dx/feature/__tests__/mockProps.ts +0 -8
  121. package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +0 -21
  122. package/src/modules/dx/featureGrid/featureGrid.stories.ts +0 -120
  123. package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +0 -178
  124. package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +0 -73
  125. package/src/modules/dx/featuredContentHeader/featuredContentHeader.stories.ts +0 -153
  126. package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +0 -43
  127. package/src/modules/dx/featuresList/__tests__/mockProps.ts +0 -17
  128. package/src/modules/dx/featuresList/featuresList.stories.ts +0 -30
  129. package/src/modules/dx/footer/__tests__/footer.test.ts +0 -147
  130. package/src/modules/dx/footer/__tests__/mockLocales.ts +0 -7
  131. package/src/modules/dx/footer/footer.stories.ts +0 -88
  132. package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +0 -34
  133. package/src/modules/dx/footerOption/__tests__/mockProps.ts +0 -7
  134. package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +0 -25
  135. package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +0 -13
  136. package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +0 -103
  137. package/src/modules/dx/grid/__tests__/grid.test.ts +0 -32
  138. package/src/modules/dx/grid/grid.stories.ts +0 -134
  139. package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +0 -82
  140. package/src/modules/dx/groupBio/__tests__/mockProps.ts +0 -15
  141. package/src/modules/dx/groupBio/groupBio.stories.ts +0 -66
  142. package/src/modules/dx/groupText/__tests__/groupText.test.ts +0 -69
  143. package/src/modules/dx/groupText/__tests__/mockProps.ts +0 -35
  144. package/src/modules/dx/groupText/groupText.stories.ts +0 -81
  145. package/src/modules/dx/header/__tests__/header.test.ts +0 -236
  146. package/src/modules/dx/header/__tests__/mockNavArchitects.ts +0 -169
  147. package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +0 -419
  148. package/src/modules/dx/header/__tests__/mockNavs.ts +0 -115
  149. package/src/modules/dx/header/__tests__/mockProps.ts +0 -164
  150. package/src/modules/dx/header/header.stories.ts +0 -172
  151. package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +0 -123
  152. package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +0 -38
  153. package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +0 -49
  154. package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +0 -182
  155. package/src/modules/dx/headerSearch/__tests__/mockData.ts +0 -11
  156. package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -6
  157. package/src/modules/dx/helmet/__tests__/helmet.test.ts +0 -52
  158. package/src/modules/dx/helmet/helmet.stories.ts +0 -53
  159. package/src/modules/dx/hr/__tests__/hr.test.ts +0 -53
  160. package/src/modules/dx/hr/__tests__/mockProps.ts +0 -16
  161. package/src/modules/dx/hr/hr.stories.ts +0 -50
  162. package/src/modules/dx/icon/__tests__/icon.test.ts +0 -54
  163. package/src/modules/dx/icon/icon.stories.ts +0 -100
  164. package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +0 -17
  165. package/src/modules/dx/iconBadge/iconBadge.stories.ts +0 -32
  166. package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +0 -39
  167. package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +0 -6
  168. package/src/modules/dx/imageAndLabel/imageAndLabel.stories.ts +0 -48
  169. package/src/modules/dx/input/__tests__/input.test.ts +0 -357
  170. package/src/modules/dx/input/input.stories.ts +0 -102
  171. package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +0 -86
  172. package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +0 -83
  173. package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +0 -39
  174. package/src/modules/dx/interactiveImage/interactiveImage.stories.ts +0 -31
  175. package/src/modules/dx/lazy/__tests__/lazy.test.ts +0 -43
  176. package/src/modules/dx/lazy/lazy.stories.ts +0 -132
  177. package/src/modules/dx/pagination/__tests__/pagination.test.ts +0 -121
  178. package/src/modules/dx/pagination/pagination.stories.ts +0 -88
  179. package/src/modules/dx/podcastHost/__tests__/mockProps.ts +0 -8
  180. package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +0 -21
  181. package/src/modules/dx/podcastHost/podcastHost.stories.ts +0 -17
  182. package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +0 -20
  183. package/src/modules/dx/podcastPlayer/podcastPlayer.stories.ts +0 -13
  184. package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +0 -16
  185. package/src/modules/dx/podcastSubscription/podcastSubscription.stories.ts +0 -23
  186. package/src/modules/dx/popover/__tests__/mockProps.ts +0 -8
  187. package/src/modules/dx/popover/__tests__/popover.test.ts +0 -313
  188. package/src/modules/dx/popover/popover.stories.ts +0 -82
  189. package/src/modules/dx/radioGroup/__tests__/mockProps.ts +0 -12
  190. package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +0 -42
  191. package/src/modules/dx/radioGroup/radioGroup.stories.ts +0 -25
  192. package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +0 -55
  193. package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +0 -52
  194. package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +0 -83
  195. package/src/modules/dx/searchResults/searchResults.stories.ts +0 -36
  196. package/src/modules/dx/section/__tests__/section.test.ts +0 -17
  197. package/src/modules/dx/section/section.stories.ts +0 -381
  198. package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +0 -66
  199. package/src/modules/dx/sectionSignup/sectionSignup.stories.ts +0 -49
  200. package/src/modules/dx/select/select.stories.ts +0 -59
  201. package/src/modules/dx/sidebar/__tests__/mockProps.ts +0 -181
  202. package/src/modules/dx/sidebar/__tests__/mockSearchChangeEmptyEvent.ts +0 -6
  203. package/src/modules/dx/sidebar/__tests__/mockSearchChangeEvent.ts +0 -527
  204. package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -568
  205. package/src/modules/dx/sidebar/sidebar.stories.ts +0 -188
  206. package/src/modules/dx/sidebarOld/__tests__/mockProps.ts +0 -178
  207. package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +0 -570
  208. package/src/modules/dx/sidebarOld/sidebarOld.stories.ts +0 -139
  209. package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +0 -1686
  210. package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +0 -175
  211. package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +0 -96
  212. package/src/modules/dx/slackCta/__tests__/slackCta.test.ts +0 -48
  213. package/src/modules/dx/slackCta/slackCta.stories.ts +0 -25
  214. package/src/modules/dx/socials/__tests__/socials.test.ts +0 -114
  215. package/src/modules/dx/socials/socials.stories.ts +0 -24
  216. package/src/modules/dx/spinner/__tests__/spinner.test.ts +0 -37
  217. package/src/modules/dx/spinner/spinner.stories.ts +0 -69
  218. package/src/modules/dx/tab/__tests__/tab.test.ts +0 -129
  219. package/src/modules/dx/tab/tab.stories.ts +0 -57
  220. package/src/modules/dx/toc/__tests__/mockProps.ts +0 -28
  221. package/src/modules/dx/toc/__tests__/toc.test.ts +0 -109
  222. package/src/modules/dx/toc/toc.stories.ts +0 -26
  223. package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +0 -22
  224. package/src/modules/dx/tooltip/tooltip.stories.ts +0 -46
  225. package/src/modules/dx/topics/__tests__/mockProps.ts +0 -3
  226. package/src/modules/dx/topics/__tests__/topics.test.ts +0 -31
  227. package/src/modules/dx/tree/__tests__/mockProps.ts +0 -215
  228. package/src/modules/dx/tree/__tests__/tree.test.ts +0 -346
  229. package/src/modules/dx/tree/__tests__/treeHandler.test.ts +0 -194
  230. package/src/modules/dx/tree/tree.stories.ts +0 -65
  231. package/src/modules/dx/treeItem/__tests__/mockProps.ts +0 -46
  232. package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +0 -377
  233. package/src/modules/dx/treeTile/__tests__/mockProps.ts +0 -16
  234. package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +0 -168
  235. package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +0 -77
  236. package/src/modules/dx/typeBadge/typeBadge.stories.ts +0 -114
  237. package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +0 -11
  238. package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +0 -72
  239. package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.stories.ts +0 -19
  240. package/src/modules/test-components/buttonTest/buttonTest.html +0 -3
  241. package/src/modules/test-components/buttonTest/buttonTest.ts +0 -3
  242. package/src/modules/test-components/codeBlockTest/codeBlockTest.js +0 -4
  243. package/src/modules/test-components/featureGridTest/featureGridTest.html +0 -7
  244. package/src/modules/test-components/featureGridTest/featureGridTest.ts +0 -5
  245. package/src/modules/test-components/instrumentationTest/instrumentationTest.html +0 -4
  246. package/src/modules/test-components/instrumentationTest/instrumentationTest.ts +0 -8
  247. package/src/modules/test-components/popoverTest/popoverTest.html +0 -6
  248. package/src/modules/test-components/popoverTest/popoverTest.ts +0 -5
  249. package/src/modules/utils/highlight/__tests__/highlight.test.ts +0 -108
  250. package/src/modules/utils/highlight/__tests__/mockProps.ts +0 -45
  251. package/src/modules/utils-internal/jest/jest.ts +0 -58
  252. package/src/modules/utils-internal/recentSearches/__tests__/recentSearches.test.ts +0 -83
  253. package/src/modules/utils-internal/storybook/storybook.ts +0 -32
  254. package/src/modules/utils-internal/tests/tests.ts +0 -38
  255. package/src/modules/utils-internal/wordpress/__tests__/wordpress.test.ts +0 -15
@@ -1,175 +0,0 @@
1
- import { createElement } from "lwc";
2
- import SidebarSearch from "dx/sidebarSearch";
3
- import {
4
- createRenderComponent,
5
- renderLightningElement
6
- } from "utils-internal/tests";
7
- import { coveoXMLDocsConfig } from "utils-internal/coveo";
8
- import { mockQueryParameter, unmockQueryParameter } from "utils-internal/jest";
9
- import { SESSION_KEY } from "dx/sidebarSearch";
10
- import mockPreloadedState from "./mockPreloadedState";
11
-
12
- const TAG = "dx-sidebar-search";
13
- const render = createRenderComponent(TAG, SidebarSearch);
14
-
15
- const PROPS = coveoXMLDocsConfig;
16
- const QUERY = "test";
17
-
18
- describe(TAG, () => {
19
- beforeEach(() => {
20
- window.sessionStorage.clear();
21
- jest.restoreAllMocks();
22
- });
23
- afterEach(unmockQueryParameter);
24
-
25
- it("correctly sets coveo advanced configuration", () => {
26
- const element = render(PROPS);
27
-
28
- element.coveoAdvancedQueryConfig = JSON.stringify(
29
- coveoXMLDocsConfig.coveoAdvancedQueryConfig
30
- );
31
-
32
- expect(element.coveoAdvancedQueryConfig).toEqual(
33
- coveoXMLDocsConfig.coveoAdvancedQueryConfig
34
- );
35
-
36
- return expect(element).toBeAccessible();
37
- });
38
-
39
- it("calls dispatchOnChangeEvent with empty query", () => {
40
- const element = render(PROPS);
41
-
42
- const mockOnChange = jest.fn();
43
-
44
- element.addEventListener("change", mockOnChange);
45
-
46
- element.setInputValue("reference");
47
- element.setInputValue("");
48
-
49
- expect(mockOnChange).toHaveBeenCalled();
50
- return expect(element).toBeAccessible();
51
- });
52
-
53
- it("renders with the correct initial empty query", () => {
54
- const element = render(PROPS);
55
-
56
- const input = element.shadowRoot.querySelector("dx-input");
57
-
58
- expect(input.value).toEqual("");
59
-
60
- return expect(element).toBeAccessible();
61
- });
62
-
63
- it("renders with the correct initial query", () => {
64
- mockQueryParameter(QUERY);
65
-
66
- const element = render(PROPS);
67
-
68
- const input = element.shadowRoot.querySelector("dx-input");
69
-
70
- expect(input.value).toEqual(QUERY);
71
-
72
- return expect(element).toBeAccessible();
73
- });
74
-
75
- describe("highlighting", () => {
76
- afterEach(unmockQueryParameter);
77
-
78
- it("triggers on initial render when a search value exists", () => {
79
- mockQueryParameter(QUERY);
80
- const element = createElement(TAG, { is: SidebarSearch });
81
- const dispatchEventSpy = jest.spyOn(element, "dispatchEvent");
82
- renderLightningElement(element, PROPS);
83
- expect(dispatchEventSpy).toHaveBeenCalledWith(
84
- expect.objectContaining({
85
- type: "highlightedtermchange",
86
- detail: QUERY
87
- })
88
- );
89
- });
90
-
91
- it("does not trigger on initial render when a search value does not exist", () => {
92
- const element = createElement(TAG, { is: SidebarSearch });
93
- const dispatchEventSpy = jest.spyOn(element, "dispatchEvent");
94
- renderLightningElement(element, PROPS);
95
- expect(dispatchEventSpy).not.toHaveBeenCalledWith(
96
- expect.objectContaining({ type: "highlightedtermchange" })
97
- );
98
- });
99
-
100
- it("triggers on input change with non-empty value", () => {
101
- const element = render(PROPS);
102
- const dxInput = element.shadowRoot.querySelector("dx-input");
103
- const dispatchEventSpy = jest.spyOn(element, "dispatchEvent");
104
-
105
- dxInput.dispatchEvent(new CustomEvent("change", { detail: QUERY }));
106
-
107
- expect(dispatchEventSpy).toHaveBeenCalledWith(
108
- expect.objectContaining({
109
- type: "highlightedtermchange",
110
- detail: QUERY
111
- })
112
- );
113
- });
114
-
115
- it("triggers on input change with empty value", () => {
116
- const element = render(PROPS);
117
- const dxInput = element.shadowRoot.querySelector("dx-input");
118
- const dispatchEventSpy = jest.spyOn(element, "dispatchEvent");
119
-
120
- dxInput.dispatchEvent(new CustomEvent("change", { detail: "" }));
121
-
122
- expect(dispatchEventSpy).toHaveBeenCalledWith(
123
- expect.objectContaining({
124
- type: "highlightedtermchange",
125
- detail: ""
126
- })
127
- );
128
- });
129
- });
130
-
131
- it("correctly consumes a valid session storage object", () => {
132
- mockQueryParameter(mockPreloadedState.state.query.q);
133
-
134
- window.sessionStorage.setItem(
135
- SESSION_KEY,
136
- JSON.stringify(mockPreloadedState)
137
- );
138
-
139
- const element = render(PROPS);
140
-
141
- expect(window.sessionStorage.getItem(SESSION_KEY)).not.toBeNull();
142
-
143
- expect(element).toBeAccessible();
144
- });
145
-
146
- it("ignores and deletes a session storage object if query and config don't match", () => {
147
- mockQueryParameter("test");
148
-
149
- window.sessionStorage.setItem(
150
- SESSION_KEY,
151
- JSON.stringify(mockPreloadedState)
152
- );
153
-
154
- const element = render(PROPS);
155
-
156
- expect(window.sessionStorage.getItem(SESSION_KEY)).toBeNull();
157
-
158
- expect(element).toBeAccessible();
159
- });
160
-
161
- it("ignores and deletes a session storage object on incorrect config", () => {
162
- mockQueryParameter(mockPreloadedState.state.query.q);
163
-
164
- window.sessionStorage.setItem(
165
- SESSION_KEY,
166
- JSON.stringify({ state: { query: { q: "test" } } })
167
- );
168
-
169
- const element = render(PROPS);
170
-
171
- expect(window.sessionStorage.getItem(SESSION_KEY)).toBeNull();
172
-
173
- expect(element).toBeAccessible();
174
- });
175
- });
@@ -1,96 +0,0 @@
1
- import SidebarSearchResult from "dx/sidebarSearchResult";
2
- import { createRenderComponent } from "utils-internal/tests";
3
-
4
- const TAG = "dx-sidebar-search-result";
5
- const render = createRenderComponent(TAG, SidebarSearchResult);
6
-
7
- const MOCK_RESULT = {
8
- description: "test description here",
9
- descriptionHighlights: [{ length: 5, offset: 5 }],
10
- href: "/test",
11
- selected: false,
12
- title: "test title here",
13
- titleHighlights: [{ length: 5, offset: 5 }]
14
- };
15
-
16
- const MOCK_RESULT_2 = {
17
- description:
18
- "Auth.MyDomainLoginDiscoveryHandler to show a custom error message on the My Domain login page ... Auth.LoginDiscoveryHandler to show an error message on the Experience Cloud site login page",
19
- descriptionHighlights: [
20
- { length: 4, offset: 0 },
21
- { length: 4, offset: 98 }
22
- ],
23
- href: "/test",
24
- selected: false,
25
- title: "Auth Exceptions | Apex Reference Guide | Salesforce Developers",
26
- titleHighlights: [{ length: 4, offset: 0 }]
27
- };
28
-
29
- describe(TAG, () => {
30
- it("renders a result with the correct highlighted content", () => {
31
- const element = render(MOCK_RESULT);
32
-
33
- const title = element.shadowRoot.querySelector(".title");
34
- const titleBolds = element.shadowRoot.querySelectorAll(".title .bold");
35
- expect(title.textContent).toEqual(MOCK_RESULT.title);
36
- expect(titleBolds.length).toEqual(MOCK_RESULT.titleHighlights.length);
37
- expect(titleBolds[0].textContent).toEqual("title");
38
-
39
- const description = element.shadowRoot.querySelector(".description");
40
- const descriptionBolds =
41
- element.shadowRoot.querySelectorAll(".description .bold");
42
- expect(description.textContent).toEqual(MOCK_RESULT.description);
43
- expect(descriptionBolds.length).toEqual(
44
- MOCK_RESULT.descriptionHighlights.length
45
- );
46
- expect(descriptionBolds[0].textContent).toEqual("descr");
47
-
48
- return expect(element).toBeAccessible();
49
- });
50
-
51
- it("renders another result variant with the correct highlighted content", () => {
52
- const element = render(MOCK_RESULT_2);
53
-
54
- const title = element.shadowRoot.querySelector(".title");
55
- const titleBolds = element.shadowRoot.querySelectorAll(".title .bold");
56
- expect(title.textContent).toEqual(MOCK_RESULT_2.title);
57
- expect(titleBolds.length).toEqual(MOCK_RESULT_2.titleHighlights.length);
58
- expect(titleBolds[0].textContent).toEqual("Auth");
59
-
60
- const description = element.shadowRoot.querySelector(".description");
61
- const descriptionBolds =
62
- element.shadowRoot.querySelectorAll(".description .bold");
63
- expect(description.textContent).toEqual(MOCK_RESULT_2.description);
64
- expect(descriptionBolds.length).toEqual(
65
- MOCK_RESULT_2.descriptionHighlights.length
66
- );
67
- expect(descriptionBolds[0].textContent).toEqual("Auth");
68
- expect(descriptionBolds[1].textContent).toEqual("Auth");
69
-
70
- return expect(element).toBeAccessible();
71
- });
72
-
73
- it("renders a result as selected when specified", () => {
74
- const element = render({ ...MOCK_RESULT, selected: true });
75
-
76
- const selected = element.shadowRoot.querySelector(
77
- ".sidebar-item-selected"
78
- );
79
- expect(selected).not.toBeNull();
80
-
81
- return expect(element).toBeAccessible();
82
- });
83
-
84
- it("doesn't add bold class when there is no highlighted term", () => {
85
- const element = render({
86
- ...MOCK_RESULT,
87
- descriptionHighlights: [],
88
- titleHighlights: []
89
- });
90
-
91
- const selected = element.shadowRoot.querySelector(".bold");
92
- expect(selected).toBeNull();
93
-
94
- return expect(element).toBeAccessible();
95
- });
96
- });
@@ -1,48 +0,0 @@
1
- import slackCta from "dx/slackCta";
2
- import { createRenderComponent } from "utils-internal/tests";
3
-
4
- const TAG = "dx-slack-cta";
5
- const render = createRenderComponent(TAG, slackCta);
6
-
7
- describe(TAG, () => {
8
- it("renders the button linking to slack", () => {
9
- const element = render();
10
-
11
- const slackBtn = element.shadowRoot.querySelectorAll(".button");
12
- expect(slackBtn).not.toBe(undefined);
13
- return expect(slackBtn.length).toBe(1);
14
- });
15
-
16
- it("renders a button meeting all accesibilty requirements", () => {
17
- const element = render();
18
- return expect(element).toBeAccessible();
19
- });
20
-
21
- it("renders the inner button text correctly", () => {
22
- const element = render({
23
- innerText: "foobar"
24
- });
25
-
26
- const header = element.shadowRoot
27
- .querySelectorAll(".container")
28
- .item(0);
29
- expect(header.textContent).toBe("Follow along with Slackfoobar");
30
-
31
- const slackBtn = element.shadowRoot.querySelectorAll(".button").item(0);
32
- return expect(slackBtn.textContent).toBe("foobar");
33
- });
34
-
35
- it("renders the header text correctly", () => {
36
- const element = render({
37
- headerText: "foobar"
38
- });
39
-
40
- const slackBtn = element.shadowRoot.querySelectorAll(".button").item(0);
41
- expect(slackBtn.textContent).toBe("Add to Slack");
42
-
43
- const header = element.shadowRoot
44
- .querySelectorAll(".container")
45
- .item(0);
46
- return expect(header.textContent).toBe("foobarAdd to Slack");
47
- });
48
- });
@@ -1,25 +0,0 @@
1
- export default {
2
- title: "dx/dx-slack-cta",
3
- component: "dx-slack-cta"
4
- };
5
-
6
- const createStyles = () => `
7
- <style>
8
- h2 {
9
- font-weight: bold;
10
- font-size: 24px;
11
- margin: 10px 0 30px 0;
12
- }
13
- </style>
14
- `;
15
-
16
- export const Base = () => `
17
- ${createStyles()}
18
- <h2>Add to Slack</h2>
19
-
20
- <dx-slack-cta header-text="Get notified of new episodes with the new Salesforce Developers Slack app" background="podcast"></dx-slack-cta>
21
-
22
- <dx-slack-cta header-text="Get the latest Salesforce Developer posts exactly how you want." inner-text="Send posts to Slack" background="blog"></dx-slack-cta>
23
-
24
- <dx-slack-cta header-text="Get notified of new events with the new Salesforce Developers Slack app"></dx-slack-cta>
25
- `;
@@ -1,114 +0,0 @@
1
- import Socials from "dx/socials";
2
- import IconBadge from "dx/iconBadge";
3
- import { createRenderComponent } from "utils-internal/tests";
4
-
5
- const TAG = "dx-socials";
6
- const render = createRenderComponent(TAG, Socials);
7
-
8
- const TEST_URL = encodeURIComponent(window.location.href);
9
-
10
- describe(TAG, () => {
11
- const originalConsole = global.console;
12
-
13
- beforeAll(() => {
14
- global.console = { ...global.console, error: jest.fn() };
15
- });
16
-
17
- afterAll(() => {
18
- global.console = originalConsole;
19
- });
20
-
21
- it("renders dx-icon-badge for each social link", () => {
22
- const component = render();
23
-
24
- const links: Array<HTMLAnchorElement> =
25
- component.shadowRoot.querySelectorAll("a");
26
- expect(links).toHaveLength(3);
27
-
28
- const [facebookLink, twitterLink, linkedinLink] = links;
29
-
30
- expect(facebookLink.href).toBe(
31
- `https://www.facebook.com/sharer/sharer.php?u=${TEST_URL}`
32
- );
33
- expect(facebookLink.target).toBe("_blank");
34
- expect(facebookLink.title).toBe("Facebook");
35
-
36
- expect(twitterLink.href).toBe(
37
- `https://twitter.com/intent/tweet?url=${TEST_URL}&text=${document.title}`
38
- );
39
- expect(twitterLink.target).toBe("_blank");
40
- expect(twitterLink.title).toBe("Twitter");
41
-
42
- expect(linkedinLink.href).toBe(
43
- `http://www.linkedin.com/sharing/share-offsite/?url=${TEST_URL}`
44
- );
45
- expect(linkedinLink.target).toBe("_blank");
46
- expect(linkedinLink.title).toBe("Linkedin");
47
-
48
- const iconBadge: Array<IconBadge> =
49
- component.shadowRoot.querySelectorAll("dx-icon-badge");
50
- expect(iconBadge).toHaveLength(3);
51
-
52
- const [facebookIcon, twitterIcon, linkedinIcon] = iconBadge;
53
-
54
- expect(facebookIcon.sprite).toBe("brand");
55
- expect(facebookIcon.symbol).toBe("facebook-f");
56
-
57
- expect(twitterIcon.sprite).toBe("brand");
58
- expect(twitterIcon.symbol).toBe("twitter");
59
-
60
- expect(linkedinIcon.sprite).toBe("brand");
61
- expect(linkedinIcon.symbol).toBe("linkedin-in");
62
-
63
- const detailSection =
64
- component.shadowRoot.querySelector(".details-section");
65
- expect(detailSection).toBeNull();
66
-
67
- return expect(component).toBeAccessible();
68
- });
69
-
70
- it("renders the specified target for each 'a' tag", () => {
71
- const expectedTarget = "_self";
72
- const component = render({ linksTarget: expectedTarget });
73
-
74
- const links: Array<HTMLAnchorElement> =
75
- component.shadowRoot.querySelectorAll("a");
76
- expect(links).toHaveLength(3);
77
- links.forEach(({ target }) => expect(target).toBe(expectedTarget));
78
-
79
- expect(global.console.error).not.toBeCalled();
80
-
81
- return expect(component).toBeAccessible();
82
- });
83
-
84
- it("doesn't update target if not valid", () => {
85
- const testTarget = "not_valid_at_all";
86
- const component = render({ linksTarget: testTarget });
87
-
88
- const links: Array<HTMLAnchorElement> =
89
- component.shadowRoot.querySelectorAll("a");
90
- expect(links).toHaveLength(3);
91
- links.forEach(({ target }) => expect(target).toBe("_blank"));
92
-
93
- expect(global.console.error).toBeCalledTimes(1);
94
- expect(global.console.error).toBeCalledWith(
95
- "Invalid links target, valid options are: _self, _blank, _parent, _top, framename"
96
- );
97
-
98
- return expect(component).toBeAccessible();
99
- });
100
-
101
- it("renders details section", () => {
102
- const component = render({ details: "Test|Another Test" });
103
-
104
- const details: Array<HTMLElement> =
105
- component.shadowRoot.querySelectorAll(".details-section span");
106
- expect(details).toHaveLength(2);
107
-
108
- const [testDetail, anotherTestDetail] = details;
109
- expect(testDetail.textContent).toBe("Test");
110
- expect(anotherTestDetail.textContent).toBe("Another Test");
111
-
112
- return expect(component).toBeAccessible();
113
- });
114
- });
@@ -1,24 +0,0 @@
1
- import { html } from "lit-html";
2
-
3
- export default {
4
- title: "dx/dx-socials",
5
- component: "dx-socials"
6
- };
7
-
8
- export const Base = () => html` <dx-socials></dx-socials> `;
9
-
10
- export const SocialWithTarget = ({ target }: any) => html`
11
- <dx-socials links-target="${target}"></dx-socials>
12
- `;
13
-
14
- SocialWithTarget.args = {
15
- target: "_top"
16
- };
17
-
18
- export const SocialWithDetails = ({ details }: any) => html`
19
- <dx-socials details="${details}"></dx-socials>
20
- `;
21
-
22
- SocialWithDetails.args = {
23
- details: "jan 18, 2021|12 min read"
24
- };
@@ -1,37 +0,0 @@
1
- import Spinner from "dx/spinner";
2
- import { createRenderComponent } from "utils-internal/tests";
3
-
4
- const TAG = "dx-spinner";
5
- const render = createRenderComponent(TAG, Spinner);
6
-
7
- describe(TAG, () => {
8
- it("renders", () => {
9
- const component: HTMLElement = render();
10
-
11
- expect(component.classList).toHaveLength(1);
12
- expect(component.classList).toContain("spinner_container");
13
- const container = component.shadowRoot!.querySelector(".spinner");
14
-
15
- expect(container).not.toBeNull();
16
- expect(container?.classList).toHaveLength(2);
17
- expect(container?.classList).toContain(`spinner_medium`);
18
-
19
- return expect(component).toBeAccessible();
20
- });
21
-
22
- it("renders with size and variant", () => {
23
- const size = "large";
24
- const variant = "inverse";
25
- const component: HTMLElement = render({
26
- size,
27
- variant
28
- });
29
-
30
- const container = component.shadowRoot?.querySelector(".spinner");
31
- expect(container?.classList).toHaveLength(3);
32
- expect(container?.classList).toContain(`spinner_${size}`);
33
- expect(container?.classList).toContain(`spinner_${variant}`);
34
-
35
- return expect(component).toBeAccessible();
36
- });
37
- });
@@ -1,69 +0,0 @@
1
- import { html } from "lit-html";
2
- import { SpinnerSize, SpinnerVariant } from "typings/custom";
3
-
4
- type SpinnerStoryArgs = {
5
- size: SpinnerSize;
6
- variant: SpinnerVariant;
7
- };
8
-
9
- const sizeOptions: Array<SpinnerSize> = ["medium", "x-small", "small", "large"];
10
- const variantOptions: Array<SpinnerVariant> = ["base", "brand", "inverse"];
11
- const variantToBackgroundColor: { [key: string]: string } = {
12
- inverse: "black"
13
- };
14
-
15
- export default {
16
- title: "dx/dx-spinner",
17
- component: "dx-spinner",
18
- argTypes: {
19
- size: {
20
- control: {
21
- type: "select",
22
- options: sizeOptions
23
- }
24
- },
25
- variant: {
26
- control: {
27
- type: "select",
28
- options: variantOptions
29
- }
30
- }
31
- }
32
- };
33
-
34
- const style = (variant: SpinnerVariant = "base") => html`
35
- <style>
36
- .spinner-wrapper {
37
- position: relative;
38
- height: 100vh;
39
- background-color: ${variantToBackgroundColor[variant] || "white"};
40
- }
41
- </style>
42
- `;
43
-
44
- const [defaultSize] = sizeOptions;
45
- const [defaultVariant] = variantOptions;
46
-
47
- const Template = ({ size, variant }: SpinnerStoryArgs) => html`
48
- ${style(variant)}
49
- <div class="spinner-wrapper">
50
- <dx-spinner
51
- size="${size || defaultSize}"
52
- variant="${variant || defaultVariant}"
53
- ></dx-spinner>
54
- </div>
55
- `;
56
-
57
- export const Base = Template;
58
-
59
- export const BrandLarge = (args: SpinnerStoryArgs) => Template(args);
60
- BrandLarge.args = {
61
- size: "large",
62
- variant: "brand"
63
- };
64
-
65
- export const InverseSmall = (args: SpinnerStoryArgs) => Template(args);
66
- InverseSmall.args = {
67
- size: "small",
68
- variant: "inverse"
69
- };