@salesforcedevs/dx-components 0.24.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lwc.config.json +3 -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 +9 -3
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +1 -1
- package/src/modules/dx/slackButton/__tests__/slackButton.test.ts +1 -1
- package/src/modules/dx/slackCta/__tests__/slackCta.test.ts +1 -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/modules/utils/storybook/storybook.ts +0 -33
package/lwc.config.json
CHANGED
|
@@ -63,6 +63,8 @@
|
|
|
63
63
|
"dx/select",
|
|
64
64
|
"dx/sidebar",
|
|
65
65
|
"dx/sidebarOld",
|
|
66
|
+
"dx/slackCta",
|
|
67
|
+
"dx/slackButton",
|
|
66
68
|
"dx/socials",
|
|
67
69
|
"dx/toc",
|
|
68
70
|
"dx/tree",
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
"helpers/reset",
|
|
79
81
|
"helpers/table",
|
|
80
82
|
"helpers/text",
|
|
81
|
-
"utils/headerBase",
|
|
83
|
+
"utils-internal/headerBase",
|
|
82
84
|
"utils/normalizers",
|
|
83
85
|
"utils/highlight"
|
|
84
86
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.2",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"@types/debounce": "^1.2.0",
|
|
30
30
|
"@types/lodash.get": "^4.4.6"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "66db495d67f1b7280ad0946332910f38c563d39b"
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Banner from "dx/banner";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
|
|
4
4
|
const TAG = "dx-banner";
|
|
5
5
|
const render = createRenderComponent(TAG, Banner);
|
|
@@ -8,9 +8,8 @@ describe(TAG, () => {
|
|
|
8
8
|
it("renders banner component", () => {
|
|
9
9
|
const element = render();
|
|
10
10
|
|
|
11
|
-
const innerContainer =
|
|
12
|
-
".container_inner"
|
|
13
|
-
);
|
|
11
|
+
const innerContainer =
|
|
12
|
+
element.shadowRoot.querySelectorAll(".container_inner");
|
|
14
13
|
|
|
15
14
|
expect(innerContainer).not.toBeNull();
|
|
16
15
|
|
|
@@ -18,14 +17,17 @@ describe(TAG, () => {
|
|
|
18
17
|
});
|
|
19
18
|
|
|
20
19
|
it("renders custom banner markup in the banner", () => {
|
|
21
|
-
const element = render({
|
|
20
|
+
const element = render({
|
|
21
|
+
bannerMarkup: "Give feedback about our new site"
|
|
22
|
+
});
|
|
22
23
|
|
|
23
|
-
const bannerContainer =
|
|
24
|
-
".info-container"
|
|
25
|
-
);
|
|
24
|
+
const bannerContainer =
|
|
25
|
+
element.shadowRoot.querySelector(".info-container");
|
|
26
26
|
|
|
27
27
|
return Promise.resolve().then(() => {
|
|
28
|
-
expect(bannerContainer.innerHTML).toContain(
|
|
28
|
+
expect(bannerContainer.innerHTML).toContain(
|
|
29
|
+
"Give feedback about our new site"
|
|
30
|
+
);
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BrandThemeProvider, { toCss } from "dx/brandThemeProvider";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import brandCssVars from "../brandCssVars";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-brand-theme-provider";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Breadcrumbs from "dx/breadcrumbs";
|
|
2
2
|
import Dropdown from "dx/dropdown";
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
import { mockPathname, mockBreadcrumbs, mockNavItems } from "./mockProps";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-breadcrumbs";
|
|
@@ -16,9 +16,8 @@ describe(TAG, () => {
|
|
|
16
16
|
expect(navElement).not.toBeNull();
|
|
17
17
|
expect(navElement.classList).toHaveLength(0);
|
|
18
18
|
|
|
19
|
-
const breadcrumbs: Array<HTMLElement> =
|
|
20
|
-
".breadcrumb"
|
|
21
|
-
);
|
|
19
|
+
const breadcrumbs: Array<HTMLElement> =
|
|
20
|
+
element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
22
21
|
const { length } = breadcrumbs;
|
|
23
22
|
expect(breadcrumbs).toHaveLength(length);
|
|
24
23
|
expect(
|
|
@@ -28,9 +27,8 @@ describe(TAG, () => {
|
|
|
28
27
|
).toBe(true);
|
|
29
28
|
expect(breadcrumbs[length - 1].tagName).toBe("SPAN");
|
|
30
29
|
|
|
31
|
-
const dropdown: Dropdown =
|
|
32
|
-
"dx-dropdown"
|
|
33
|
-
);
|
|
30
|
+
const dropdown: Dropdown =
|
|
31
|
+
element.shadowRoot.querySelector("dx-dropdown");
|
|
34
32
|
expect(dropdown).not.toBeNull();
|
|
35
33
|
expect(dropdown.options).toHaveLength(expectedOptionsLength);
|
|
36
34
|
|
|
@@ -55,9 +53,8 @@ describe(TAG, () => {
|
|
|
55
53
|
expect(navElement.classList).toHaveLength(1);
|
|
56
54
|
expect(navElement.classList).toContain("hide-current-location");
|
|
57
55
|
|
|
58
|
-
const breadcrumbs: Array<HTMLElement> =
|
|
59
|
-
".breadcrumb"
|
|
60
|
-
);
|
|
56
|
+
const breadcrumbs: Array<HTMLElement> =
|
|
57
|
+
element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
61
58
|
expect(breadcrumbs).toHaveLength(mockBreadcrumbs.length - 1);
|
|
62
59
|
expect(
|
|
63
60
|
Array.from(breadcrumbs).every(({ tagName }) => tagName === "A")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Button from "dx/button";
|
|
2
|
-
import ButtonTest from "
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import ButtonTest from "test-components/buttonTest";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
|
|
5
5
|
const TAG = "dx-button";
|
|
6
6
|
const render = createRenderComponent(TAG, Button);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardBlogPost from "dx/cardBlogPost";
|
|
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-card-blog-post";
|
|
@@ -10,9 +10,8 @@ describe(TAG, () => {
|
|
|
10
10
|
it("renders without datetime", () => {
|
|
11
11
|
const element = render(mockProps);
|
|
12
12
|
|
|
13
|
-
const cardContent: HTMLElement =
|
|
14
|
-
"dx-card-content"
|
|
15
|
-
);
|
|
13
|
+
const cardContent: HTMLElement =
|
|
14
|
+
element.shadowRoot.querySelector("dx-card-content");
|
|
16
15
|
expect(cardContent).not.toBeNull();
|
|
17
16
|
return expect(element).toBeAccessible();
|
|
18
17
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardBlogPostProvider from "dx/cardBlogPostProvider";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockWordpressPosts from "./mockWordpressPosts";
|
|
4
4
|
|
|
5
5
|
const delay = () => new Promise((res) => setTimeout(res, 0));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardCallout from "dx/cardCallout";
|
|
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-card-callout";
|
|
@@ -9,12 +9,9 @@ describe(TAG, () => {
|
|
|
9
9
|
it("renders the link, arrow icon, title, & label", () => {
|
|
10
10
|
const element = render(mockProps);
|
|
11
11
|
|
|
12
|
-
const els = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"h3",
|
|
16
|
-
".dx-text-button-light"
|
|
17
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
12
|
+
const els = ["a", "dx-icon", "h3", ".dx-text-button-light"].map(
|
|
13
|
+
(query) => element.shadowRoot.querySelector(query)
|
|
14
|
+
);
|
|
18
15
|
|
|
19
16
|
expect(els).not.toContain(null);
|
|
20
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { toDxColor } from "utils/css";
|
|
3
|
+
import { toDxColor } from "utils-internal/css";
|
|
4
4
|
import { track } from "dx/instrumentation";
|
|
5
5
|
|
|
6
6
|
export default class CardCallout extends LightningElement {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import CardContent from "dx/cardContent";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
|
-
import { isSlotEmpty } from "utils/slot";
|
|
4
|
+
import { isSlotEmpty } from "utils-internal/slot";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-card-content";
|
|
7
7
|
const render = createRenderComponent(TAG, CardContent);
|
|
8
8
|
|
|
9
|
-
jest.mock("utils/slot", () => {
|
|
9
|
+
jest.mock("utils-internal/slot", () => {
|
|
10
10
|
return {
|
|
11
11
|
isSlotEmpty: jest.fn()
|
|
12
12
|
};
|
|
@@ -16,24 +16,18 @@ describe(TAG, () => {
|
|
|
16
16
|
it("renders", () => {
|
|
17
17
|
const element = render(mockProps);
|
|
18
18
|
|
|
19
|
-
const imagelink: HTMLElement =
|
|
20
|
-
".image-link"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const renderedAuthor: HTMLElement = element.shadowRoot.querySelector(
|
|
32
|
-
"dx-image-and-label"
|
|
33
|
-
);
|
|
34
|
-
const renderedBody: HTMLElement = element.shadowRoot.querySelector(
|
|
35
|
-
".body"
|
|
36
|
-
);
|
|
19
|
+
const imagelink: HTMLElement =
|
|
20
|
+
element.shadowRoot.querySelector(".image-link");
|
|
21
|
+
const renderedLabel: HTMLElement =
|
|
22
|
+
element.shadowRoot.querySelector(".label");
|
|
23
|
+
const renderedTitle: HTMLElement =
|
|
24
|
+
element.shadowRoot.querySelector("dx-card-title");
|
|
25
|
+
const renderedSubtitle: HTMLElement =
|
|
26
|
+
element.shadowRoot.querySelector(".subtitle");
|
|
27
|
+
const renderedAuthor: HTMLElement =
|
|
28
|
+
element.shadowRoot.querySelector("dx-image-and-label");
|
|
29
|
+
const renderedBody: HTMLElement =
|
|
30
|
+
element.shadowRoot.querySelector(".body");
|
|
37
31
|
|
|
38
32
|
expect(imagelink).not.toBeNull();
|
|
39
33
|
expect(renderedLabel).not.toBeNull();
|
|
@@ -53,12 +47,10 @@ describe(TAG, () => {
|
|
|
53
47
|
it("fires events", () => {
|
|
54
48
|
const element = render(mockProps);
|
|
55
49
|
|
|
56
|
-
const imagelink: HTMLElement =
|
|
57
|
-
".image-link"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"div"
|
|
61
|
-
);
|
|
50
|
+
const imagelink: HTMLElement =
|
|
51
|
+
element.shadowRoot.querySelector(".image-link");
|
|
52
|
+
const containerDiv: HTMLElement =
|
|
53
|
+
element.shadowRoot.querySelector("div");
|
|
62
54
|
imagelink.dispatchEvent(new CustomEvent("mouseenter"));
|
|
63
55
|
|
|
64
56
|
return Promise.resolve()
|
|
@@ -78,12 +70,10 @@ describe(TAG, () => {
|
|
|
78
70
|
it("renders datetime slot", () => {
|
|
79
71
|
(isSlotEmpty as jest.Mock).mockReturnValue(false);
|
|
80
72
|
const element = render(mockProps);
|
|
81
|
-
const slot: HTMLSlotElement =
|
|
82
|
-
"[name=datetime]"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"div"
|
|
86
|
-
);
|
|
73
|
+
const slot: HTMLSlotElement =
|
|
74
|
+
element.shadowRoot.querySelector("[name=datetime]");
|
|
75
|
+
const containerDiv: HTMLElement =
|
|
76
|
+
element.shadowRoot.querySelector("div");
|
|
87
77
|
slot.dispatchEvent(new Event("slotchange"));
|
|
88
78
|
expect(isSlotEmpty).toBeCalledTimes(1);
|
|
89
79
|
|
|
@@ -99,12 +89,10 @@ describe(TAG, () => {
|
|
|
99
89
|
backgroundColor: "red"
|
|
100
90
|
});
|
|
101
91
|
|
|
102
|
-
const containerDiv: HTMLElement =
|
|
103
|
-
"div"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"[part=image]"
|
|
107
|
-
);
|
|
92
|
+
const containerDiv: HTMLElement =
|
|
93
|
+
element.shadowRoot.querySelector("div");
|
|
94
|
+
const link: HTMLElement =
|
|
95
|
+
element.shadowRoot.querySelector("[part=image]");
|
|
108
96
|
|
|
109
97
|
expect(containerDiv.classList).toContain("dx-card-base_featured");
|
|
110
98
|
expect(link.getAttribute("style")).toContain("");
|
|
@@ -1,8 +1,8 @@
|
|
|
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";
|
|
5
|
-
import { toDxColor } from "utils/css";
|
|
4
|
+
import { isSlotEmpty } from "utils-internal/slot";
|
|
5
|
+
import { toDxColor } from "utils-internal/css";
|
|
6
6
|
|
|
7
7
|
export default class CardContent extends LightningElement {
|
|
8
8
|
@api authorHref?: string | null = null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Card from "dx/cardDocs";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
-
import { stopPropagationOnSlotted } from "utils/slot";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
+
import { stopPropagationOnSlotted } from "utils-internal/slot";
|
|
4
4
|
import mockProps from "./mockProps";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-card";
|
|
7
7
|
const render = createRenderComponent(TAG, Card);
|
|
8
8
|
|
|
9
|
-
jest.mock("utils/slot", () => {
|
|
9
|
+
jest.mock("utils-internal/slot", () => {
|
|
10
10
|
return {
|
|
11
11
|
stopPropagationOnSlotted: jest.fn()
|
|
12
12
|
};
|
|
@@ -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 { stopPropagationOnSlotted } from "utils/slot";
|
|
4
|
+
import { stopPropagationOnSlotted } from "utils-internal/slot";
|
|
5
5
|
|
|
6
6
|
export default class CardDocs extends LightningElement {
|
|
7
7
|
@api body!: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable jest/no-mocks-import */
|
|
2
2
|
import CardEvent from "dx/cardEvent";
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
4
|
import mockProps from "./mockProps";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-card-event";
|
|
@@ -20,9 +20,8 @@ describe(TAG, () => {
|
|
|
20
20
|
startDatetime: mockProps.startDatetime,
|
|
21
21
|
hre: mockProps.href
|
|
22
22
|
});
|
|
23
|
-
const endtimeEls =
|
|
24
|
-
".end-date-time"
|
|
25
|
-
);
|
|
23
|
+
const endtimeEls =
|
|
24
|
+
component.shadowRoot.querySelectorAll(".end-date-time");
|
|
26
25
|
expect(endtimeEls.length).toEqual(0);
|
|
27
26
|
return expect(component).toBeAccessible();
|
|
28
27
|
});
|
|
@@ -43,12 +42,10 @@ describe(TAG, () => {
|
|
|
43
42
|
featured: true
|
|
44
43
|
});
|
|
45
44
|
|
|
46
|
-
const imagelink: HTMLElement =
|
|
47
|
-
".image-link"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"div"
|
|
51
|
-
);
|
|
45
|
+
const imagelink: HTMLElement =
|
|
46
|
+
element.shadowRoot.querySelector(".image-link");
|
|
47
|
+
const containerDiv: HTMLElement =
|
|
48
|
+
element.shadowRoot.querySelector("div");
|
|
52
49
|
|
|
53
50
|
expect(containerDiv.classList).toContain("dx-card-base_featured");
|
|
54
51
|
|
|
@@ -70,9 +67,8 @@ describe(TAG, () => {
|
|
|
70
67
|
|
|
71
68
|
it("renders the short description", () => {
|
|
72
69
|
const component = render(mockProps);
|
|
73
|
-
const shortDescEl =
|
|
74
|
-
".dx-text-body-2"
|
|
75
|
-
);
|
|
70
|
+
const shortDescEl =
|
|
71
|
+
component.shadowRoot.querySelector(".dx-text-body-2");
|
|
76
72
|
expect(shortDescEl).not.toBeNull();
|
|
77
73
|
return expect(component).toBeAccessible();
|
|
78
74
|
});
|
|
@@ -4,8 +4,8 @@ import FormattedDateTime from "dx/formattedDateTime";
|
|
|
4
4
|
import ImageAndLabel from "dx/imageAndLabel";
|
|
5
5
|
import Topics from "dx/topics";
|
|
6
6
|
import TypeBadge from "dx/typeBadge";
|
|
7
|
-
import { createMediaMock } from "utils/jest";
|
|
8
|
-
import { createRenderComponent } from "utils/tests";
|
|
7
|
+
import { createMediaMock } from "utils-internal/jest";
|
|
8
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
9
9
|
import mockProps, { podcastMock } from "./mockProps";
|
|
10
10
|
|
|
11
11
|
const MOBILE_QUERY = "(max-width: 640px)";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CardMinimal from "dx/cardMinimal";
|
|
2
2
|
import TypeBadge from "dx/typeBadge";
|
|
3
|
-
import { createRenderComponent } from "utils/tests";
|
|
4
|
-
import { createMediaMock } from "utils/jest";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
|
+
import { createMediaMock } from "utils-internal/jest";
|
|
5
5
|
import { blogPostMock, podcastEpisodeMock } from "./mockProps";
|
|
6
6
|
|
|
7
7
|
const MOBILE_QUERY = "(max-width: 640px)";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardNews from "dx/cardNews";
|
|
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-card-news";
|
|
@@ -44,9 +44,8 @@ describe(TAG, () => {
|
|
|
44
44
|
imgVerticalAlign: "bottom"
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
const link: HTMLElement =
|
|
48
|
-
".dx-card-news"
|
|
49
|
-
);
|
|
47
|
+
const link: HTMLElement =
|
|
48
|
+
element.shadowRoot.querySelector(".dx-card-news");
|
|
50
49
|
const image: HTMLElement = element.shadowRoot.querySelector("img");
|
|
51
50
|
expect(link.classList).toContain("is-dark");
|
|
52
51
|
expect(image.classList).toContain(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardPodcastEpisode from "dx/cardPodcastEpisode";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
|
|
4
4
|
const TAG = "dx-card-content";
|
|
5
5
|
const render = createRenderComponent(TAG, CardPodcastEpisode);
|
|
@@ -16,9 +16,8 @@ describe(TAG, () => {
|
|
|
16
16
|
it("renders", () => {
|
|
17
17
|
const element = render({ ...mockProps, datetime: fourHours });
|
|
18
18
|
|
|
19
|
-
const title: HTMLElement =
|
|
20
|
-
"dx-card-title"
|
|
21
|
-
);
|
|
19
|
+
const title: HTMLElement =
|
|
20
|
+
element.shadowRoot.querySelector("dx-card-title");
|
|
22
21
|
const body: HTMLElement = element.shadowRoot.querySelector(".body");
|
|
23
22
|
const dateTime: HTMLElement = element.shadowRoot.querySelector(
|
|
24
23
|
"dx-relative-date-time"
|
|
@@ -41,9 +40,8 @@ describe(TAG, () => {
|
|
|
41
40
|
const element = render(mockProps);
|
|
42
41
|
|
|
43
42
|
const link: HTMLElement = element.shadowRoot.querySelector("a");
|
|
44
|
-
const containerDiv: HTMLElement =
|
|
45
|
-
"div"
|
|
46
|
-
);
|
|
43
|
+
const containerDiv: HTMLElement =
|
|
44
|
+
element.shadowRoot.querySelector("div");
|
|
47
45
|
link.dispatchEvent(new CustomEvent("mouseenter"));
|
|
48
46
|
|
|
49
47
|
return Promise.resolve()
|
package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CardPodcastEpisodeProvider from "dx/cardPodcastEpisodeProvider";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockWordpressEpisodes from "./mockWordpressEpisodes";
|
|
4
4
|
|
|
5
5
|
const delay = () => new Promise((res) => setTimeout(res, 0));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import CardSmall from "dx/cardSmall";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
3
|
import mockProps from "./mockProps";
|
|
4
|
-
import { isSlotEmpty, stopPropagationOnSlotted } from "utils/slot";
|
|
4
|
+
import { isSlotEmpty, stopPropagationOnSlotted } from "utils-internal/slot";
|
|
5
5
|
|
|
6
6
|
const TAG = "dx-card-small";
|
|
7
7
|
const render = createRenderComponent(TAG, CardSmall);
|
|
8
8
|
|
|
9
|
-
jest.mock("utils/slot", () => {
|
|
9
|
+
jest.mock("utils-internal/slot", () => {
|
|
10
10
|
return {
|
|
11
11
|
isSlotEmpty: jest.fn(),
|
|
12
12
|
stopPropagationOnSlotted: jest.fn()
|
|
@@ -17,11 +17,9 @@ describe(TAG, () => {
|
|
|
17
17
|
it("renders the link, title & body; also renders card as a link by default", () => {
|
|
18
18
|
const element = render(mockProps);
|
|
19
19
|
|
|
20
|
-
const els = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"dx-icon-badge"
|
|
24
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
20
|
+
const els = ["dx-card-title", ".dx-text-body-2", "dx-icon-badge"].map(
|
|
21
|
+
(query) => element.shadowRoot.querySelector(query)
|
|
22
|
+
);
|
|
25
23
|
const card = element.shadowRoot.querySelector(".dx-card-base");
|
|
26
24
|
|
|
27
25
|
expect(els).not.toContain(null);
|
|
@@ -37,9 +35,8 @@ describe(TAG, () => {
|
|
|
37
35
|
borderless: true
|
|
38
36
|
});
|
|
39
37
|
|
|
40
|
-
const containerDiv: HTMLElement =
|
|
41
|
-
"div"
|
|
42
|
-
);
|
|
38
|
+
const containerDiv: HTMLElement =
|
|
39
|
+
element.shadowRoot.querySelector("div");
|
|
43
40
|
|
|
44
41
|
expect(containerDiv.classList).toContain("has-icon");
|
|
45
42
|
expect(containerDiv.classList).toContain("dx-card-base_borderless");
|
|
@@ -49,9 +46,8 @@ describe(TAG, () => {
|
|
|
49
46
|
(isSlotEmpty as jest.Mock).mockReturnValue(false);
|
|
50
47
|
const element = render(mockProps);
|
|
51
48
|
const slot: HTMLSlotElement = element.shadowRoot.querySelector("slot");
|
|
52
|
-
const containerDiv: HTMLElement =
|
|
53
|
-
".dx-card-base_ctas"
|
|
54
|
-
);
|
|
49
|
+
const containerDiv: HTMLElement =
|
|
50
|
+
element.shadowRoot.querySelector(".dx-card-base_ctas");
|
|
55
51
|
slot.dispatchEvent(new Event("slotchange"));
|
|
56
52
|
expect(isSlotEmpty).toBeCalledTimes(1);
|
|
57
53
|
expect(stopPropagationOnSlotted).toBeCalledTimes(1);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
IconSymbol,
|
|
7
7
|
IconBadgeShape
|
|
8
8
|
} from "typings/custom";
|
|
9
|
-
import { isSlotEmpty, stopPropagationOnSlotted } from "utils/slot";
|
|
9
|
+
import { isSlotEmpty, stopPropagationOnSlotted } from "utils-internal/slot";
|
|
10
10
|
|
|
11
11
|
export default class CardSmall extends LightningElement {
|
|
12
12
|
@api badgeBackgroundColor?: string = "indigo-vibrant-50";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Checkbox from "dx/checkbox";
|
|
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-checkbox";
|
|
@@ -68,9 +68,8 @@ describe(TAG, () => {
|
|
|
68
68
|
|
|
69
69
|
element.addEventListener("change", mockChange);
|
|
70
70
|
|
|
71
|
-
const input: HTMLInputElement =
|
|
72
|
-
"input"
|
|
73
|
-
);
|
|
71
|
+
const input: HTMLInputElement =
|
|
72
|
+
element.shadowRoot.querySelector("input");
|
|
74
73
|
input.checked = false;
|
|
75
74
|
input.dispatchEvent(new InputEvent("change"));
|
|
76
75
|
|