@salesforcedevs/dx-components 0.26.1-alpha.12 → 0.26.1-alpha.13

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 (226) hide show
  1. package/lwc.config.json +1 -1
  2. package/package.json +1 -8
  3. package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +1 -1
  4. package/src/modules/dx/cardCallout/cardCallout.ts +1 -1
  5. package/src/modules/dx/cardContent/cardContent.ts +2 -2
  6. package/src/modules/dx/cardDocs/cardDocs.ts +1 -1
  7. package/src/modules/dx/cardExpanded/cardExpanded.ts +1 -1
  8. package/src/modules/dx/cardMinimal/cardMinimal.ts +1 -1
  9. package/src/modules/dx/cardNews/cardNews.ts +1 -1
  10. package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +1 -1
  11. package/src/modules/dx/cardSmall/cardSmall.ts +1 -1
  12. package/src/modules/dx/codeBlock/codeBlock.ts +1 -1
  13. package/src/modules/dx/dropdown/dropdown.ts +1 -1
  14. package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +1 -1
  15. package/src/modules/dx/header/header.ts +1 -1
  16. package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +1 -1
  17. package/src/modules/dx/headerSearch/headerSearch.ts +1 -1
  18. package/src/modules/dx/icon/icon.ts +1 -1
  19. package/src/modules/dx/iconBadge/iconBadge.ts +1 -1
  20. package/src/modules/dx/input/input.ts +1 -1
  21. package/src/modules/dx/popover/popover.ts +1 -1
  22. package/src/modules/dx/section/section.ts +1 -1
  23. package/src/modules/dx/sidebar/sidebar.ts +1 -1
  24. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +2 -2
  25. package/src/modules/dx/typeBadge/typeBadge.ts +1 -1
  26. package/src/modules/utils/highlight/highlight.ts +1 -1
  27. package/.DS_Store +0 -0
  28. package/src/.DS_Store +0 -0
  29. package/src/modules/.DS_Store +0 -0
  30. package/src/modules/dx/.DS_Store +0 -0
  31. package/src/modules/dx/banner/__tests__/banner.test.ts +0 -33
  32. package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +0 -49
  33. package/src/modules/dx/brandThemeProvider/brandThemeProvider.stories.ts +0 -321
  34. package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +0 -140
  35. package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +0 -28
  36. package/src/modules/dx/breadcrumbs/breadcrumbs.stories.ts +0 -39
  37. package/src/modules/dx/button/__tests__/button.test.ts +0 -107
  38. package/src/modules/dx/button/button.stories.ts +0 -150
  39. package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +0 -26
  40. package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +0 -12
  41. package/src/modules/dx/cardBlogPost/cardBlogPost.stories.ts +0 -164
  42. package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +0 -34
  43. package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +0 -44
  44. package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +0 -20
  45. package/src/modules/dx/cardCallout/__tests__/mockProps.ts +0 -7
  46. package/src/modules/dx/cardCallout/cardCallout.stories.ts +0 -33
  47. package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +0 -100
  48. package/src/modules/dx/cardContent/__tests__/mockProps.ts +0 -13
  49. package/src/modules/dx/cardContent/cardContent.stories.ts +0 -127
  50. package/src/modules/dx/cardDemo/cardDemo.stories.ts +0 -115
  51. package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +0 -48
  52. package/src/modules/dx/cardDocs/__tests__/mockProps.ts +0 -9
  53. package/src/modules/dx/cardDocs/cardDocs.stories.ts +0 -299
  54. package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +0 -95
  55. package/src/modules/dx/cardEvent/__tests__/mockProps.ts +0 -10
  56. package/src/modules/dx/cardEvent/cardEvent.stories.ts +0 -153
  57. package/src/modules/dx/cardExpanded/__tests__/cardExpanded.test.ts +0 -193
  58. package/src/modules/dx/cardExpanded/__tests__/mockProps.ts +0 -21
  59. package/src/modules/dx/cardExpanded/cardExpanded.stories.ts +0 -59
  60. package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +0 -431
  61. package/src/modules/dx/cardGrid/__tests__/mockProps.ts +0 -15
  62. package/src/modules/dx/cardGrid/cardGrid.stories.ts +0 -111
  63. package/src/modules/dx/cardMinimal/__tests__/cardMinimal.test.ts +0 -87
  64. package/src/modules/dx/cardMinimal/__tests__/mockProps.ts +0 -10
  65. package/src/modules/dx/cardMinimal/cardMinimal.stories.ts +0 -32
  66. package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +0 -58
  67. package/src/modules/dx/cardNews/__tests__/mockProps.ts +0 -7
  68. package/src/modules/dx/cardNews/cardNews.stories.ts +0 -115
  69. package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +0 -68
  70. package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.stories.ts +0 -31
  71. package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +0 -36
  72. package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +0 -50
  73. package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +0 -66
  74. package/src/modules/dx/cardSmall/__tests__/mockProps.ts +0 -8
  75. package/src/modules/dx/cardSmall/cardSmall.stories.ts +0 -166
  76. package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +0 -46
  77. package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +0 -18
  78. package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +0 -11
  79. package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.stories.ts +0 -122
  80. package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +0 -22
  81. package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +0 -11
  82. package/src/modules/dx/cardVideoPreview/cardVideoPreview.stories.ts +0 -147
  83. package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +0 -85
  84. package/src/modules/dx/checkbox/__tests__/mockProps.ts +0 -5
  85. package/src/modules/dx/checkbox/checkbox.stories.ts +0 -38
  86. package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +0 -80
  87. package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +0 -14
  88. package/src/modules/dx/checkboxGroup/checkboxGroup.stories.ts +0 -33
  89. package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +0 -238
  90. package/src/modules/dx/codeBlock/__tests__/mockProps.ts +0 -160
  91. package/src/modules/dx/codeBlock/codeBlock.stories.ts +0 -143
  92. package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +0 -165
  93. package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +0 -96
  94. package/src/modules/dx/dropdown/__tests__/mockOptions.ts +0 -10
  95. package/src/modules/dx/dropdown/__tests__/mockProps.ts +0 -6
  96. package/src/modules/dx/dropdown/dropdown.stories.ts +0 -89
  97. package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +0 -112
  98. package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +0 -20
  99. package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +0 -52
  100. package/src/modules/dx/emptyState/__tests__/mockProps.ts +0 -4
  101. package/src/modules/dx/emptyState/emptyState.stories.ts +0 -45
  102. package/src/modules/dx/feature/__tests__/feature.test.ts +0 -51
  103. package/src/modules/dx/feature/__tests__/mockProps.ts +0 -8
  104. package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +0 -21
  105. package/src/modules/dx/featureGrid/featureGrid.stories.ts +0 -120
  106. package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +0 -178
  107. package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +0 -73
  108. package/src/modules/dx/featuredContentHeader/featuredContentHeader.stories.ts +0 -153
  109. package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +0 -43
  110. package/src/modules/dx/featuresList/__tests__/mockProps.ts +0 -17
  111. package/src/modules/dx/featuresList/featuresList.stories.ts +0 -30
  112. package/src/modules/dx/footer/__tests__/footer.test.ts +0 -147
  113. package/src/modules/dx/footer/__tests__/mockLocales.ts +0 -7
  114. package/src/modules/dx/footer/footer.stories.ts +0 -88
  115. package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +0 -34
  116. package/src/modules/dx/footerOption/__tests__/mockProps.ts +0 -7
  117. package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +0 -25
  118. package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +0 -13
  119. package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +0 -103
  120. package/src/modules/dx/grid/__tests__/grid.test.ts +0 -32
  121. package/src/modules/dx/grid/grid.stories.ts +0 -134
  122. package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +0 -82
  123. package/src/modules/dx/groupBio/__tests__/mockProps.ts +0 -15
  124. package/src/modules/dx/groupBio/groupBio.stories.ts +0 -66
  125. package/src/modules/dx/groupText/__tests__/groupText.test.ts +0 -69
  126. package/src/modules/dx/groupText/__tests__/mockProps.ts +0 -35
  127. package/src/modules/dx/groupText/groupText.stories.ts +0 -81
  128. package/src/modules/dx/header/__tests__/header.test.ts +0 -236
  129. package/src/modules/dx/header/__tests__/mockNavArchitects.ts +0 -169
  130. package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +0 -419
  131. package/src/modules/dx/header/__tests__/mockNavs.ts +0 -115
  132. package/src/modules/dx/header/__tests__/mockProps.ts +0 -164
  133. package/src/modules/dx/header/header.stories.ts +0 -172
  134. package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +0 -123
  135. package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +0 -38
  136. package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +0 -49
  137. package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +0 -182
  138. package/src/modules/dx/headerSearch/__tests__/mockData.ts +0 -11
  139. package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -6
  140. package/src/modules/dx/helmet/__tests__/helmet.test.ts +0 -52
  141. package/src/modules/dx/helmet/helmet.stories.ts +0 -53
  142. package/src/modules/dx/hr/__tests__/hr.test.ts +0 -53
  143. package/src/modules/dx/hr/__tests__/mockProps.ts +0 -16
  144. package/src/modules/dx/hr/hr.stories.ts +0 -50
  145. package/src/modules/dx/icon/__tests__/icon.test.ts +0 -54
  146. package/src/modules/dx/icon/icon.stories.ts +0 -100
  147. package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +0 -17
  148. package/src/modules/dx/iconBadge/iconBadge.stories.ts +0 -32
  149. package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +0 -39
  150. package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +0 -6
  151. package/src/modules/dx/imageAndLabel/imageAndLabel.stories.ts +0 -48
  152. package/src/modules/dx/input/__tests__/input.test.ts +0 -357
  153. package/src/modules/dx/input/input.stories.ts +0 -102
  154. package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +0 -86
  155. package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +0 -83
  156. package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +0 -39
  157. package/src/modules/dx/interactiveImage/interactiveImage.stories.ts +0 -31
  158. package/src/modules/dx/lazy/__tests__/lazy.test.ts +0 -43
  159. package/src/modules/dx/lazy/lazy.stories.ts +0 -132
  160. package/src/modules/dx/pagination/__tests__/pagination.test.ts +0 -121
  161. package/src/modules/dx/pagination/pagination.stories.ts +0 -88
  162. package/src/modules/dx/podcastHost/__tests__/mockProps.ts +0 -8
  163. package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +0 -21
  164. package/src/modules/dx/podcastHost/podcastHost.stories.ts +0 -17
  165. package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +0 -20
  166. package/src/modules/dx/podcastPlayer/podcastPlayer.stories.ts +0 -13
  167. package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +0 -16
  168. package/src/modules/dx/podcastSubscription/podcastSubscription.stories.ts +0 -23
  169. package/src/modules/dx/popover/__tests__/mockProps.ts +0 -8
  170. package/src/modules/dx/popover/__tests__/popover.test.ts +0 -313
  171. package/src/modules/dx/popover/popover.stories.ts +0 -82
  172. package/src/modules/dx/radioGroup/__tests__/mockProps.ts +0 -12
  173. package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +0 -42
  174. package/src/modules/dx/radioGroup/radioGroup.stories.ts +0 -25
  175. package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +0 -55
  176. package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +0 -52
  177. package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +0 -83
  178. package/src/modules/dx/searchResults/searchResults.stories.ts +0 -36
  179. package/src/modules/dx/section/__tests__/section.test.ts +0 -17
  180. package/src/modules/dx/section/section.stories.ts +0 -381
  181. package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +0 -66
  182. package/src/modules/dx/sectionSignup/sectionSignup.stories.ts +0 -49
  183. package/src/modules/dx/select/select.stories.ts +0 -59
  184. package/src/modules/dx/sidebar/__tests__/mockProps.ts +0 -181
  185. package/src/modules/dx/sidebar/__tests__/mockSearchChangeEmptyEvent.ts +0 -6
  186. package/src/modules/dx/sidebar/__tests__/mockSearchChangeEvent.ts +0 -527
  187. package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -568
  188. package/src/modules/dx/sidebar/sidebar.stories.ts +0 -188
  189. package/src/modules/dx/sidebarOld/__tests__/mockProps.ts +0 -178
  190. package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +0 -570
  191. package/src/modules/dx/sidebarOld/sidebarOld.stories.ts +0 -139
  192. package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +0 -1686
  193. package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +0 -175
  194. package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +0 -96
  195. package/src/modules/dx/slackCta/__tests__/slackCta.test.ts +0 -48
  196. package/src/modules/dx/slackCta/slackCta.stories.ts +0 -25
  197. package/src/modules/dx/socials/__tests__/socials.test.ts +0 -114
  198. package/src/modules/dx/socials/socials.stories.ts +0 -24
  199. package/src/modules/dx/spinner/__tests__/spinner.test.ts +0 -37
  200. package/src/modules/dx/spinner/spinner.stories.ts +0 -69
  201. package/src/modules/dx/tab/__tests__/tab.test.ts +0 -129
  202. package/src/modules/dx/tab/tab.stories.ts +0 -57
  203. package/src/modules/dx/toc/__tests__/mockProps.ts +0 -28
  204. package/src/modules/dx/toc/__tests__/toc.test.ts +0 -109
  205. package/src/modules/dx/toc/toc.stories.ts +0 -26
  206. package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +0 -22
  207. package/src/modules/dx/tooltip/tooltip.stories.ts +0 -46
  208. package/src/modules/dx/topics/__tests__/mockProps.ts +0 -3
  209. package/src/modules/dx/topics/__tests__/topics.test.ts +0 -31
  210. package/src/modules/dx/tree/__tests__/mockProps.ts +0 -215
  211. package/src/modules/dx/tree/__tests__/tree.test.ts +0 -346
  212. package/src/modules/dx/tree/__tests__/treeHandler.test.ts +0 -194
  213. package/src/modules/dx/tree/tree.stories.ts +0 -65
  214. package/src/modules/dx/treeItem/__tests__/mockProps.ts +0 -46
  215. package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +0 -377
  216. package/src/modules/dx/treeTile/__tests__/mockProps.ts +0 -16
  217. package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +0 -168
  218. package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +0 -77
  219. package/src/modules/dx/typeBadge/typeBadge.stories.ts +0 -114
  220. package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +0 -11
  221. package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +0 -72
  222. package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.stories.ts +0 -19
  223. package/src/modules/utils/highlight/__tests__/highlight.test.ts +0 -108
  224. package/src/modules/utils/highlight/__tests__/mockProps.ts +0 -45
  225. package/src/modules/utils/recentSearches/__tests__/recentSearches.test.ts +0 -83
  226. package/src/modules/utils/wordpress/__tests__/wordpress.test.ts +0 -15
