@salesforcedevs/dx-components 0.26.2 → 0.26.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 +1 -1
- package/package.json +2 -6
- package/src/modules/{utils-internal → base-elements}/archiveCard/archiveCard.ts +0 -0
- package/src/modules/{utils-internal → base-elements}/headerBase/headerBase.ts +0 -0
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +1 -1
- package/src/modules/dx/cardCallout/cardCallout.ts +1 -1
- package/src/modules/dx/cardContent/cardContent.ts +2 -2
- package/src/modules/dx/cardDocs/cardDocs.ts +1 -1
- package/src/modules/dx/cardExpanded/cardExpanded.ts +1 -1
- package/src/modules/dx/cardMinimal/cardMinimal.ts +1 -1
- package/src/modules/dx/cardNews/cardNews.ts +1 -1
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +1 -1
- package/src/modules/dx/cardSmall/cardSmall.ts +1 -1
- package/src/modules/dx/codeBlock/codeBlock.ts +1 -1
- package/src/modules/dx/dropdown/dropdown.ts +1 -1
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +1 -1
- package/src/modules/dx/groupText/groupText.ts +1 -1
- package/src/modules/dx/header/header.ts +1 -1
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +1 -1
- package/src/modules/dx/headerSearch/headerSearch.ts +1 -1
- package/src/modules/dx/icon/icon.ts +1 -1
- package/src/modules/dx/iconBadge/iconBadge.ts +1 -1
- package/src/modules/dx/input/input.ts +1 -1
- package/src/modules/dx/popover/popover.ts +1 -1
- package/src/modules/dx/section/section.ts +1 -1
- package/src/modules/dx/sidebar/sidebar.ts +1 -1
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +2 -5
- package/src/modules/dx/typeBadge/typeBadge.ts +1 -1
- package/src/modules/{utils-internal → utils}/coveo/coveo.ts +0 -0
- package/src/modules/{utils-internal → utils}/css/css.ts +0 -0
- package/src/modules/{utils-internal → utils}/devices/devices.ts +0 -0
- package/src/modules/utils/highlight/highlight.ts +1 -1
- package/src/modules/{utils-internal → utils}/options/options.ts +0 -0
- package/src/modules/{utils-internal → utils}/prismjs/prismjs.html +0 -0
- package/src/modules/{utils-internal → utils}/prismjs/prismjs.ts +0 -0
- package/src/modules/{utils-internal → utils}/recentSearches/recentSearches.ts +0 -0
- package/src/modules/{utils-internal → utils}/regexps/regexps.ts +0 -0
- package/src/modules/{utils-internal → utils}/seo/seo.ts +0 -0
- package/src/modules/{utils-internal → utils}/slot/slot.ts +0 -0
- package/src/modules/{utils-internal → utils}/wordpress/wordpress.ts +0 -0
- package/src/modules/dx/banner/__tests__/banner.test.ts +0 -33
- package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +0 -49
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.stories.ts +0 -321
- package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +0 -140
- package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +0 -28
- package/src/modules/dx/breadcrumbs/breadcrumbs.stories.ts +0 -39
- package/src/modules/dx/button/__tests__/button.test.ts +0 -107
- package/src/modules/dx/button/button.stories.ts +0 -150
- package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +0 -26
- package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/cardBlogPost/cardBlogPost.stories.ts +0 -164
- package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +0 -34
- package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +0 -44
- package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +0 -20
- package/src/modules/dx/cardCallout/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardCallout/cardCallout.stories.ts +0 -33
- package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +0 -100
- package/src/modules/dx/cardContent/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/cardContent/cardContent.stories.ts +0 -127
- package/src/modules/dx/cardDemo/cardDemo.stories.ts +0 -115
- package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +0 -48
- package/src/modules/dx/cardDocs/__tests__/mockProps.ts +0 -9
- package/src/modules/dx/cardDocs/cardDocs.stories.ts +0 -299
- package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +0 -95
- package/src/modules/dx/cardEvent/__tests__/mockProps.ts +0 -10
- package/src/modules/dx/cardEvent/cardEvent.stories.ts +0 -153
- package/src/modules/dx/cardExpanded/__tests__/cardExpanded.test.ts +0 -193
- package/src/modules/dx/cardExpanded/__tests__/mockProps.ts +0 -21
- package/src/modules/dx/cardExpanded/cardExpanded.stories.ts +0 -59
- package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +0 -431
- package/src/modules/dx/cardGrid/__tests__/mockProps.ts +0 -15
- package/src/modules/dx/cardGrid/cardGrid.stories.ts +0 -111
- package/src/modules/dx/cardMinimal/__tests__/cardMinimal.test.ts +0 -87
- package/src/modules/dx/cardMinimal/__tests__/mockProps.ts +0 -10
- package/src/modules/dx/cardMinimal/cardMinimal.stories.ts +0 -32
- package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +0 -58
- package/src/modules/dx/cardNews/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardNews/cardNews.stories.ts +0 -115
- package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +0 -68
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.stories.ts +0 -31
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +0 -36
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +0 -50
- package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +0 -66
- package/src/modules/dx/cardSmall/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/cardSmall/cardSmall.stories.ts +0 -166
- package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +0 -46
- package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +0 -18
- package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.stories.ts +0 -122
- package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +0 -22
- package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.stories.ts +0 -147
- package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +0 -85
- package/src/modules/dx/checkbox/__tests__/mockProps.ts +0 -5
- package/src/modules/dx/checkbox/checkbox.stories.ts +0 -38
- package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +0 -80
- package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +0 -14
- package/src/modules/dx/checkboxGroup/checkboxGroup.stories.ts +0 -33
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +0 -238
- package/src/modules/dx/codeBlock/__tests__/mockProps.ts +0 -160
- package/src/modules/dx/codeBlock/codeBlock.stories.ts +0 -143
- package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +0 -165
- package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +0 -96
- package/src/modules/dx/dropdown/__tests__/mockOptions.ts +0 -10
- package/src/modules/dx/dropdown/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/dropdown/dropdown.stories.ts +0 -89
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +0 -112
- package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +0 -20
- package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +0 -52
- package/src/modules/dx/emptyState/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/emptyState/emptyState.stories.ts +0 -45
- package/src/modules/dx/feature/__tests__/feature.test.ts +0 -51
- package/src/modules/dx/feature/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +0 -21
- package/src/modules/dx/featureGrid/featureGrid.stories.ts +0 -120
- package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +0 -178
- package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +0 -73
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.stories.ts +0 -153
- package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +0 -43
- package/src/modules/dx/featuresList/__tests__/mockProps.ts +0 -17
- package/src/modules/dx/featuresList/featuresList.stories.ts +0 -30
- package/src/modules/dx/footer/__tests__/footer.test.ts +0 -147
- package/src/modules/dx/footer/__tests__/mockLocales.ts +0 -7
- package/src/modules/dx/footer/footer.stories.ts +0 -88
- package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +0 -34
- package/src/modules/dx/footerOption/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +0 -25
- package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +0 -103
- package/src/modules/dx/grid/__tests__/grid.test.ts +0 -32
- package/src/modules/dx/grid/grid.stories.ts +0 -134
- package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +0 -82
- package/src/modules/dx/groupBio/__tests__/mockProps.ts +0 -15
- package/src/modules/dx/groupBio/groupBio.stories.ts +0 -66
- package/src/modules/dx/groupText/__tests__/groupText.test.ts +0 -69
- package/src/modules/dx/groupText/__tests__/mockProps.ts +0 -35
- package/src/modules/dx/groupText/groupText.stories.ts +0 -81
- package/src/modules/dx/header/__tests__/header.test.ts +0 -236
- package/src/modules/dx/header/__tests__/mockNavArchitects.ts +0 -169
- package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +0 -419
- package/src/modules/dx/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/dx/header/__tests__/mockProps.ts +0 -164
- package/src/modules/dx/header/header.stories.ts +0 -172
- package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +0 -123
- package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +0 -38
- package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +0 -49
- package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +0 -182
- package/src/modules/dx/headerSearch/__tests__/mockData.ts +0 -11
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/helmet/__tests__/helmet.test.ts +0 -52
- package/src/modules/dx/helmet/helmet.stories.ts +0 -53
- package/src/modules/dx/hr/__tests__/hr.test.ts +0 -53
- package/src/modules/dx/hr/__tests__/mockProps.ts +0 -16
- package/src/modules/dx/hr/hr.stories.ts +0 -50
- package/src/modules/dx/icon/__tests__/icon.test.ts +0 -54
- package/src/modules/dx/icon/icon.stories.ts +0 -100
- package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +0 -17
- package/src/modules/dx/iconBadge/iconBadge.stories.ts +0 -32
- package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +0 -39
- package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/imageAndLabel/imageAndLabel.stories.ts +0 -48
- package/src/modules/dx/input/__tests__/input.test.ts +0 -357
- package/src/modules/dx/input/input.stories.ts +0 -102
- package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +0 -86
- package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +0 -83
- package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +0 -39
- package/src/modules/dx/interactiveImage/interactiveImage.stories.ts +0 -31
- package/src/modules/dx/lazy/__tests__/lazy.test.ts +0 -43
- package/src/modules/dx/lazy/lazy.stories.ts +0 -132
- package/src/modules/dx/pagination/__tests__/pagination.test.ts +0 -121
- package/src/modules/dx/pagination/pagination.stories.ts +0 -88
- package/src/modules/dx/podcastHost/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +0 -21
- package/src/modules/dx/podcastHost/podcastHost.stories.ts +0 -17
- package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +0 -20
- package/src/modules/dx/podcastPlayer/podcastPlayer.stories.ts +0 -13
- package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +0 -16
- package/src/modules/dx/podcastSubscription/podcastSubscription.stories.ts +0 -23
- package/src/modules/dx/popover/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/popover/__tests__/popover.test.ts +0 -313
- package/src/modules/dx/popover/popover.stories.ts +0 -82
- package/src/modules/dx/radioGroup/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +0 -42
- package/src/modules/dx/radioGroup/radioGroup.stories.ts +0 -25
- package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +0 -55
- package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +0 -52
- package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +0 -83
- package/src/modules/dx/searchResults/searchResults.stories.ts +0 -36
- package/src/modules/dx/section/__tests__/section.test.ts +0 -17
- package/src/modules/dx/section/section.stories.ts +0 -381
- package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +0 -66
- package/src/modules/dx/sectionSignup/sectionSignup.stories.ts +0 -49
- package/src/modules/dx/select/select.stories.ts +0 -59
- package/src/modules/dx/sidebar/__tests__/mockProps.ts +0 -181
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEmptyEvent.ts +0 -6
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEvent.ts +0 -527
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -568
- package/src/modules/dx/sidebar/sidebar.stories.ts +0 -188
- package/src/modules/dx/sidebarOld/__tests__/mockProps.ts +0 -178
- package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +0 -570
- package/src/modules/dx/sidebarOld/sidebarOld.stories.ts +0 -139
- package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +0 -1686
- package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +0 -175
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +0 -96
- package/src/modules/dx/slackCta/__tests__/slackCta.test.ts +0 -36
- package/src/modules/dx/slackCta/slackCta.stories.ts +0 -25
- package/src/modules/dx/socials/__tests__/socials.test.ts +0 -114
- package/src/modules/dx/socials/socials.stories.ts +0 -24
- package/src/modules/dx/spinner/__tests__/spinner.test.ts +0 -37
- package/src/modules/dx/spinner/spinner.stories.ts +0 -69
- package/src/modules/dx/tab/__tests__/tab.test.ts +0 -129
- package/src/modules/dx/tab/tab.stories.ts +0 -57
- package/src/modules/dx/toc/__tests__/mockProps.ts +0 -28
- package/src/modules/dx/toc/__tests__/toc.test.ts +0 -109
- package/src/modules/dx/toc/toc.stories.ts +0 -26
- package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +0 -22
- package/src/modules/dx/tooltip/tooltip.stories.ts +0 -46
- package/src/modules/dx/topics/__tests__/mockProps.ts +0 -3
- package/src/modules/dx/topics/__tests__/topics.test.ts +0 -31
- package/src/modules/dx/tree/__tests__/mockProps.ts +0 -215
- package/src/modules/dx/tree/__tests__/tree.test.ts +0 -346
- package/src/modules/dx/tree/__tests__/treeHandler.test.ts +0 -194
- package/src/modules/dx/tree/tree.stories.ts +0 -65
- package/src/modules/dx/treeItem/__tests__/mockProps.ts +0 -46
- package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +0 -377
- package/src/modules/dx/treeTile/__tests__/mockProps.ts +0 -16
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +0 -168
- package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +0 -77
- package/src/modules/dx/typeBadge/typeBadge.stories.ts +0 -114
- package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +0 -72
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.stories.ts +0 -19
- package/src/modules/test-components/buttonTest/buttonTest.html +0 -3
- package/src/modules/test-components/buttonTest/buttonTest.ts +0 -3
- package/src/modules/test-components/codeBlockTest/codeBlockTest.js +0 -4
- package/src/modules/test-components/featureGridTest/featureGridTest.html +0 -7
- package/src/modules/test-components/featureGridTest/featureGridTest.ts +0 -5
- package/src/modules/test-components/instrumentationTest/instrumentationTest.html +0 -4
- package/src/modules/test-components/instrumentationTest/instrumentationTest.ts +0 -8
- package/src/modules/test-components/popoverTest/popoverTest.html +0 -6
- package/src/modules/test-components/popoverTest/popoverTest.ts +0 -5
- package/src/modules/test-components/slackCtaTest/slackCtaTest.html +0 -3
- package/src/modules/test-components/slackCtaTest/slackCtaTest.ts +0 -3
- package/src/modules/utils/highlight/__tests__/highlight.test.ts +0 -108
- package/src/modules/utils/highlight/__tests__/mockProps.ts +0 -45
- package/src/modules/utils-internal/jest/jest.ts +0 -58
- package/src/modules/utils-internal/recentSearches/__tests__/recentSearches.test.ts +0 -83
- package/src/modules/utils-internal/storybook/storybook.ts +0 -32
- package/src/modules/utils-internal/tests/tests.ts +0 -38
- package/src/modules/utils-internal/wordpress/__tests__/wordpress.test.ts +0 -15
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
import { mockMultipleDownloadProps } from "./__tests__/mockProps";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "dx/dx-interactive-image",
|
|
6
|
-
component: "dx-interactive-image"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// prettier-ignore
|
|
10
|
-
const createStyles = () => html `
|
|
11
|
-
<style>
|
|
12
|
-
#root {
|
|
13
|
-
max-width: 800px;
|
|
14
|
-
}
|
|
15
|
-
</style>`;
|
|
16
|
-
|
|
17
|
-
const urls = JSON.stringify(mockMultipleDownloadProps.downloadUrls);
|
|
18
|
-
|
|
19
|
-
export const SingleDownload = () => html` ${createStyles()}
|
|
20
|
-
<dx-interactive-image
|
|
21
|
-
title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
|
22
|
-
featured-src="https://i.imgur.com/FUsyxR5.jpg"
|
|
23
|
-
download-urls="https://i.imgur.com/FUsyxR5.jpg"
|
|
24
|
-
></dx-interactive-image>`;
|
|
25
|
-
|
|
26
|
-
export const MultipleDownloads = () => html` ${createStyles()}
|
|
27
|
-
<dx-interactive-image
|
|
28
|
-
title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
|
29
|
-
featured-src="https://i.imgur.com/FUsyxR5.jpg"
|
|
30
|
-
download-urls="${urls}"
|
|
31
|
-
></dx-interactive-image>`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import Lazy from "dx/lazy";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "dx-lazy";
|
|
5
|
-
const renderComponent = createRenderComponent(TAG, Lazy);
|
|
6
|
-
|
|
7
|
-
function mockIntersectionObserver() {
|
|
8
|
-
return jest.fn().mockImplementation(() => {
|
|
9
|
-
return {
|
|
10
|
-
observe: jest.fn(),
|
|
11
|
-
disconnect: jest.fn()
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe(TAG, () => {
|
|
17
|
-
beforeAll(() => {
|
|
18
|
-
global.IntersectionObserver = mockIntersectionObserver();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe("component render", () => {
|
|
22
|
-
it("should render with default mode of 'idle'", () => {
|
|
23
|
-
const component = renderComponent({});
|
|
24
|
-
|
|
25
|
-
expect(component.mode).toEqual("idle");
|
|
26
|
-
|
|
27
|
-
return expect(component).toBeAccessible();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should render with default intersection observer options", () => {
|
|
31
|
-
const component = renderComponent({
|
|
32
|
-
mode: "intersection"
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
expect(component.mode).toEqual("intersection");
|
|
36
|
-
expect(component.rootId).toBeUndefined();
|
|
37
|
-
expect(component.rootMargin).toEqual("0px");
|
|
38
|
-
expect(component.threshold).toEqual(0);
|
|
39
|
-
|
|
40
|
-
return expect(component).toBeAccessible();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-lazy",
|
|
5
|
-
component: "dx-lazy"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const IdleCallback = () => html`
|
|
9
|
-
<style>
|
|
10
|
-
dx-lazy {
|
|
11
|
-
border: 1px dashed;
|
|
12
|
-
width: 300px;
|
|
13
|
-
height: 300px;
|
|
14
|
-
display: block;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
<dx-lazy mode="idle">
|
|
18
|
-
<div>
|
|
19
|
-
<span>Idle Child DOM rendered</span>
|
|
20
|
-
<dx-icon
|
|
21
|
-
sprite="salesforcebrand"
|
|
22
|
-
symbol="learning"
|
|
23
|
-
size="2xlarge"
|
|
24
|
-
></dx-icon>
|
|
25
|
-
</div>
|
|
26
|
-
</dx-lazy>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const IntersectionCallback = () => html`
|
|
30
|
-
<style>
|
|
31
|
-
.lazy-container {
|
|
32
|
-
padding: 10px;
|
|
33
|
-
height: 1000px;
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
justify-content: flex-end;
|
|
37
|
-
border: 1px solid;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
dx-lazy {
|
|
41
|
-
border: 1px dashed;
|
|
42
|
-
width: 300px;
|
|
43
|
-
height: 300px;
|
|
44
|
-
display: block;
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
47
|
-
<span>scroll down 👇</span>
|
|
48
|
-
<div class="lazy-container">
|
|
49
|
-
<span>dx-lazy</span>
|
|
50
|
-
<dx-lazy mode="intersection" threshold="1">
|
|
51
|
-
<div>
|
|
52
|
-
<span>Child DOM rendered</span>
|
|
53
|
-
<dx-icon
|
|
54
|
-
sprite="salesforcebrand"
|
|
55
|
-
symbol="learning"
|
|
56
|
-
size="2xlarge"
|
|
57
|
-
></dx-icon>
|
|
58
|
-
</div>
|
|
59
|
-
</dx-lazy>
|
|
60
|
-
</div>
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
export const IntersectionCallbackWithRootElementMarginAndThreshold = () => html`
|
|
64
|
-
<style>
|
|
65
|
-
.scrollable-ancestor {
|
|
66
|
-
padding: 10px;
|
|
67
|
-
border: 1px solid;
|
|
68
|
-
height: 400px;
|
|
69
|
-
overflow: scroll;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.top-margin {
|
|
73
|
-
position: absolute;
|
|
74
|
-
height: 100px;
|
|
75
|
-
width: 100%;
|
|
76
|
-
left: 0;
|
|
77
|
-
top: 0;
|
|
78
|
-
background-color: rgb(173 216 230 / 20%);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.bottom-margin {
|
|
82
|
-
position: absolute;
|
|
83
|
-
height: 100px;
|
|
84
|
-
width: 100%;
|
|
85
|
-
left: 0;
|
|
86
|
-
bottom: 0;
|
|
87
|
-
background-color: rgb(173 216 230 / 20%);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.lazy-container {
|
|
91
|
-
padding: 10px;
|
|
92
|
-
margin: 100px 0 100px 0;
|
|
93
|
-
height: 400px;
|
|
94
|
-
display: flex;
|
|
95
|
-
flex-direction: column;
|
|
96
|
-
justify-content: flex-end;
|
|
97
|
-
border: 1px dotted;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
dx-lazy {
|
|
101
|
-
border: 1px dashed;
|
|
102
|
-
width: 150px;
|
|
103
|
-
height: 150px;
|
|
104
|
-
display: block;
|
|
105
|
-
}
|
|
106
|
-
</style>
|
|
107
|
-
<span>scroll down 👇</span>
|
|
108
|
-
<div style="position: relative;">
|
|
109
|
-
<div class="top-margin"></div>
|
|
110
|
-
<div class="bottom-margin"></div>
|
|
111
|
-
<div id="scrollable-ancestor" class="scrollable-ancestor">
|
|
112
|
-
<div class="lazy-container">
|
|
113
|
-
<span>dx-lazy</span>
|
|
114
|
-
<dx-lazy
|
|
115
|
-
mode="intersection"
|
|
116
|
-
root-id="scrollable-ancestor"
|
|
117
|
-
root-margin="-100px 0px -100px 0px"
|
|
118
|
-
threshold="1"
|
|
119
|
-
>
|
|
120
|
-
<div>
|
|
121
|
-
<span>Child DOM rendered</span>
|
|
122
|
-
<dx-icon
|
|
123
|
-
sprite="salesforcebrand"
|
|
124
|
-
symbol="learning"
|
|
125
|
-
size="2xlarge"
|
|
126
|
-
></dx-icon>
|
|
127
|
-
</div>
|
|
128
|
-
</dx-lazy>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
`;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import Pagination from "dx/pagination";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "dx-pagination";
|
|
5
|
-
const render = createRenderComponent(TAG, Pagination);
|
|
6
|
-
|
|
7
|
-
describe(TAG, () => {
|
|
8
|
-
it("renders with passed in props", () => {
|
|
9
|
-
const element = render({
|
|
10
|
-
currentPage: "1",
|
|
11
|
-
totalPages: "10",
|
|
12
|
-
pagesToShow: "5"
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
16
|
-
"button[data-page-id]"
|
|
17
|
-
);
|
|
18
|
-
expect(pageButtons.length).toEqual(5);
|
|
19
|
-
|
|
20
|
-
const activeButton = element.shadowRoot.querySelector(
|
|
21
|
-
"button.current-page"
|
|
22
|
-
);
|
|
23
|
-
expect(activeButton.textContent).toEqual("1");
|
|
24
|
-
|
|
25
|
-
return expect(element).toBeAccessible();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("doesn't render past totalPages", () => {
|
|
29
|
-
const element = render({
|
|
30
|
-
currentPage: "10",
|
|
31
|
-
totalPages: "10",
|
|
32
|
-
pagesToShow: "5"
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
36
|
-
"button[data-page-id]"
|
|
37
|
-
);
|
|
38
|
-
for (const button of pageButtons) {
|
|
39
|
-
expect(parseInt(button.dataset.pageId, 10)).toBeLessThanOrEqual(10);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return expect(element).toBeAccessible();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("only renders up to totalPages", () => {
|
|
46
|
-
const element = render({
|
|
47
|
-
currentPage: "1",
|
|
48
|
-
totalPages: "3",
|
|
49
|
-
pagesToShow: "5"
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
53
|
-
"button[data-page-id]"
|
|
54
|
-
);
|
|
55
|
-
for (const button of pageButtons) {
|
|
56
|
-
expect(parseInt(button.dataset.pageId, 10)).toBeLessThanOrEqual(3);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return expect(element).toBeAccessible();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("triggers custom event on previous button", () => {
|
|
63
|
-
const element = render({
|
|
64
|
-
currentPage: "3",
|
|
65
|
-
totalPages: "3",
|
|
66
|
-
pagesToShow: "5"
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const handler = jest.fn();
|
|
70
|
-
element.addEventListener("pagechange", handler);
|
|
71
|
-
|
|
72
|
-
const previousButton: HTMLElement = element.shadowRoot.querySelector(
|
|
73
|
-
"[data-part-id=previous]"
|
|
74
|
-
);
|
|
75
|
-
previousButton.click();
|
|
76
|
-
expect(handler).toHaveBeenCalled();
|
|
77
|
-
expect(handler.mock.calls[0][0].detail).toEqual(2);
|
|
78
|
-
|
|
79
|
-
return expect(element).toBeAccessible();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("triggers custom event on next button", () => {
|
|
83
|
-
const element = render({
|
|
84
|
-
currentPage: "3",
|
|
85
|
-
totalPages: "3",
|
|
86
|
-
pagesToShow: "5"
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const handler = jest.fn();
|
|
90
|
-
element.addEventListener("pagechange", handler);
|
|
91
|
-
|
|
92
|
-
const nextButton: HTMLElement = element.shadowRoot.querySelector(
|
|
93
|
-
"[data-part-id=next]"
|
|
94
|
-
);
|
|
95
|
-
nextButton.click();
|
|
96
|
-
expect(handler).toHaveBeenCalled();
|
|
97
|
-
expect(handler.mock.calls[0][0].detail).toEqual(4);
|
|
98
|
-
|
|
99
|
-
return expect(element).toBeAccessible();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("triggers custom event clicking on any page", () => {
|
|
103
|
-
const element = render({
|
|
104
|
-
currentPage: "3",
|
|
105
|
-
totalPages: "3",
|
|
106
|
-
pagesToShow: "5"
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const handler = jest.fn();
|
|
110
|
-
element.addEventListener("pagechange", handler);
|
|
111
|
-
|
|
112
|
-
const activeButton = element.shadowRoot.querySelector(
|
|
113
|
-
"button.current-page"
|
|
114
|
-
);
|
|
115
|
-
activeButton.click();
|
|
116
|
-
expect(handler).toHaveBeenCalled();
|
|
117
|
-
expect(handler.mock.calls[0][0].detail).toEqual(3);
|
|
118
|
-
|
|
119
|
-
return expect(element).toBeAccessible();
|
|
120
|
-
});
|
|
121
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-pagination",
|
|
5
|
-
component: "dx-pagination"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const createStyles = () => html`
|
|
9
|
-
<style>
|
|
10
|
-
body {
|
|
11
|
-
padding: 12px 0 0 0 !important;
|
|
12
|
-
}
|
|
13
|
-
.title {
|
|
14
|
-
font-weight: bold;
|
|
15
|
-
margin: 24px;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
const title = (value: string) => html`<p class="title">${value}</p>`;
|
|
21
|
-
|
|
22
|
-
export const Base = () => html`
|
|
23
|
-
${createStyles()}
|
|
24
|
-
${title("Current page: 1, total pages: 10, pages to show: 5")}
|
|
25
|
-
<dx-pagination
|
|
26
|
-
current-page="1"
|
|
27
|
-
total-pages="10"
|
|
28
|
-
pages-to-show="5"
|
|
29
|
-
></dx-pagination>
|
|
30
|
-
|
|
31
|
-
${title("Current page: 3, total pages: 10, pages to show: 5")}
|
|
32
|
-
<dx-pagination
|
|
33
|
-
current-page="3"
|
|
34
|
-
total-pages="10"
|
|
35
|
-
pages-to-show="5"
|
|
36
|
-
></dx-pagination>
|
|
37
|
-
|
|
38
|
-
${title("Current page: 3, total pages: 3, pages to show: 5")}
|
|
39
|
-
<dx-pagination
|
|
40
|
-
current-page="3"
|
|
41
|
-
total-pages="3"
|
|
42
|
-
pages-to-show="5"
|
|
43
|
-
></dx-pagination>
|
|
44
|
-
|
|
45
|
-
${title(
|
|
46
|
-
"Current page: 3, total pages: 10, pages to show: 6 (rounded down to 5)"
|
|
47
|
-
)}
|
|
48
|
-
<dx-pagination
|
|
49
|
-
current-page="3"
|
|
50
|
-
total-pages="10"
|
|
51
|
-
pages-to-show="6"
|
|
52
|
-
></dx-pagination>
|
|
53
|
-
|
|
54
|
-
${title("Current page: 3, total pages: 10, pages to show: 3")}
|
|
55
|
-
<dx-pagination
|
|
56
|
-
current-page="3"
|
|
57
|
-
total-pages="10"
|
|
58
|
-
pages-to-show="3"
|
|
59
|
-
></dx-pagination>
|
|
60
|
-
|
|
61
|
-
${title("Current page: 6, total pages: 20, pages to show: 11")}
|
|
62
|
-
<dx-pagination
|
|
63
|
-
current-page="6"
|
|
64
|
-
total-pages="20"
|
|
65
|
-
pages-to-show="11"
|
|
66
|
-
></dx-pagination>
|
|
67
|
-
|
|
68
|
-
${title("Current page: 20, total pages: 20, pages to show: 11")}
|
|
69
|
-
<dx-pagination
|
|
70
|
-
current-page="20"
|
|
71
|
-
total-pages="20"
|
|
72
|
-
pages-to-show="11"
|
|
73
|
-
></dx-pagination>
|
|
74
|
-
|
|
75
|
-
${title("Current page: 10, total pages: 10, pages to show: 5")}
|
|
76
|
-
<dx-pagination
|
|
77
|
-
current-page="10"
|
|
78
|
-
total-pages="10"
|
|
79
|
-
pages-to-show="5"
|
|
80
|
-
></dx-pagination>
|
|
81
|
-
|
|
82
|
-
${title("Current page: 1, total pages: 3, pages to show: 2")}
|
|
83
|
-
<dx-pagination
|
|
84
|
-
current-page="1"
|
|
85
|
-
total-pages="3"
|
|
86
|
-
pages-to-show="2"
|
|
87
|
-
></dx-pagination>
|
|
88
|
-
`;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
firstName: "Maynard",
|
|
3
|
-
lastName: "Maynard James Keenan",
|
|
4
|
-
imgSrc: "https://placekitten.com/96/96",
|
|
5
|
-
twitterHref: "https://twitter.com/puscifer",
|
|
6
|
-
bio:
|
|
7
|
-
"Maynard James Keenan (born James Herbert Keenan; April 17, 1964) is an American singer, songwriter, musician, record producer, actor, martial artist, and winemaker. He is best known as the lead singer and primary lyricist of the rock band Tool, with whom he has released five studio albums, A Perfect Circle, with whom he has released four studio albums, and Puscifer, with whom he has released four studio albums."
|
|
8
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import PodcastHost from "dx/podcastHost";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
import mockProps from "./mockProps";
|
|
4
|
-
|
|
5
|
-
const TAG = "dx-podcast-host";
|
|
6
|
-
const render = createRenderComponent(TAG, PodcastHost);
|
|
7
|
-
|
|
8
|
-
describe(TAG, () => {
|
|
9
|
-
it("renders the image, host, bio and link", () => {
|
|
10
|
-
const element = render(mockProps);
|
|
11
|
-
|
|
12
|
-
const els = [
|
|
13
|
-
".host-img > img",
|
|
14
|
-
".dx-text-heading-4",
|
|
15
|
-
".host-bio p",
|
|
16
|
-
"dx-button"
|
|
17
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
18
|
-
expect(els).not.toContain(null);
|
|
19
|
-
return expect(element).toBeAccessible();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-podcast-host",
|
|
5
|
-
component: "dx-podcast-host"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const Base = () => html`
|
|
9
|
-
<dx-podcast-host
|
|
10
|
-
first-name="Maynard"
|
|
11
|
-
last-name="James Keenan"
|
|
12
|
-
img-src="https://placekitten.com/96/96"
|
|
13
|
-
twitter-href="https://twitter.com/puscifer"
|
|
14
|
-
bio="Maynard James Keenan (born James Herbert Keenan; April 17, 1964) is an American singer, songwriter, musician, record producer, actor, martial artist, and winemaker. He is best known as the lead singer and primary lyricist of the rock band Tool, with whom he has released five studio albums, A Perfect Circle, with whom he has released four studio albums, and Puscifer, with whom he has released four studio albums."
|
|
15
|
-
>
|
|
16
|
-
</dx-podcast-host>
|
|
17
|
-
`;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import PodcastPlayer from "dx/podcastPlayer";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "dx-podcast-player";
|
|
5
|
-
const render = createRenderComponent(TAG, PodcastPlayer);
|
|
6
|
-
|
|
7
|
-
const src =
|
|
8
|
-
"https://www3.assets.heroku.com/podcasts/codeish/Codeish_Episode_108_Wicked_CoolKit.mp3";
|
|
9
|
-
|
|
10
|
-
describe(TAG, () => {
|
|
11
|
-
it("renders <audio> with provided src", () => {
|
|
12
|
-
const component = render({ src });
|
|
13
|
-
|
|
14
|
-
const player = component.shadowRoot.querySelector("audio");
|
|
15
|
-
expect(player).not.toBe(null);
|
|
16
|
-
expect(player.getAttribute("src")).toEqual(src);
|
|
17
|
-
|
|
18
|
-
return expect(component).toBeAccessible();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-podcast-player",
|
|
5
|
-
component: "dx-podcast-player"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const Base = () => html`
|
|
9
|
-
<dx-podcast-player
|
|
10
|
-
src="https://www3.assets.heroku.com/podcasts/codeish/Codeish_Episode_108_Wicked_CoolKit.mp3"
|
|
11
|
-
>
|
|
12
|
-
</dx-podcast-player>
|
|
13
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import podcastSubscription from "dx/podcastSubscription";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "dx-podcast-subscription";
|
|
5
|
-
const render = createRenderComponent(TAG, podcastSubscription);
|
|
6
|
-
|
|
7
|
-
describe(TAG, () => {
|
|
8
|
-
it("renders the badges linking to main podcast platforms", () => {
|
|
9
|
-
const element = render();
|
|
10
|
-
|
|
11
|
-
const badges = element.shadowRoot.querySelectorAll(".badges a");
|
|
12
|
-
expect(badges).not.toBe(undefined);
|
|
13
|
-
expect(badges.length).toBeGreaterThan(0);
|
|
14
|
-
return expect(element).toBeAccessible();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-podcast-subscription",
|
|
5
|
-
component: "dx-podcast-subscription"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const createStyles = () => html`
|
|
9
|
-
<style>
|
|
10
|
-
h2 {
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
font-size: 24px;
|
|
13
|
-
margin: 10px 0 30px 0;
|
|
14
|
-
}
|
|
15
|
-
</style>
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export const Base = () => html`
|
|
19
|
-
${createStyles()}
|
|
20
|
-
<h2>Podcast Subscription</h2>
|
|
21
|
-
|
|
22
|
-
<dx-podcast-subscription>eo!</dx-podcast-subscription>
|
|
23
|
-
`;
|