@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,114 +0,0 @@
1
- import { html } from "lit-html";
2
- import { TypeBadgeColor, TypeBadgeSize, BadgeType } from "typings/custom";
3
-
4
- const BADGE_COLOR_OPTIONS: Array<TypeBadgeColor> = [
5
- "default",
6
- "hot-orange",
7
- "orange",
8
- "yellow",
9
- "green",
10
- "teal",
11
- "cloud-blue",
12
- "blue",
13
- "indigo",
14
- "purple",
15
- "violet",
16
- "pink",
17
- "red",
18
- "analytics",
19
- "employees",
20
- "marketing",
21
- "partners",
22
- "commerce",
23
- "sales",
24
- "success",
25
- "integration",
26
- "platform",
27
- "industries",
28
- "learning",
29
- "service"
30
- ];
31
- const SIZE_OPTIONS: Array<TypeBadgeSize> = ["default", "small"];
32
- const BADGE_TYPE_OPTIONS: Array<BadgeType> = ["metadata", "content-type"];
33
-
34
- export default {
35
- title: "dx/dx-type-badge",
36
- component: "dx-type-badge",
37
- argTypes: {
38
- color: {
39
- control: {
40
- type: "select"
41
- },
42
- options: BADGE_COLOR_OPTIONS
43
- },
44
- type: {
45
- control: {
46
- type: "select"
47
- },
48
- options: BADGE_TYPE_OPTIONS
49
- },
50
- size: {
51
- control: {
52
- type: "select"
53
- },
54
- options: SIZE_OPTIONS
55
- },
56
- value: {
57
- control: {
58
- type: "text"
59
- }
60
- }
61
- }
62
- };
63
-
64
- export const Base = (args: any) => html`
65
- <dx-type-badge
66
- value="${args.value}"
67
- color="${args.color}"
68
- size="${args.size}"
69
- type="${args.type}"
70
- ></dx-type-badge>
71
- `;
72
- Base.args = {
73
- color: BADGE_COLOR_OPTIONS[0],
74
- type: BADGE_TYPE_OPTIONS[0],
75
- size: SIZE_OPTIONS[0],
76
- value: "Developer Experience"
77
- };
78
-
79
- export const CSSHooked = () => html`
80
- <style>
81
- .hooks {
82
- --dx-c-type-badge-color: var(--dx-g-green-vibrant-40);
83
- --dx-c-type-badge-background: var(--dx-g-green-vibrant-90);
84
- --dx-c-type-badge-border-radius: var(--dx-g-spacing-xl);
85
- --dx-c-type-badge-height: var(--dx-g-spacing-xl);
86
- }
87
- .hookinfo {
88
- color: gray;
89
- font-size: 12px;
90
- }
91
- </style>
92
-
93
- <p class="hookinfo">
94
- <b>--dx-c-type-badge-color:</b> <i>var(--dx-g-green-vibrant-40);</i>
95
- </p>
96
- <p class="hookinfo">
97
- <b>--dx-c-type-badge-background:</b>
98
- <i>var(--dx-g-green-vibrant-90);</i>
99
- </p>
100
- <p class="hookinfo">
101
- <b>--dx-c-type-badge-border-radius:</b>
102
- <i>var(--dx-g-spacing-xl);</i>
103
- </p>
104
- <p class="hookinfo">
105
- <b>--dx-c-type-badge-height:</b>
106
- <i>var(--dx-g-spacing-xl);</i>
107
- </p>
108
- <br />
109
-
110
- <dx-type-badge
111
- class="hooks"
112
- value="Hey I am a very loooong text"
113
- ></dx-type-badge>
114
- `;
@@ -1,11 +0,0 @@
1
- export const badges = [
2
- "Developer Experience",
3
- "Search Optimization",
4
- "Analytics",
5
- "Testing",
6
- "Traffic Monitoring"
7
- ];
8
-
9
- export default {
10
- badges: JSON.stringify(badges)
11
- };
@@ -1,72 +0,0 @@
1
- import TypeBadge from "dx/typeBadge";
2
- import TypeBadgeGroup from "dx/typeBadgeGroup";
3
- import { TypeBadgeSize } from "typings/custom";
4
- import { createRenderComponent } from "utils-internal/tests";
5
- import mockProps, { badges } from "./mockProps";
6
-
7
- const TAG = "dx-type-badge-group";
8
- const render = createRenderComponent(TAG, TypeBadgeGroup);
9
-
10
- describe(TAG, () => {
11
- it("renders correct number of badges", () => {
12
- const expectedSize: TypeBadgeSize = "medium";
13
- const element = render(mockProps);
14
-
15
- const els: Array<TypeBadge> =
16
- element.shadowRoot.querySelectorAll("dx-type-badge");
17
- expect(els).toHaveLength(badges.length);
18
- els.forEach((el, index) => {
19
- expect(el.value).toBe(badges[index]);
20
- expect(el.size).toBe(expectedSize);
21
- });
22
-
23
- return expect(element).toBeAccessible();
24
- });
25
-
26
- it("can render a comma delimited string", () => {
27
- const expectedSize: TypeBadgeSize = "small";
28
- const element = render({
29
- badges: "test1,test2,test3",
30
- size: expectedSize
31
- });
32
-
33
- const els: Array<TypeBadge> =
34
- element.shadowRoot.querySelectorAll("dx-type-badge");
35
- expect(els).toHaveLength(3);
36
- els.forEach((el) => expect(el.size).toBe(expectedSize));
37
- expect(els[0].value).toBe("test1");
38
- expect(els[1].value).toBe("test2");
39
- expect(els[2].value).toBe("test3");
40
-
41
- return expect(element).toBeAccessible();
42
- });
43
-
44
- it("can render single string value", () => {
45
- const expectedBadge = "testsinglebadge";
46
- const element = render({ badges: expectedBadge });
47
-
48
- const els: Array<TypeBadge> =
49
- element.shadowRoot.querySelectorAll("dx-type-badge");
50
- expect(els).toHaveLength(1);
51
- expect(els[0].value).toBe(expectedBadge);
52
-
53
- return expect(element).toBeAccessible();
54
- });
55
-
56
- it("can render a regular array of string", () => {
57
- const element = render({ badges });
58
-
59
- const els: Array<TypeBadge> =
60
- element.shadowRoot.querySelectorAll("dx-type-badge");
61
- expect(els).toHaveLength(badges.length);
62
- els.forEach((el, index) => expect(el.value).toBe(badges[index]));
63
-
64
- return expect(element).toBeAccessible();
65
- });
66
-
67
- it("throws an error if badges value is not compatible", () => {
68
- expect(() => render({ badges: { test: "badges" } })).toThrow(
69
- /Key must be a string or number/
70
- );
71
- });
72
- });
@@ -1,19 +0,0 @@
1
- import { html } from "lit-html";
2
-
3
- export default {
4
- title: "dx/dx-type-badge-group",
5
- component: "dx-type-badge-group"
6
- };
7
-
8
- export const Base = () => html`
9
- <dx-type-badge-group
10
- badges="Developer Experience, Search Optimization, Analytics"
11
- ></dx-type-badge-group>
12
- `;
13
-
14
- export const Small = () => html`
15
- <dx-type-badge-group
16
- badges='["Testing", "Traffic Monitoring"]'
17
- size="small"
18
- ></dx-type-badge-group>
19
- `;
@@ -1,108 +0,0 @@
1
- import { createElement } from "lwc";
2
- import CodeBlock from "dx/codeBlock";
3
- import { highlightTerms } from "utils/highlight";
4
- import { mockContent, allowedTags } from "./mockProps";
5
-
6
- const container = document.createElement("div");
7
-
8
- describe("highlight utility", () => {
9
- afterEach(() => (container.innerHTML = ""));
10
-
11
- it("highlights text that matches search criteria", () => {
12
- container.innerHTML = mockContent;
13
- highlightTerms(
14
- container.querySelectorAll(allowedTags.join(",")),
15
- "apex"
16
- );
17
- expect(container.querySelectorAll("mark")).toHaveLength(14);
18
- });
19
-
20
- it("doesn't highlight elements that contains dx/docs components", () => {
21
- const searchTerm = "customreport";
22
- const codeBlock = createElement("dx-code-block", { is: CodeBlock });
23
- Object.assign(codeBlock, {
24
- codeBlock: searchTerm,
25
- language: "text"
26
- });
27
- container.appendChild(document.createElement("p"));
28
- container.firstElementChild?.appendChild(codeBlock);
29
- highlightTerms(
30
- container.querySelectorAll(allowedTags.join(",")),
31
- searchTerm
32
- );
33
- expect(container.querySelectorAll("mark")).toHaveLength(0);
34
- expect(codeBlock.shadowRoot.innerHTML).toMatch(searchTerm); // sanity check
35
- });
36
-
37
- it("doesn't highlight terms separated by html tags", () => {
38
- container.innerHTML = "<p>loadData<span>within</span></p>";
39
- highlightTerms(
40
- container.querySelectorAll(allowedTags.join(",")),
41
- "loadDatawithin"
42
- );
43
- expect(container.querySelectorAll("mark")).toHaveLength(0);
44
- });
45
-
46
- it("escapes regex especial characters", () => {
47
- container.innerHTML = mockContent;
48
- highlightTerms(
49
- container.querySelectorAll(allowedTags.join(",")),
50
- "apex.+"
51
- );
52
- expect(container.querySelectorAll("mark")).toHaveLength(0);
53
- });
54
-
55
- it("cleans previous search result before searching for a new term", () => {
56
- const firstSearch = "apex";
57
- const secondSearch = "salesforce";
58
-
59
- container.innerHTML = mockContent;
60
-
61
- highlightTerms(
62
- container.querySelectorAll(allowedTags.join(",")),
63
- firstSearch
64
- );
65
- const firstMarks = container.querySelectorAll("mark");
66
- expect(firstMarks).toHaveLength(14);
67
- firstMarks.forEach(({ textContent }) =>
68
- expect(textContent?.toLowerCase()).toBe(firstSearch)
69
- );
70
-
71
- highlightTerms(
72
- container.querySelectorAll(allowedTags.join(",")),
73
- secondSearch
74
- );
75
- const secondMarks = container.querySelectorAll("mark");
76
- expect(secondMarks).toHaveLength(4);
77
- secondMarks.forEach(({ textContent }) =>
78
- expect(textContent?.toLowerCase()).toBe(secondSearch)
79
- );
80
- });
81
-
82
- it("cleans all marks if the search term is empty string", () => {
83
- const firstSearch = "apex";
84
- const secondSearch = "";
85
-
86
- container.innerHTML = mockContent;
87
-
88
- highlightTerms(
89
- container.querySelectorAll(allowedTags.join(",")),
90
- firstSearch
91
- );
92
- const firstMarks = container.querySelectorAll("mark");
93
- expect(firstMarks).toHaveLength(14);
94
- firstMarks.forEach(({ textContent }) =>
95
- expect(textContent?.toLowerCase()).toBe(firstSearch)
96
- );
97
-
98
- highlightTerms(
99
- container.querySelectorAll(allowedTags.join(",")),
100
- secondSearch
101
- );
102
- const secondMarks = container.querySelectorAll("mark");
103
- expect(secondMarks).toHaveLength(0);
104
- secondMarks.forEach(({ textContent }) =>
105
- expect(textContent?.toLowerCase()).toBe(secondSearch)
106
- );
107
- });
108
- });
@@ -1,45 +0,0 @@
1
- export const mockContent = `<div><a name='apex_dev_guide'><!-- --></a><h1 class='helpHead1'>Apex Developer Guide</h1><div class='shortdesc'>Salesforce has changed the way organizations do business by moving enterprise
2
- applications that were traditionally client-server-based into the Lightning Platform, an
3
- on-demand, multitenant Web environment. This environment enables you to run and customize
4
- applications, such as Salesforce Automation and Service &amp; Support, and build new custom
5
- applications based on particular business needs. </div><div id='sfdc:seealso' class='related-links'>
6
- <ul class='ullinks'>
7
- <li class='link ulchildlink'>
8
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_intro_get_started.htm'>Getting Started with Apex</a></strong><br>
9
- Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Lightning Platform server, in conjunction with calls to the API.</li>
10
- <li class='link ulchildlink'>
11
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_writing.htm'>Writing Apex</a></strong><br>
12
- Apex is like Java for Salesforce. It enables you to add and interact with data in the Lightning Platform persistence layer. It uses classes, data types, variables, and if-else statements. You can make it execute based on a condition, or have a block of code execute repeatedly.</li>
13
- <li class='link ulchildlink'>
14
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_running.htm'>Running Apex</a></strong><br>
15
- You can access many features of the Salesforce user interface programmatically in Apex, and you can integrate with external SOAP and REST Web services. You can run Apex code using a variety of mechanisms. Apex code runs in atomic transactions. </li>
16
- <li class='link ulchildlink'>
17
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_debug_test_deploy.htm'>Debugging, Testing, and Deploying Apex</a></strong><br>
18
- Develop your Apex code in a sandbox and debug it with the Developer Console and debug logs. Unit-test your code, then distribute it to customers using packages.</li>
19
- <li class='link ulchildlink'>
20
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_reference.htm'>Apex Language Reference</a></strong><br>
21
- This Apex reference goes into detail about DML statements and the built-in Apex classes and interfaces.</li>
22
- <li class='link ulchildlink'>
23
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_appendices.htm'>Appendices</a></strong><br>
24
- </li>
25
- <li class='link ulchildlink'>
26
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/glossary_apex.htm'>Glossary</a></strong><br>
27
- </li>
28
- </ul>
29
- </div><!--DRC 228.7--></div>`;
30
-
31
- export const allowedTags = [
32
- "p",
33
- ".p",
34
- ".shortdesc",
35
- "h1",
36
- "h2",
37
- "h3",
38
- "h4",
39
- "h5",
40
- "h6",
41
- "li",
42
- "dl",
43
- "th",
44
- "td"
45
- ];
@@ -1,83 +0,0 @@
1
- import {
2
- RecentSearches,
3
- LOCAL_STORAGE_KEY,
4
- LIMIT
5
- } from "utils-internal/recentSearches";
6
-
7
- describe("recentSearches", () => {
8
- beforeEach(() => {
9
- window.localStorage.clear();
10
- });
11
-
12
- it("initializes correctly from local storage", () => {
13
- const initial = ["test", "test1", "test2"];
14
-
15
- window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(initial));
16
- const searches = new RecentSearches();
17
-
18
- expect(searches.get()).toEqual(initial);
19
- });
20
-
21
- it("ignores exact duplicate additions", () => {
22
- const searches = new RecentSearches();
23
-
24
- const item = "test";
25
-
26
- searches.add(item);
27
- searches.add(item);
28
-
29
- expect(searches.get().length).toEqual(1);
30
- });
31
-
32
- it("ignores duplicate additions with extraneous white space", () => {
33
- const searches = new RecentSearches();
34
-
35
- const item1 = "test";
36
- const item2 = " test ";
37
-
38
- searches.add(item1);
39
- searches.add(item2);
40
-
41
- expect(searches.get().length).toEqual(1);
42
- expect(searches.get()[0]).toEqual(item1);
43
- });
44
-
45
- it("prioritizes the last searched item", () => {
46
- const searches = new RecentSearches();
47
-
48
- const item1 = "test1";
49
- const item2 = "test2";
50
-
51
- searches.add(item1);
52
- searches.add(item2);
53
-
54
- expect(searches.get().length).toEqual(2);
55
-
56
- expect(searches.get()[0]).toEqual(item2);
57
- expect(searches.get()[1]).toEqual(item1);
58
-
59
- searches.add(item1);
60
-
61
- expect(searches.get().length).toEqual(2);
62
- expect(searches.get()[0]).toEqual(item1);
63
- expect(searches.get()[1]).toEqual(item2);
64
- });
65
-
66
- it("will not exceed the limit", () => {
67
- const searches = new RecentSearches();
68
-
69
- Array.apply(null, Array(LIMIT + 1)).forEach((_, i) => {
70
- searches.add(i.toString());
71
- });
72
-
73
- expect(searches.get().length).toEqual(LIMIT);
74
- });
75
-
76
- it("doesn't add a bogus value", () => {
77
- const searches = new RecentSearches();
78
-
79
- [null, "", " ", " ", 5].forEach((v) => searches.add(v));
80
-
81
- expect(searches.get().length).toEqual(0);
82
- });
83
- });
@@ -1,15 +0,0 @@
1
- import { fetchWordpressPosts } from "../wordpress";
2
-
3
- global.fetch = jest.fn(() =>
4
- Promise.resolve({
5
- json: () => Promise.resolve({ res: { status: 404 } })
6
- })
7
- );
8
-
9
- describe("wordpress network request", () => {
10
- it("displays a console error and returns null on unsuccessful request", async () => {
11
- const res = await fetchWordpressPosts("", "");
12
-
13
- expect(res).toBeNull();
14
- });
15
- });