@@ -1,178 +0,0 @@
1
- import FeaturedContentHeader from "dx/featuredContentHeader";
2
- import ImageAndLabel from "dx/imageAndLabel";
3
- import { createRenderComponent } from "utils-internal/tests";
4
- import mockProps, { blogPodcastMock } from "./mockProps";
5
-
6
- const TAG = "dx-featured-content-header";
7
- const render = createRenderComponent(TAG, FeaturedContentHeader);
8
-
9
- const testHeadingAttributes = (
10
- el: HTMLElement,
11
- role: string | null,
12
- ariaLevel: string | null
13
- ): void => {
14
- const elRole = el.getAttribute("role");
15
- const elAriaLevel = el.getAttribute("aria-level");
16
- expect(elRole).toEqual(role);
17
- expect(elAriaLevel).toEqual(ariaLevel);
18
- };
19
-
20
- describe(TAG, () => {
21
- it("renders", () => {
22
- const element = render(mockProps);
23
- const renderedLabel: HTMLElement =
24
- element.shadowRoot.querySelector(".label");
25
- const renderedTitle: HTMLElement =
26
- element.shadowRoot.querySelector(".title");
27
- const renderedBody: HTMLElement =
28
- element.shadowRoot.querySelector("span");
29
-
30
- expect(renderedLabel).not.toBeNull();
31
- expect(renderedLabel.textContent).toEqual(mockProps.label);
32
- expect(renderedTitle).not.toBeNull();
33
- expect(renderedBody).not.toBeNull();
34
- expect(renderedBody.textContent).toEqual(mockProps.body);
35
- return expect(element).toBeAccessible();
36
- });
37
-
38
- it("renders title as h1 and label without aria role by default", () => {
39
- const element = render(mockProps);
40
-
41
- const title: HTMLElement = element.shadowRoot.querySelector(".title");
42
- testHeadingAttributes(title, "heading", "1");
43
-
44
- const label: HTMLElement = element.shadowRoot.querySelector(".label");
45
- testHeadingAttributes(label, null, null);
46
-
47
- return expect(element).toBeAccessible();
48
- });
49
-
50
- it("renders title as h2 and label as h1 when labelAsPrimaryHeading is true", () => {
51
- const element = render({ ...mockProps, labelAsPrimaryHeading: true });
52
-
53
- const title: HTMLElement = element.shadowRoot.querySelector(".title");
54
- testHeadingAttributes(title, "heading", "2");
55
-
56
- const label: HTMLElement = element.shadowRoot.querySelector(".label");
57
- testHeadingAttributes(label, "heading", "1");
58
-
59
- return expect(element).toBeAccessible();
60
- });
61
-
62
- it("renders no links when not given an href", () => {
63
- const element = render({ ...mockProps, href: null, target: null });
64
- const link: HTMLElement = element.shadowRoot.querySelector("a");
65
-
66
- expect(link).toBeNull();
67
- return expect(element).toBeAccessible();
68
- });
69
-
70
- it("renders no img when not given an imgSrc", () => {
71
- const element = render({ ...mockProps, imgSrc: null });
72
- const img: HTMLElement = element.shadowRoot.querySelector("img");
73
-
74
- expect(img).toBeNull();
75
- return expect(element).toBeAccessible();
76
- });
77
-
78
- it("renders authors", () => {
79
- const element = render(mockProps);
80
-
81
- const optionsListComponent: Array<HTMLElement> =
82
- element.shadowRoot.querySelectorAll("dx-image-and-label");
83
- expect(optionsListComponent).toHaveLength(mockProps.authors.length);
84
-
85
- return expect(element).toBeAccessible();
86
- });
87
-
88
- it("specifies authors image", () => {
89
- const element = render(blogPodcastMock);
90
-
91
- const optionsListComponent: Array<ImageAndLabel> =
92
- element.shadowRoot.querySelectorAll("dx-image-and-label");
93
- expect(optionsListComponent).toHaveLength(
94
- blogPodcastMock.authors.length
95
- );
96
-
97
- const [firstAuthor] = optionsListComponent;
98
- expect(firstAuthor.imgSrc).toBe(
99
- blogPodcastMock.authors[0].avatar_urls["24"]
100
- );
101
-
102
- return expect(element).toBeAccessible();
103
- });
104
-
105
- it("fallbacks in imgSrc if avatar_urls is not defined", () => {
106
- const element = render(mockProps);
107
-
108
- const optionsListComponent: Array<ImageAndLabel> =
109
- element.shadowRoot.querySelectorAll("dx-image-and-label");
110
- expect(optionsListComponent).toHaveLength(
111
- blogPodcastMock.authors.length
112
- );
113
-
114
- const [firstAuthor] = optionsListComponent;
115
- expect(firstAuthor.imgSrc).toBe(mockProps.authors[0].imgSrc);
116
-
117
- return expect(element).toBeAccessible();
118
- });
119
-
120
- it("filters authors with no names", () => {
121
- const authors = [
122
- {
123
- foo: "bar"
124
- },
125
- {
126
- foo: "bar"
127
- }
128
- ];
129
-
130
- const element = render({ ...mockProps, authors });
131
-
132
- const optionsListComponent: Array<ImageAndLabel> =
133
- element.shadowRoot.querySelectorAll("dx-image-and-label");
134
-
135
- expect(optionsListComponent).toHaveLength(0);
136
-
137
- return expect(element).toBeAccessible();
138
- });
139
-
140
- it("set proper class names", () => {
141
- const element = render({
142
- ...mockProps,
143
- dark: "true",
144
- imgPlacement: "below",
145
- imgSrc: "www.test.com",
146
- authors: undefined,
147
- href: "www.test.com",
148
- target: "_test",
149
- title: "test"
150
- });
151
-
152
- const renderedContainer: HTMLElement =
153
- element.shadowRoot.querySelector(".container");
154
- const renderedLabel: HTMLElement =
155
- element.shadowRoot.querySelector(".label");
156
- const renderedTitleLink: HTMLElement =
157
- element.shadowRoot.querySelector(".title a");
158
- const renderedBody: HTMLElement =
159
- element.shadowRoot.querySelector("span");
160
- const renderedImage: HTMLElement =
161
- element.shadowRoot.querySelector("img");
162
- const renderedImageLabel: HTMLElement =
163
- element.shadowRoot.querySelector("dx-image-and-label");
164
-
165
- expect(renderedContainer.className).toBe(
166
- "container img-placement_below variant_dark"
167
- );
168
- expect(renderedLabel.className).toBe("label dx-text-heading-4");
169
- expect(renderedTitleLink.getAttribute("href")).toEqual("www.test.com");
170
- expect(renderedTitleLink.getAttribute("target")).toEqual("_test");
171
- expect(renderedTitleLink.textContent).toEqual("test");
172
- expect(renderedBody.className).toBe("body dx-text-body-1");
173
- expect(renderedImage).not.toBeNull();
174
- expect(renderedImageLabel).toBeNull();
175
-
176
- return expect(element).toBeAccessible();
177
- });
178
- });
@@ -1,73 +0,0 @@
1
- export const blogPodcastMock = {
2
- label: "Developers Blog",
3
- title: "Custom Notifications for your Mobile SDK Apps",
4
- href: "https://www.google.com",
5
- target: "_blank",
6
- body:
7
- "Is it time to expand Salesforce within your company? Then it’s also time to develop a performance testing method so you can be confident that your solution can scale to meet your user needs without unwanted side effects. ",
8
- authors: [
9
- {
10
- avatar_urls: {
11
- "24": "https://placekitten.com/24/24",
12
- "48": "https://placekitten.com/48/48"
13
- },
14
- description: "",
15
- id: 1,
16
- link: "https://developer.salesforce.com/user/1",
17
- name: "First Author Name",
18
- slug: "first-author-name"
19
- },
20
- {
21
- avatar_urls: {
22
- "24": "https://placekitten.com/24/24",
23
- "48": "https://placekitten.com/48/48"
24
- },
25
- description: "",
26
- id: 2,
27
- link: "https://developer.salesforce.com/user/2",
28
- name: "Second Author Name",
29
- slug: "second-author-name"
30
- },
31
- {
32
- avatar_urls: {
33
- "24": "https://placekitten.com/24/24",
34
- "48": "https://placekitten.com/48/48"
35
- },
36
- description: "",
37
- id: 3,
38
- link: "https://developer.salesforce.com/user/3",
39
- name: "Third Author Name",
40
- slug: "third-author-name"
41
- }
42
- ]
43
- };
44
-
45
- export default {
46
- ...blogPodcastMock,
47
- authors: [
48
- {
49
- imgSrc: "https://placekitten.com/24/24",
50
- description: "",
51
- id: 1,
52
- link: "https://developer.salesforce.com/user/1",
53
- name: "First Author Name",
54
- slug: "first-author-name"
55
- },
56
- {
57
- imgSrc: "https://placekitten.com/24/24",
58
- description: "",
59
- id: 2,
60
- link: "https://developer.salesforce.com/user/2",
61
- name: "Second Author Name",
62
- slug: "second-author-name"
63
- },
64
- {
65
- imgSrc: "https://placekitten.com/24/24",
66
- description: "",
67
- id: 3,
68
- link: "https://developer.salesforce.com/user/3",
69
- name: "Third Author Name",
70
- slug: "third-author-name"
71
- }
72
- ]
73
- };
@@ -1,153 +0,0 @@
1
- import { html } from "lit-html";
2
- import mockProps from "./__tests__/mockProps";
3
-
4
- const BACKGROUND_IMAGE_OPTIONS = ["trees", "codey", "blog"];
5
-
6
- export default {
7
- title: "dx/dx-featured-content-header ",
8
- component: "dx-featured-content-header "
9
- };
10
-
11
- const createStylesLightVariant = () => html`
12
- <style>
13
- dx-featured-content-header {
14
- --dx-c-featured-content-header-background-color: rgb(58, 73, 218);
15
- }
16
- </style>
17
- `;
18
-
19
- const createBaseStyles = () => html`
20
- <style>
21
- body {
22
- padding: 0 !important;
23
- }
24
- dx-podcast-player {
25
- display: block;
26
- width: 300px;
27
- }
28
- </style>
29
- `;
30
-
31
- const authors = JSON.stringify(mockProps.authors);
32
-
33
- export const PodcastEpisode = () => html` ${createBaseStyles()}
34
- <dx-featured-content-header
35
- label="Developers Podcast"
36
- title="${mockProps.title}"
37
- href="${mockProps.href}"
38
- target="${mockProps.target}"
39
- body="${mockProps.body}"
40
- >
41
- <dx-podcast-player
42
- src="https://www3.assets.heroku.com/podcasts/codeish/Codeish_Episode_108_Wicked_CoolKit.mp3"
43
- >
44
- </dx-podcast-player>
45
- </dx-featured-content-header>`;
46
-
47
- export const BlogPost = () => html` ${createBaseStyles()}
48
- <dx-featured-content-header
49
- label="${mockProps.label}"
50
- title="${mockProps.title}"
51
- href="${mockProps.href}"
52
- target="${mockProps.target}"
53
- body="${mockProps.body}"
54
- authors="${authors}"
55
- img-src="https://i.imgur.com/FUsyxR5.jpg"
56
- img-alt="test alt"
57
- img-placement="below"
58
- >
59
- <dx-podcast-player
60
- src="https://www3.assets.heroku.com/podcasts/codeish/Codeish_Episode_108_Wicked_CoolKit.mp3"
61
- >
62
- </dx-podcast-player>
63
- </dx-featured-content-header>`;
64
-
65
- export const LightVariation = () => html` ${createBaseStyles()}
66
- ${createStylesLightVariant()}
67
- <dx-featured-content-header
68
- label="${mockProps.label}"
69
- title="${mockProps.title}"
70
- href="${mockProps.href}"
71
- target="${mockProps.target}"
72
- body="${mockProps.body}"
73
- authors="${authors}"
74
- img-src="https://i.imgur.com/FUsyxR5.jpg"
75
- img-alt="test alt"
76
- dark="true"
77
- >
78
- </dx-featured-content-header>`;
79
-
80
- export const LightVariationNoLink = () => html` ${createBaseStyles()}
81
- ${createStylesLightVariant()}
82
- <dx-featured-content-header
83
- label="${mockProps.label}"
84
- title="${mockProps.title}"
85
- body="${mockProps.body}"
86
- authors="${authors}"
87
- img-src="https://i.imgur.com/FUsyxR5.jpg"
88
- img-alt="test alt"
89
- dark="true"
90
- >
91
- </dx-featured-content-header>`;
92
-
93
- export const MainContentWidth = () => html` ${createBaseStyles()}
94
- ${createStylesLightVariant()}
95
- <style>
96
- dx-featured-content-header {
97
- --dx-c-featured-content-main-content-max-width: 600px;
98
- }
99
- </style>
100
- <dx-featured-content-header
101
- title="${mockProps.title}"
102
- body="${mockProps.body}"
103
- authors="${authors}"
104
- dark="true"
105
- >
106
- </dx-featured-content-header>`;
107
-
108
- export const BackgroundImage = ({
109
- backgroundImage
110
- }: {
111
- backgroundImage: string;
112
- }) => html` ${createBaseStyles()} ${createStylesLightVariant()}
113
- <style>
114
- dx-featured-content-header {
115
- --dx-c-featured-content-main-content-max-width: 600px;
116
- }
117
- </style>
118
- <dx-featured-content-header
119
- title="${mockProps.title}"
120
- body="${mockProps.body}"
121
- authors="${authors}"
122
- dark="true"
123
- background-img="${backgroundImage}"
124
- >
125
- </dx-featured-content-header>`;
126
-
127
- BackgroundImage.args = {
128
- backgroundImage: "codey"
129
- };
130
-
131
- BackgroundImage.argTypes = {
132
- backgroundImage: {
133
- control: {
134
- type: "select",
135
- options: BACKGROUND_IMAGE_OPTIONS
136
- }
137
- }
138
- };
139
-
140
- export const CodeSamples = () => html`
141
-
142
- <style>
143
- dx-featured-content-header {
144
- --dx-c-featured-content-main-content-max-width: 600px;
145
- }
146
- </style>
147
- <dx-featured-content-header
148
- class="documentation_header"
149
- title="Code Samples"
150
- body="all the description here"
151
- dark="true"
152
- background-img="moon"
153
- ></dx-featured-content-header>`;
@@ -1,43 +0,0 @@
1
- import FeaturesList from "dx/featuresList";
2
- import { createRenderComponent } from "utils-internal/tests";
3
- import mockProps from "./mockProps";
4
-
5
- const TAG = "dx-features-list";
6
- const render = createRenderComponent(TAG, FeaturesList);
7
-
8
- describe(TAG, () => {
9
- it("renders", () => {
10
- const element = render(mockProps);
11
-
12
- const container: HTMLElement =
13
- element.shadowRoot.querySelector(".container");
14
- const renderedTitle: HTMLElement =
15
- element.shadowRoot.querySelector("h2");
16
-
17
- expect(renderedTitle).not.toBeNull();
18
- expect(container).not.toBeNull();
19
-
20
- expect(renderedTitle.textContent).toEqual(mockProps.title);
21
-
22
- const optionListComponent: Array<HTMLElement> =
23
- element.shadowRoot.querySelectorAll(".option");
24
- expect(optionListComponent).toHaveLength(mockProps.options.length);
25
-
26
- return expect(element).toBeAccessible();
27
- });
28
- it("test list recieved as string ", () => {
29
- const optionsListParameter = [
30
- { title: "Introduction", id: "A", description: "test description" }
31
- ];
32
- const element = render({
33
- ...mockProps,
34
- options: JSON.stringify(optionsListParameter)
35
- });
36
-
37
- const optionListComponent: Array<HTMLElement> =
38
- element.shadowRoot.querySelectorAll(".option");
39
- expect(optionListComponent).toHaveLength(element.options.length);
40
-
41
- return expect(element).toBeAccessible();
42
- });
43
- });
@@ -1,17 +0,0 @@
1
- export default {
2
- title: "Key features",
3
- options: [
4
- {
5
- title: "Einstein Image Classification",
6
- id: "A",
7
- description:
8
- "Train deep learning models to recognize and classify images at scale"
9
- },
10
- {
11
- title: "Einstein Object Detection",
12
- id: "B",
13
- description:
14
- "Train models to recognize and count multiple distinct objects within an image, providing granular details like the size and location of each object."
15
- }
16
- ]
17
- };
@@ -1,30 +0,0 @@
1
- import { html } from "lit-html";
2
- import mockProps from "./__tests__/mockProps";
3
-
4
- export default {
5
- title: "dx/dx-features-list",
6
- component: "dx-features-list"
7
- };
8
-
9
- const options = JSON.stringify(mockProps.options);
10
-
11
- const createStyles = () => html`
12
- <style>
13
- #root {
14
- max-width: 417px;
15
- }
16
- </style>
17
- `;
18
-
19
- export const Base = () => html`
20
- ${createStyles()}
21
- <dx-features-list
22
- title="Key features"
23
- options="${options}"
24
- ></dx-features-list>
25
- `;
26
-
27
- export const NoTitle = () => html`
28
- ${createStyles()}
29
- <dx-features-list options="${options}"></dx-features-list>
30
- `;
@@ -1,147 +0,0 @@
1
- import Footer from "dx/footer";
2
- import { createRenderComponent } from "utils-internal/tests";
3
- import { socialLinks, termsLinks, generalLinksRaw } from "../links";
4
- import mockLocales from "./mockLocales";
5
-
6
- const generalLength = generalLinksRaw.reduce(
7
- // @ts-ignore
8
- (acc, links) => [...acc, ...links.options],
9
- []
10
- // @ts-ignore
11
- ).length;
12
-
13
- const TAG = "dx-footer";
14
- const render = createRenderComponent(TAG, Footer);
15
-
16
- describe(TAG, () => {
17
- it("renders a footer, doesn't render locales dropdown when no locales provideded, doesn't render large newsletter section by default", () => {
18
- const element = render();
19
-
20
- const footerEl = element.shadowRoot.querySelector("footer");
21
- expect(footerEl).not.toBeNull();
22
-
23
- const dropdown = element.shadowRoot.querySelector(".locales");
24
- expect(dropdown).toBeNull();
25
-
26
- const newsletterSection = element.shadowRoot.querySelector(
27
- ".content-container_top"
28
- );
29
- const newsletterSectionLarge = element.shadowRoot.querySelector(
30
- ".content-container_top_large"
31
- );
32
- expect(newsletterSection).toBeTruthy();
33
- expect(newsletterSectionLarge).toBeNull();
34
-
35
- return expect(element).toBeAccessible();
36
- });
37
-
38
- it("renders large signup when specified", () => {
39
- const element = render({ variant: "large-signup" });
40
-
41
- const newsletterSection = element.shadowRoot.querySelector(
42
- ".content-container_top"
43
- );
44
- const newsletterSectionLarge = element.shadowRoot.querySelector(
45
- ".content-container_top_large"
46
- );
47
- expect(newsletterSection).toBeNull();
48
- expect(newsletterSectionLarge).toBeTruthy();
49
-
50
- return expect(element).toBeAccessible();
51
- });
52
-
53
- it("renders no signup when specified", () => {
54
- const element = render({ variant: "no-signup" });
55
-
56
- const newsletterSection = element.shadowRoot.querySelector(
57
- ".content-container_top"
58
- );
59
- const newsletterSectionLarge = element.shadowRoot.querySelector(
60
- ".content-container_top_large"
61
- );
62
- expect(newsletterSection).toBeNull();
63
- expect(newsletterSectionLarge).toBeNull();
64
-
65
- return expect(element).toBeAccessible();
66
- });
67
-
68
- it("renders the terms only when specified", () => {
69
- const element = render({ variant: "terms-only" });
70
-
71
- const linksSection = element.shadowRoot.querySelector(
72
- ".content-container_middle"
73
- );
74
- expect(linksSection).toBeNull();
75
-
76
- return expect(element).toBeAccessible();
77
- });
78
-
79
- it("renders all links", () => {
80
- const element = render();
81
-
82
- const socials = element.shadowRoot.querySelectorAll(".socials a");
83
- expect(socials.length).toEqual(socialLinks.length);
84
-
85
- const terms = element.shadowRoot.querySelectorAll(".terms a");
86
- expect(terms.length).toEqual(termsLinks.length + 2); // +2 accounts for all rights reserved link and the one trust link
87
-
88
- const general = element.shadowRoot.querySelectorAll(
89
- ".general dx-footer-option"
90
- );
91
- expect(general.length).toEqual(generalLength);
92
-
93
- return expect(element).toBeAccessible();
94
- });
95
-
96
- it("displays locale dropdown and fires callbacks for localechange with correct payload", () => {
97
- const mockLocalChange = jest.fn();
98
- const nextLocale = mockLocales[1].id;
99
- const element = render({
100
- locale: "en",
101
- locales: mockLocales
102
- });
103
-
104
- element.addEventListener("localechange", mockLocalChange);
105
-
106
- const dropdown = element.shadowRoot.querySelector(".locales");
107
-
108
- dropdown.dispatchEvent(
109
- new CustomEvent("change", { detail: nextLocale })
110
- );
111
-
112
- expect(mockLocalChange.mock.calls[0][0].detail).toEqual(nextLocale);
113
- expect(mockLocalChange).toHaveBeenCalledTimes(1);
114
-
115
- return expect(element).toBeAccessible();
116
- });
117
-
118
- it("doesn't blow up when given locales with no locale specified", () => {
119
- const element = render({
120
- locales: mockLocales
121
- });
122
-
123
- return expect(element).toBeAccessible();
124
- });
125
-
126
- it("renders newsletter section when specified, reroutes to correct href on email submission", () => {
127
- const email = "test@test.io";
128
- const emailHref = `/newsletter?subscriberEmail=${email}`;
129
- const mockAssign = jest.fn();
130
-
131
- //@ts-ignore
132
- delete window.location;
133
- //@ts-ignore
134
- window.location = {
135
- assign: mockAssign
136
- };
137
-
138
- const element = render({ showNewsletterSignup: true });
139
-
140
- const emailInput = element.shadowRoot.querySelector("dx-input");
141
-
142
- emailInput.dispatchEvent(new CustomEvent("submit", { detail: email }));
143
-
144
- expect(mockAssign).toHaveBeenCalledWith(emailHref);
145
- expect(mockAssign).toHaveBeenCalledTimes(1);
146
- });
147
- });
@@ -1,7 +0,0 @@
1
- export default [
2
- { label: "Afrikaans", id: "af" },
3
- { label: "Belarusian", id: "be" },
4
- { label: "Chinese", id: "zh-cn" },
5
- { label: "English", id: "en" },
6
- { label: "Russian", id: "ru" }
7
- ];