@salesforcedevs/dx-components 0.24.2 → 0.25.3
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.
- package/lwc.config.json +2 -1
- package/package.json +2 -2
- package/src/modules/dx/banner/__tests__/banner.test.ts +11 -9
- package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +1 -1
- package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +7 -10
- package/src/modules/dx/button/__tests__/button.test.ts +2 -2
- package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +3 -4
- package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +1 -1
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +1 -1
- package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +4 -7
- package/src/modules/dx/cardCallout/cardCallout.ts +1 -1
- package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +27 -39
- package/src/modules/dx/cardContent/cardContent.ts +2 -2
- package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +3 -3
- package/src/modules/dx/cardDocs/cardDocs.ts +1 -1
- package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +9 -13
- package/src/modules/dx/cardExpanded/__tests__/cardExpanded.test.ts +2 -2
- package/src/modules/dx/cardExpanded/cardExpanded.ts +1 -1
- package/src/modules/dx/cardMinimal/__tests__/cardMinimal.test.ts +2 -2
- package/src/modules/dx/cardMinimal/cardMinimal.ts +1 -1
- package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +3 -4
- package/src/modules/dx/cardNews/cardNews.ts +1 -1
- package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +5 -7
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +1 -1
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +1 -1
- package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +10 -14
- package/src/modules/dx/cardSmall/cardSmall.ts +1 -1
- package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +1 -1
- package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +1 -1
- package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +1 -1
- package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +3 -4
- package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +1 -1
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +3 -3
- package/src/modules/dx/codeBlock/codeBlock.ts +1 -1
- package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +16 -23
- package/src/modules/dx/dropdown/dropdown.ts +6 -6
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +1 -1
- package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +1 -1
- package/src/modules/dx/feature/__tests__/feature.test.ts +6 -5
- package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +2 -2
- package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +27 -40
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +1 -1
- package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +9 -13
- package/src/modules/dx/footer/__tests__/footer.test.ts +1 -1
- package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +1 -1
- package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +1 -1
- package/src/modules/dx/grid/__tests__/grid.test.ts +1 -1
- package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +1 -1
- package/src/modules/dx/groupText/__tests__/groupText.test.ts +9 -13
- package/src/modules/dx/groupText/groupText.stories.ts +1 -1
- package/src/modules/dx/groupText/groupText.ts +1 -1
- package/src/modules/dx/header/__tests__/header.test.ts +3 -3
- package/src/modules/dx/header/__tests__/mockProps.ts +1 -1
- package/src/modules/dx/header/header.ts +1 -1
- package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +2 -2
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +1 -1
- package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +1 -1
- package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +1 -1
- package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +2 -2
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +1 -1
- package/src/modules/dx/headerSearch/headerSearch.ts +1 -1
- package/src/modules/dx/helmet/__tests__/helmet.test.ts +3 -4
- package/src/modules/dx/hr/__tests__/hr.test.ts +1 -1
- package/src/modules/dx/icon/__tests__/icon.test.ts +1 -1
- package/src/modules/dx/icon/icon.ts +1 -1
- package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +1 -1
- package/src/modules/dx/iconBadge/iconBadge.ts +1 -1
- package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +1 -1
- package/src/modules/dx/input/__tests__/input.test.ts +23 -34
- package/src/modules/dx/input/input.ts +1 -1
- package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +2 -2
- package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +7 -10
- package/src/modules/dx/lazy/__tests__/lazy.test.ts +1 -1
- package/src/modules/dx/pagination/__tests__/pagination.test.ts +1 -1
- package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +1 -1
- package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +1 -1
- package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +1 -1
- package/src/modules/dx/popover/__tests__/popover.test.ts +5 -2
- package/src/modules/dx/popover/popover.ts +1 -1
- package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +1 -1
- package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +1 -1
- package/src/modules/dx/section/__tests__/section.test.ts +1 -1
- package/src/modules/dx/section/section.ts +1 -1
- package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +1 -1
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +3 -3
- package/src/modules/dx/sidebar/sidebar.stories.ts +4 -1
- package/src/modules/dx/sidebar/sidebar.ts +1 -1
- package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +2 -2
- package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +6 -3
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +5 -2
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +1 -1
- package/src/modules/dx/slackCta/__tests__/slackCta.test.ts +4 -8
- package/src/modules/dx/slackCta/slackCta.css +4 -0
- package/src/modules/dx/slackCta/slackCta.html +12 -1
- package/src/modules/dx/socials/__tests__/socials.test.ts +1 -1
- package/src/modules/dx/spinner/__tests__/spinner.test.ts +1 -1
- package/src/modules/dx/tab/__tests__/tab.test.ts +1 -1
- package/src/modules/dx/toc/__tests__/mockProps.ts +6 -0
- package/src/modules/dx/toc/__tests__/toc.test.ts +13 -19
- package/src/modules/dx/toc/toc.css +1 -0
- package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +3 -4
- package/src/modules/dx/topics/__tests__/topics.test.ts +1 -1
- package/src/modules/dx/tree/__tests__/tree.test.ts +1 -1
- package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +1 -1
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +1 -1
- package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +1 -1
- package/src/modules/dx/typeBadge/typeBadge.ts +1 -1
- package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +9 -13
- package/src/modules/{tests → test-components}/buttonTest/buttonTest.html +0 -0
- package/src/modules/{tests → test-components}/buttonTest/buttonTest.ts +0 -0
- package/src/modules/{tests → test-components}/codeBlockTest/codeBlockTest.js +0 -0
- package/src/modules/{tests → test-components}/featureGridTest/featureGridTest.html +0 -0
- package/src/modules/{tests → test-components}/featureGridTest/featureGridTest.ts +0 -0
- package/src/modules/{tests → test-components}/instrumentationTest/instrumentationTest.html +0 -0
- package/src/modules/{tests → test-components}/instrumentationTest/instrumentationTest.ts +0 -0
- package/src/modules/{tests → test-components}/popoverTest/popoverTest.html +0 -0
- package/src/modules/{tests → test-components}/popoverTest/popoverTest.ts +0 -0
- package/src/modules/utils/highlight/highlight.ts +1 -1
- package/src/modules/{utils → utils-internal}/archiveCard/archiveCard.ts +0 -0
- package/src/modules/{utils → utils-internal}/coveo/coveo.ts +0 -0
- package/src/modules/{utils → utils-internal}/css/css.ts +0 -0
- package/src/modules/{utils → utils-internal}/devices/devices.ts +0 -0
- package/src/modules/{utils → utils-internal}/headerBase/headerBase.ts +1 -2
- package/src/modules/{utils → utils-internal}/jest/jest.ts +0 -0
- package/src/modules/{utils → utils-internal}/options/options.ts +0 -0
- package/src/modules/{utils → utils-internal}/prismjs/prismjs.html +0 -0
- package/src/modules/{utils → utils-internal}/prismjs/prismjs.ts +220 -124
- package/src/modules/{utils → utils-internal}/recentSearches/__tests__/recentSearches.test.ts +5 -1
- package/src/modules/{utils → utils-internal}/recentSearches/recentSearches.ts +0 -0
- package/src/modules/{utils → utils-internal}/regexps/regexps.ts +0 -0
- package/src/modules/{utils → utils-internal}/seo/seo.ts +0 -0
- package/src/modules/{utils → utils-internal}/slot/slot.ts +0 -0
- package/src/modules/utils-internal/storybook/storybook.ts +32 -0
- package/src/modules/{utils → utils-internal}/tests/tests.ts +0 -0
- package/src/modules/{utils → utils-internal}/wordpress/__tests__/wordpress.test.ts +0 -0
- package/src/modules/{utils → utils-internal}/wordpress/wordpress.ts +0 -0
- package/src/assets/svg/slack-logo.svg +0 -6
- package/src/modules/dx/slackButton/__tests__/slackButton.test.ts +0 -20
- package/src/modules/dx/slackButton/slackButton.css +0 -43
- package/src/modules/dx/slackButton/slackButton.html +0 -14
- package/src/modules/dx/slackButton/slackButton.stories.ts +0 -21
- package/src/modules/dx/slackButton/slackButton.ts +0 -3
- package/src/modules/utils/storybook/storybook.ts +0 -33
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import CodeBlock from "../codeBlock";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
4
|
import { track as gtmTrack } from "dx/instrumentation";
|
|
5
|
-
//import Prism from "utils/prismjs";
|
|
5
|
+
//import Prism from "utils-internal/prismjs";
|
|
6
6
|
|
|
7
7
|
const TAG = "dx-code-block";
|
|
8
8
|
const render = createRenderComponent(TAG, CodeBlock);
|
|
@@ -12,7 +12,7 @@ jest.mock("dx/instrumentation");
|
|
|
12
12
|
const GTM_EVENT_NAME = "custEv_codeBlock";
|
|
13
13
|
/*
|
|
14
14
|
const mockPrismHighlight = jest.fn();
|
|
15
|
-
jest.mock("utils/prismjs", () =>
|
|
15
|
+
jest.mock("utils-internal/prismjs", () =>
|
|
16
16
|
jest.fn().mockImplementation(() => {
|
|
17
17
|
return {
|
|
18
18
|
highlightAllUnder: mockPrismHighlight
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api, wire, track } from "lwc";
|
|
2
2
|
import { CodeBlockTheme, CodeBlockLanguage } from "typings/custom";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import Prism from "utils/prismjs";
|
|
4
|
+
import Prism from "utils-internal/prismjs";
|
|
5
5
|
import {
|
|
6
6
|
getLocalStorageData,
|
|
7
7
|
setLocalStorageData
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Dropdown from "dx/dropdown";
|
|
2
2
|
import DropdownOption from "dx/dropdownOption";
|
|
3
3
|
import Popover from "dx/popover";
|
|
4
|
-
import { getOptionsCount } from "utils/options";
|
|
5
|
-
import { createRenderComponent } from "utils/tests";
|
|
4
|
+
import { getOptionsCount } from "utils-internal/options";
|
|
5
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
6
6
|
import mockNestedOptions from "./mockNestedOptions";
|
|
7
7
|
import mockProps from "./mockProps";
|
|
8
8
|
|
|
@@ -14,15 +14,13 @@ describe(TAG, () => {
|
|
|
14
14
|
it("renders all options when open", () => {
|
|
15
15
|
const component = render({ ...mockProps, open: true });
|
|
16
16
|
|
|
17
|
-
const menuDiv: HTMLElement =
|
|
18
|
-
".menu_list"
|
|
19
|
-
);
|
|
17
|
+
const menuDiv: HTMLElement =
|
|
18
|
+
component.shadowRoot.querySelector(".menu_list");
|
|
20
19
|
expect(menuDiv).not.toBeNull();
|
|
21
20
|
expect(menuDiv.getAttribute("role")).toBe("menu");
|
|
22
21
|
|
|
23
|
-
const options =
|
|
24
|
-
"dx-dropdown-option"
|
|
25
|
-
);
|
|
22
|
+
const options =
|
|
23
|
+
component.shadowRoot.querySelectorAll("dx-dropdown-option");
|
|
26
24
|
expect(options.length).toEqual(mockProps.options.length);
|
|
27
25
|
return expect(component).toBeAccessible();
|
|
28
26
|
});
|
|
@@ -66,17 +64,15 @@ describe(TAG, () => {
|
|
|
66
64
|
|
|
67
65
|
it("renders with menu-offset-small and menu-hidden", () => {
|
|
68
66
|
const component = render({ offset: "small", options: [] });
|
|
69
|
-
const popover: Popover =
|
|
70
|
-
"dx-popover"
|
|
71
|
-
);
|
|
67
|
+
const popover: Popover =
|
|
68
|
+
component.shadowRoot.querySelector("dx-popover");
|
|
72
69
|
expect(popover).not.toBeNull();
|
|
73
70
|
|
|
74
71
|
expect(popover.classList).toContain("menu-offset-small");
|
|
75
72
|
expect(popover.classList).toContain("menu-hidden");
|
|
76
73
|
|
|
77
|
-
const options =
|
|
78
|
-
"dx-dropdown-option"
|
|
79
|
-
);
|
|
74
|
+
const options =
|
|
75
|
+
component.shadowRoot.querySelectorAll("dx-dropdown-option");
|
|
80
76
|
expect(options).toHaveLength(0);
|
|
81
77
|
|
|
82
78
|
return expect(component).toBeAccessible();
|
|
@@ -95,9 +91,8 @@ describe(TAG, () => {
|
|
|
95
91
|
const popover = component.shadowRoot.querySelector("dx-popover");
|
|
96
92
|
popover.addEventListener("close", mockClose);
|
|
97
93
|
|
|
98
|
-
const option =
|
|
99
|
-
"dx-dropdown-option"
|
|
100
|
-
);
|
|
94
|
+
const option =
|
|
95
|
+
component.shadowRoot.querySelector("dx-dropdown-option");
|
|
101
96
|
const id = option.option.id;
|
|
102
97
|
option.dispatchEvent(new CustomEvent("select", { detail: id }));
|
|
103
98
|
|
|
@@ -117,9 +112,8 @@ describe(TAG, () => {
|
|
|
117
112
|
const popover = component.shadowRoot.querySelector("dx-popover");
|
|
118
113
|
popover.addEventListener("close", mockClose);
|
|
119
114
|
|
|
120
|
-
const option: DropdownOption =
|
|
121
|
-
"dx-dropdown-option"
|
|
122
|
-
);
|
|
115
|
+
const option: DropdownOption =
|
|
116
|
+
component.shadowRoot.querySelector("dx-dropdown-option");
|
|
123
117
|
const id = option.option.id;
|
|
124
118
|
option.dispatchEvent(new CustomEvent("select", { detail: id }));
|
|
125
119
|
|
|
@@ -161,9 +155,8 @@ describe(TAG, () => {
|
|
|
161
155
|
);
|
|
162
156
|
expect(component.focusedValue).toBe(mockProps.value);
|
|
163
157
|
|
|
164
|
-
const popover: HTMLElement =
|
|
165
|
-
"dx-popover"
|
|
166
|
-
);
|
|
158
|
+
const popover: HTMLElement =
|
|
159
|
+
component.shadowRoot.querySelector("dx-popover");
|
|
167
160
|
expect(popover).not.toBeNull();
|
|
168
161
|
popover.dispatchEvent(new CustomEvent("close"));
|
|
169
162
|
expect(component.focusedValue).toBeNull();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Option, PopperPlacement } from "typings/custom";
|
|
2
2
|
import { LightningElement, api, track } from "lwc";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import { deepmapOptions } from "utils/options";
|
|
5
4
|
import get from "lodash.get";
|
|
5
|
+
import { deepmapOptions } from "utils-internal/options";
|
|
6
6
|
import { toJson } from "utils/normalizers";
|
|
7
7
|
|
|
8
8
|
interface DropdownOption extends Option {
|
|
@@ -29,10 +29,11 @@ export default class Dropdown extends LightningElement {
|
|
|
29
29
|
@api small?: boolean = false;
|
|
30
30
|
@api openOnHover?: boolean = false; // dropdown opens/closes with hover
|
|
31
31
|
@api width?: string | null = null;
|
|
32
|
-
@api fullWidth?: boolean | null;
|
|
32
|
+
@api fullWidth?: boolean | null;
|
|
33
|
+
@api navItemLabel: string | null = null;
|
|
33
34
|
|
|
34
35
|
// props forwarded to dropdown option
|
|
35
|
-
@api analyticsEvent: string | null = null
|
|
36
|
+
@api analyticsEvent: string | null = null;
|
|
36
37
|
|
|
37
38
|
@api
|
|
38
39
|
get options() {
|
|
@@ -165,9 +166,8 @@ export default class Dropdown extends LightningElement {
|
|
|
165
166
|
? this.findOptionElementIndex(this.value)
|
|
166
167
|
: 0;
|
|
167
168
|
|
|
168
|
-
const optionToFocus: any =
|
|
169
|
-
defaultIndex < 0 ? 0 : defaultIndex
|
|
170
|
-
];
|
|
169
|
+
const optionToFocus: any =
|
|
170
|
+
this.optionsElements[defaultIndex < 0 ? 0 : defaultIndex];
|
|
171
171
|
if (optionToFocus) {
|
|
172
172
|
optionToFocus.focus();
|
|
173
173
|
this._focusedValue = optionToFocus.option.id;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DropdownOption from "dx/dropdownOption";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import { MOCK_BUTTON_PROPS, MOCK_LINK_PROPS } from "./mockProps";
|
|
4
4
|
import * as instrumentation from "dx/instrumentation";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Feature from "dx/feature";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-feature";
|
|
@@ -10,10 +10,11 @@ const dataCodeSample = {
|
|
|
10
10
|
label: "Featured Demo",
|
|
11
11
|
buttonHref: "https://github.com/trailheadapps/ebikes-lwc",
|
|
12
12
|
buttonLabel: "Explore on Github",
|
|
13
|
-
imageSrc:
|
|
13
|
+
imageSrc:
|
|
14
|
+
"https://d12fd6m9xo0jeo.cloudfront.net/0953ee82-173a-484d-b4f4-7467bce5e200.jpg",
|
|
14
15
|
isExternalLink: "true",
|
|
15
16
|
variant: "display"
|
|
16
|
-
}
|
|
17
|
+
};
|
|
17
18
|
|
|
18
19
|
describe(TAG, () => {
|
|
19
20
|
it("renders an accessible feature with description on the left by default", () => {
|
|
@@ -42,9 +43,9 @@ describe(TAG, () => {
|
|
|
42
43
|
const sectionEl = element.shadowRoot.querySelector("section");
|
|
43
44
|
expect(sectionEl).not.toBeNull();
|
|
44
45
|
expect(sectionEl.className).toBe("description-left");
|
|
45
|
-
const imgContainer =
|
|
46
|
+
const imgContainer =
|
|
47
|
+
element.shadowRoot.querySelector(".image-container");
|
|
46
48
|
expect(imgContainer).not.toBe(null);
|
|
47
49
|
return expect(element).toBeAccessible();
|
|
48
50
|
});
|
|
49
|
-
|
|
50
51
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This test requires a wrapper component that's not exposed in the build.
|
|
2
|
-
import FeatureGridTest from "
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import FeatureGridTest from "test-components/featureGridTest";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-feature-grid";
|
|
6
6
|
const render = createRenderComponent(TAG, FeatureGridTest);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import FeaturedContentHeader from "dx/featuredContentHeader";
|
|
2
2
|
import ImageAndLabel from "dx/imageAndLabel";
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
import mockProps, { blogPodcastMock } from "./mockProps";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-featured-content-header";
|
|
@@ -20,15 +20,12 @@ const testHeadingAttributes = (
|
|
|
20
20
|
describe(TAG, () => {
|
|
21
21
|
it("renders", () => {
|
|
22
22
|
const element = render(mockProps);
|
|
23
|
-
const renderedLabel: HTMLElement =
|
|
24
|
-
".label"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const renderedBody: HTMLElement = element.shadowRoot.querySelector(
|
|
30
|
-
"span"
|
|
31
|
-
);
|
|
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");
|
|
32
29
|
|
|
33
30
|
expect(renderedLabel).not.toBeNull();
|
|
34
31
|
expect(renderedLabel.textContent).toEqual(mockProps.label);
|
|
@@ -81,9 +78,8 @@ describe(TAG, () => {
|
|
|
81
78
|
it("renders authors", () => {
|
|
82
79
|
const element = render(mockProps);
|
|
83
80
|
|
|
84
|
-
const optionsListComponent: Array<HTMLElement> =
|
|
85
|
-
"dx-image-and-label"
|
|
86
|
-
);
|
|
81
|
+
const optionsListComponent: Array<HTMLElement> =
|
|
82
|
+
element.shadowRoot.querySelectorAll("dx-image-and-label");
|
|
87
83
|
expect(optionsListComponent).toHaveLength(mockProps.authors.length);
|
|
88
84
|
|
|
89
85
|
return expect(element).toBeAccessible();
|
|
@@ -92,9 +88,8 @@ describe(TAG, () => {
|
|
|
92
88
|
it("specifies authors image", () => {
|
|
93
89
|
const element = render(blogPodcastMock);
|
|
94
90
|
|
|
95
|
-
const optionsListComponent: Array<ImageAndLabel> =
|
|
96
|
-
"dx-image-and-label"
|
|
97
|
-
);
|
|
91
|
+
const optionsListComponent: Array<ImageAndLabel> =
|
|
92
|
+
element.shadowRoot.querySelectorAll("dx-image-and-label");
|
|
98
93
|
expect(optionsListComponent).toHaveLength(
|
|
99
94
|
blogPodcastMock.authors.length
|
|
100
95
|
);
|
|
@@ -110,9 +105,8 @@ describe(TAG, () => {
|
|
|
110
105
|
it("fallbacks in imgSrc if avatar_urls is not defined", () => {
|
|
111
106
|
const element = render(mockProps);
|
|
112
107
|
|
|
113
|
-
const optionsListComponent: Array<ImageAndLabel> =
|
|
114
|
-
"dx-image-and-label"
|
|
115
|
-
);
|
|
108
|
+
const optionsListComponent: Array<ImageAndLabel> =
|
|
109
|
+
element.shadowRoot.querySelectorAll("dx-image-and-label");
|
|
116
110
|
expect(optionsListComponent).toHaveLength(
|
|
117
111
|
blogPodcastMock.authors.length
|
|
118
112
|
);
|
|
@@ -135,9 +129,8 @@ describe(TAG, () => {
|
|
|
135
129
|
|
|
136
130
|
const element = render({ ...mockProps, authors });
|
|
137
131
|
|
|
138
|
-
const optionsListComponent: Array<ImageAndLabel> =
|
|
139
|
-
"dx-image-and-label"
|
|
140
|
-
);
|
|
132
|
+
const optionsListComponent: Array<ImageAndLabel> =
|
|
133
|
+
element.shadowRoot.querySelectorAll("dx-image-and-label");
|
|
141
134
|
|
|
142
135
|
expect(optionsListComponent).toHaveLength(0);
|
|
143
136
|
|
|
@@ -156,24 +149,18 @@ describe(TAG, () => {
|
|
|
156
149
|
title: "test"
|
|
157
150
|
});
|
|
158
151
|
|
|
159
|
-
const renderedContainer: HTMLElement =
|
|
160
|
-
".container"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const renderedImage: HTMLElement = element.shadowRoot.querySelector(
|
|
172
|
-
"img"
|
|
173
|
-
);
|
|
174
|
-
const renderedImageLabel: HTMLElement = element.shadowRoot.querySelector(
|
|
175
|
-
"dx-image-and-label"
|
|
176
|
-
);
|
|
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");
|
|
177
164
|
|
|
178
165
|
expect(renderedContainer.className).toBe(
|
|
179
166
|
"container img-placement_below variant_dark"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { LightningSlotElement } from "typings/custom";
|
|
4
|
-
import { isSlotEmpty } from "utils/slot";
|
|
4
|
+
import { isSlotEmpty } from "utils-internal/slot";
|
|
5
5
|
import { toJson } from "utils/normalizers";
|
|
6
6
|
import { ImageAndLabel } from "../imageAndLabel";
|
|
7
7
|
import svgs from "./svgs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import FeaturesList from "dx/featuresList";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-features-list";
|
|
@@ -9,21 +9,18 @@ describe(TAG, () => {
|
|
|
9
9
|
it("renders", () => {
|
|
10
10
|
const element = render(mockProps);
|
|
11
11
|
|
|
12
|
-
const container: HTMLElement =
|
|
13
|
-
".container"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"h2"
|
|
17
|
-
);
|
|
12
|
+
const container: HTMLElement =
|
|
13
|
+
element.shadowRoot.querySelector(".container");
|
|
14
|
+
const renderedTitle: HTMLElement =
|
|
15
|
+
element.shadowRoot.querySelector("h2");
|
|
18
16
|
|
|
19
17
|
expect(renderedTitle).not.toBeNull();
|
|
20
18
|
expect(container).not.toBeNull();
|
|
21
19
|
|
|
22
20
|
expect(renderedTitle.textContent).toEqual(mockProps.title);
|
|
23
21
|
|
|
24
|
-
const optionListComponent: Array<HTMLElement> =
|
|
25
|
-
".option"
|
|
26
|
-
);
|
|
22
|
+
const optionListComponent: Array<HTMLElement> =
|
|
23
|
+
element.shadowRoot.querySelectorAll(".option");
|
|
27
24
|
expect(optionListComponent).toHaveLength(mockProps.options.length);
|
|
28
25
|
|
|
29
26
|
return expect(element).toBeAccessible();
|
|
@@ -37,9 +34,8 @@ describe(TAG, () => {
|
|
|
37
34
|
options: JSON.stringify(optionsListParameter)
|
|
38
35
|
});
|
|
39
36
|
|
|
40
|
-
const optionListComponent: Array<HTMLElement> =
|
|
41
|
-
".option"
|
|
42
|
-
);
|
|
37
|
+
const optionListComponent: Array<HTMLElement> =
|
|
38
|
+
element.shadowRoot.querySelectorAll(".option");
|
|
43
39
|
expect(optionListComponent).toHaveLength(element.options.length);
|
|
44
40
|
|
|
45
41
|
return expect(element).toBeAccessible();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable jest/no-mocks-import */
|
|
2
2
|
import FormattedDateTime from "dx/formattedDateTime";
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
import mockProps from "./mockProps";
|
|
5
5
|
const TAG = "dx-formatted-date-time";
|
|
6
6
|
const render = createRenderComponent(TAG, FormattedDateTime);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GroupText from "dx/groupText";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
4
|
import Button from "dx/button";
|
|
5
5
|
|
|
@@ -20,20 +20,17 @@ describe(TAG, () => {
|
|
|
20
20
|
const element = render(mockProps);
|
|
21
21
|
|
|
22
22
|
const el: HTMLElement = element.shadowRoot.querySelector(".text-group");
|
|
23
|
-
const titleEl: HTMLElement =
|
|
24
|
-
".text-group .title"
|
|
25
|
-
);
|
|
23
|
+
const titleEl: HTMLElement =
|
|
24
|
+
element.shadowRoot.querySelector(".text-group .title");
|
|
26
25
|
const titleAriaLevel = titleEl.getAttribute("aria-level");
|
|
27
26
|
const labelEl: HTMLElement = element.shadowRoot.querySelector(".label");
|
|
28
27
|
const subtitleEl: HTMLElement = element.shadowRoot.querySelector(
|
|
29
28
|
".text-group span.subtitle"
|
|
30
29
|
);
|
|
31
|
-
const formattedDateTimeEl: HTMLElement =
|
|
32
|
-
"dx-formatted-date-time"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
".text-group .body"
|
|
36
|
-
);
|
|
30
|
+
const formattedDateTimeEl: HTMLElement =
|
|
31
|
+
element.shadowRoot.querySelector("dx-formatted-date-time");
|
|
32
|
+
const bodyEl: HTMLElement =
|
|
33
|
+
element.shadowRoot.querySelector(".text-group .body");
|
|
37
34
|
const buttonGroupEl: HTMLElement = element.shadowRoot.querySelector(
|
|
38
35
|
".text-group .button-group"
|
|
39
36
|
);
|
|
@@ -61,9 +58,8 @@ describe(TAG, () => {
|
|
|
61
58
|
const ariaLevel = "1";
|
|
62
59
|
const element = render({ ...mockProps, titleAriaLevel: ariaLevel });
|
|
63
60
|
|
|
64
|
-
const titleEl: HTMLElement =
|
|
65
|
-
".text-group .title"
|
|
66
|
-
);
|
|
61
|
+
const titleEl: HTMLElement =
|
|
62
|
+
element.shadowRoot.querySelector(".text-group .title");
|
|
67
63
|
const titleAriaLevel = titleEl.getAttribute("aria-level");
|
|
68
64
|
|
|
69
65
|
expect(titleAriaLevel).toEqual(ariaLevel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html } from "lit-html";
|
|
2
2
|
import mockProps from "./__tests__/mockProps";
|
|
3
3
|
import featureListMockProps from "../featuresList/__tests__/mockProps";
|
|
4
|
-
import { renderStyle } from "../../utils/storybook/storybook";
|
|
4
|
+
import { renderStyle } from "../../utils-internal/storybook/storybook";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: "dx/dx-group-text",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { LightningSlotElement, Link } from "typings/custom";
|
|
4
|
-
import { isSlotEmpty } from "utils/slot";
|
|
4
|
+
import { isSlotEmpty } from "utils-internal/slot";
|
|
5
5
|
import { toJson } from "utils/normalizers";
|
|
6
6
|
|
|
7
7
|
type OptionalLink = Link | null;
|
|
@@ -2,14 +2,14 @@ import Button from "dx/button";
|
|
|
2
2
|
import Dropdown from "dx/dropdown";
|
|
3
3
|
import Header from "dx/header";
|
|
4
4
|
import Icon from "dx/icon";
|
|
5
|
-
import { createRenderComponent } from "utils/tests";
|
|
5
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
6
|
+
import { ANALYTICS_INFO } from "utils-internal/headerBase";
|
|
7
|
+
import { track } from "dx/instrumentation";
|
|
6
8
|
import {
|
|
7
9
|
mockPropsDevelopers,
|
|
8
10
|
mockPropsEmployees,
|
|
9
11
|
mockPropsNoNavigation
|
|
10
12
|
} from "./mockProps";
|
|
11
|
-
import { track } from "dx/instrumentation";
|
|
12
|
-
import { ANALYTICS_INFO } from "utils/headerBase";
|
|
13
13
|
|
|
14
14
|
const TAG = "dx-header";
|
|
15
15
|
const render = createRenderComponent(TAG, Header);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
mockNavAnalytics
|
|
14
14
|
} from "./mockNavs";
|
|
15
15
|
import mockNavDevelopers from "./mockNavDevelopers";
|
|
16
|
-
import { coveoHeaderConfig } from "../../../utils/coveo/coveo";
|
|
16
|
+
import { coveoHeaderConfig } from "../../../utils-internal/coveo/coveo";
|
|
17
17
|
|
|
18
18
|
const versions = JSON.stringify([
|
|
19
19
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import HeaderMobileNavMenu from "dx/headerMobileNavMenu";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
-
import { getOptionsCount } from "utils/options";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
+
import { getOptionsCount } from "utils-internal/options";
|
|
4
4
|
import navItems from "../../header/__tests__/mockNavDevelopers";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-header-mobile-nav-menu";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { Option } from "typings/custom";
|
|
4
|
-
import { deepmapOptions } from "utils/options";
|
|
4
|
+
import { deepmapOptions } from "utils-internal/options";
|
|
5
5
|
|
|
6
6
|
export default class HeaderMobileNavMenu extends LightningElement {
|
|
7
7
|
@api open: boolean = false;
|
package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import HeaderMobileNavMenuOption from "dx/headerMobileNavMenuOption";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
|
|
4
4
|
const TAG = "dx-header-mobile-nav-menu-option";
|
|
5
5
|
const render = createRenderComponent(TAG, HeaderMobileNavMenuOption);
|
|
@@ -4,8 +4,8 @@ import Button from "dx/button";
|
|
|
4
4
|
import Dropdown from "dx/dropdown";
|
|
5
5
|
import HeaderSearch from "dx/headerSearch";
|
|
6
6
|
import { PopoverRequestCloseType } from "typings/custom";
|
|
7
|
-
import { createRenderComponent } from "utils/tests";
|
|
8
|
-
import { coveoHeaderConfig } from "utils/coveo";
|
|
7
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
8
|
+
import { coveoHeaderConfig } from "utils-internal/coveo";
|
|
9
9
|
import { MOCK_SUGGESTIONS } from "./mockData";
|
|
10
10
|
import mockProps from "./mockProps";
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { PopoverRequestCloseType, Option } from "typings/custom";
|
|
4
|
-
import { buildSearchEngine } from "utils/coveo";
|
|
4
|
+
import { buildSearchEngine } from "utils-internal/coveo";
|
|
5
5
|
import {
|
|
6
6
|
StandaloneSearchBox as StandaloneSearchBoxType,
|
|
7
7
|
StandaloneSearchBoxState,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Helmet from "dx/helmet";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import { HelmetVariant } from "typings/custom";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-helmet";
|
|
@@ -10,9 +10,8 @@ describe("dx-helmet", () => {
|
|
|
10
10
|
const title = "Super Cool Title";
|
|
11
11
|
const component = render({ title });
|
|
12
12
|
|
|
13
|
-
const titleSpan: HTMLElement =
|
|
14
|
-
".home-link-title"
|
|
15
|
-
);
|
|
13
|
+
const titleSpan: HTMLElement =
|
|
14
|
+
component.shadowRoot.querySelector(".home-link-title");
|
|
16
15
|
expect(titleSpan.textContent).toBe(title);
|
|
17
16
|
|
|
18
17
|
const links: HTMLElement[] = component.shadowRoot.querySelectorAll("a");
|