@salesforcedevs/dx-components 0.26.2 → 0.28.0
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 -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/modalDrawer/modalDrawer.css +40 -0
- package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
- package/src/modules/dx/modalDrawer/modalDrawer.ts +27 -0
- 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/slackCta/slackCta.css +1 -1
- package/src/modules/dx/tooltip/tooltip.css +1 -0
- 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,321 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-brand-theme-provider",
|
|
5
|
-
component: "dx-brand-theme-provider"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const style = () => html` <style>
|
|
9
|
-
body {
|
|
10
|
-
padding: 0 !important;
|
|
11
|
-
}
|
|
12
|
-
#block {
|
|
13
|
-
padding: 16px;
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: flex-start;
|
|
18
|
-
font-size: 12px;
|
|
19
|
-
margin-bottom: 4px;
|
|
20
|
-
box-shadow: 0 2px 2px 0px rgba(0, 0, 0, 0.07);
|
|
21
|
-
}
|
|
22
|
-
#block > span > span {
|
|
23
|
-
color: grey;
|
|
24
|
-
}
|
|
25
|
-
</style>`;
|
|
26
|
-
|
|
27
|
-
// prettier-ignore
|
|
28
|
-
export const Service = () => html` ${style()}
|
|
29
|
-
<dx-brand-theme-provider brand="service">
|
|
30
|
-
<div id="block" style="background: var(--dx-g-brand-current-color)">
|
|
31
|
-
<span>
|
|
32
|
-
--dx-g-brand-current-color:
|
|
33
|
-
<span>--dx-g-brand-service-color</span>
|
|
34
|
-
</span>
|
|
35
|
-
</div>
|
|
36
|
-
<div
|
|
37
|
-
id="block"
|
|
38
|
-
style="background: var(--dx-g-brand-current-color-background)"
|
|
39
|
-
>
|
|
40
|
-
<span>
|
|
41
|
-
--dx-g-brand-current-color-background:
|
|
42
|
-
<span>--dx-g-brand-service-color-background</span>
|
|
43
|
-
</span>
|
|
44
|
-
</div>
|
|
45
|
-
<div
|
|
46
|
-
id="block"
|
|
47
|
-
style="background: var(--dx-g-brand-current-color-background-2)"
|
|
48
|
-
>
|
|
49
|
-
<span>
|
|
50
|
-
--dx-g-brand-current-color-background-2:
|
|
51
|
-
<span>--dx-g-brand-service-color-background-2</span>
|
|
52
|
-
</span>
|
|
53
|
-
</div>
|
|
54
|
-
<div
|
|
55
|
-
id="block"
|
|
56
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive)"
|
|
57
|
-
>
|
|
58
|
-
<span>
|
|
59
|
-
--dx-g-brand-current-button-color-background-inactive:
|
|
60
|
-
<span>--dx-g-brand-service-button-color-background-inactive</span>
|
|
61
|
-
</span>
|
|
62
|
-
</div>
|
|
63
|
-
<div
|
|
64
|
-
id="block"
|
|
65
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive-hover)"
|
|
66
|
-
>
|
|
67
|
-
<span>
|
|
68
|
-
--dx-g-brand-current-button-color-background-inactive-hover:
|
|
69
|
-
<span>--dx-g-brand-service-button-color-background-inactive-hover</span>
|
|
70
|
-
</span>
|
|
71
|
-
</div>
|
|
72
|
-
<div
|
|
73
|
-
id="block"
|
|
74
|
-
style="background: var(--dx-g-brand-current-button-color-background-active)"
|
|
75
|
-
>
|
|
76
|
-
<span>
|
|
77
|
-
--dx-g-brand-current-button-color-background-active:
|
|
78
|
-
<span>--dx-g-brand-service-button-color-background-active</span>
|
|
79
|
-
</span>
|
|
80
|
-
</div>
|
|
81
|
-
<div
|
|
82
|
-
id="block"
|
|
83
|
-
style="background: var(--dx-g-brand-current-color-border)"
|
|
84
|
-
>
|
|
85
|
-
<span>
|
|
86
|
-
--dx-g-brand-current-color-border:
|
|
87
|
-
<span>--dx-g-brand-service-color-border</span>
|
|
88
|
-
</span>
|
|
89
|
-
</div>
|
|
90
|
-
<div
|
|
91
|
-
id="block"
|
|
92
|
-
style="background: var(--dx-g-brand-current-color-border-2)"
|
|
93
|
-
>
|
|
94
|
-
<span>
|
|
95
|
-
--dx-g-brand-current-color-border-2:
|
|
96
|
-
<span>--dx-g-brand-service-color-border-2</span>
|
|
97
|
-
</span>
|
|
98
|
-
</div>
|
|
99
|
-
</dx-brand-theme-provider>`;
|
|
100
|
-
|
|
101
|
-
// prettier-ignore
|
|
102
|
-
export const Partners = () => html` ${style()}
|
|
103
|
-
<dx-brand-theme-provider brand="partners">
|
|
104
|
-
<div id="block" style="background: var(--dx-g-brand-current-color)">
|
|
105
|
-
<span>
|
|
106
|
-
--dx-g-brand-current-color:
|
|
107
|
-
<span>--dx-g-brand-partners-color</span>
|
|
108
|
-
</span>
|
|
109
|
-
</div>
|
|
110
|
-
<div
|
|
111
|
-
id="block"
|
|
112
|
-
style="background: var(--dx-g-brand-current-color-background)"
|
|
113
|
-
>
|
|
114
|
-
<span>
|
|
115
|
-
--dx-g-brand-current-color-background:
|
|
116
|
-
<span>--dx-g-brand-partners-color-background</span>
|
|
117
|
-
</span>
|
|
118
|
-
</div>
|
|
119
|
-
<div
|
|
120
|
-
id="block"
|
|
121
|
-
style="background: var(--dx-g-brand-current-color-background-2)"
|
|
122
|
-
>
|
|
123
|
-
<span>
|
|
124
|
-
--dx-g-brand-current-color-background-2:
|
|
125
|
-
<span>--dx-g-brand-partners-color-background-2</span>
|
|
126
|
-
</span>
|
|
127
|
-
</div>
|
|
128
|
-
<div
|
|
129
|
-
id="block"
|
|
130
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive)"
|
|
131
|
-
>
|
|
132
|
-
<span>
|
|
133
|
-
--dx-g-brand-current-button-color-background-inactive:
|
|
134
|
-
<span>--dx-g-brand-partners-button-color-background-inactive</span>
|
|
135
|
-
</span>
|
|
136
|
-
</div>
|
|
137
|
-
<div
|
|
138
|
-
id="block"
|
|
139
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive-hover)"
|
|
140
|
-
>
|
|
141
|
-
<span>
|
|
142
|
-
--dx-g-brand-current-button-color-background-inactive-hover:
|
|
143
|
-
<span>--dx-g-brand-partners-button-color-background-inactive-hover</span>
|
|
144
|
-
</span>
|
|
145
|
-
</div>
|
|
146
|
-
<div
|
|
147
|
-
id="block"
|
|
148
|
-
style="background: var(--dx-g-brand-current-button-color-background-active)"
|
|
149
|
-
>
|
|
150
|
-
<span>
|
|
151
|
-
--dx-g-brand-current-button-color-background-active:
|
|
152
|
-
<span>--dx-g-brand-partners-button-color-background-active</span>
|
|
153
|
-
</span>
|
|
154
|
-
</div>
|
|
155
|
-
<div
|
|
156
|
-
id="block"
|
|
157
|
-
style="background: var(--dx-g-brand-current-color-border)"
|
|
158
|
-
>
|
|
159
|
-
<span>
|
|
160
|
-
--dx-g-brand-current-color-border:
|
|
161
|
-
<span>--dx-g-brand-partners-color-border</span>
|
|
162
|
-
</span>
|
|
163
|
-
</div>
|
|
164
|
-
<div
|
|
165
|
-
id="block"
|
|
166
|
-
style="background: var(--dx-g-brand-current-color-border-2)"
|
|
167
|
-
>
|
|
168
|
-
<span>
|
|
169
|
-
--dx-g-brand-current-color-border-2:
|
|
170
|
-
<span>--dx-g-brand-partners-color-border-2</span>
|
|
171
|
-
</span>
|
|
172
|
-
</div>
|
|
173
|
-
</dx-brand-theme-provider>`;
|
|
174
|
-
|
|
175
|
-
// prettier-ignore
|
|
176
|
-
export const Industries = () => html` ${style()}
|
|
177
|
-
<dx-brand-theme-provider brand="industries">
|
|
178
|
-
<div id="block" style="background: var(--dx-g-brand-current-color)">
|
|
179
|
-
<span>
|
|
180
|
-
--dx-g-brand-current-color:
|
|
181
|
-
<span>--dx-g-brand-industries-color</span>
|
|
182
|
-
</span>
|
|
183
|
-
</div>
|
|
184
|
-
<div
|
|
185
|
-
id="block"
|
|
186
|
-
style="background: var(--dx-g-brand-current-color-background)"
|
|
187
|
-
>
|
|
188
|
-
<span>
|
|
189
|
-
--dx-g-brand-current-color-background:
|
|
190
|
-
<span>--dx-g-brand-industries-color-background</span>
|
|
191
|
-
</span>
|
|
192
|
-
</div>
|
|
193
|
-
<div
|
|
194
|
-
id="block"
|
|
195
|
-
style="background: var(--dx-g-brand-current-color-background-2)"
|
|
196
|
-
>
|
|
197
|
-
<span>
|
|
198
|
-
--dx-g-brand-current-color-background-2:
|
|
199
|
-
<span>--dx-g-brand-industries-color-background-2</span>
|
|
200
|
-
</span>
|
|
201
|
-
</div>
|
|
202
|
-
<div
|
|
203
|
-
id="block"
|
|
204
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive)"
|
|
205
|
-
>
|
|
206
|
-
<span>
|
|
207
|
-
--dx-g-brand-current-button-color-background-inactive:
|
|
208
|
-
<span>--dx-g-brand-industries-button-color-background-inactive</span>
|
|
209
|
-
</span>
|
|
210
|
-
</div>
|
|
211
|
-
<div
|
|
212
|
-
id="block"
|
|
213
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive-hover)"
|
|
214
|
-
>
|
|
215
|
-
<span>
|
|
216
|
-
--dx-g-brand-current-button-color-background-inactive-hover:
|
|
217
|
-
<span>--dx-g-brand-industries-button-color-background-inactive-hover</span>
|
|
218
|
-
</span>
|
|
219
|
-
</div>
|
|
220
|
-
<div
|
|
221
|
-
id="block"
|
|
222
|
-
style="background: var(--dx-g-brand-current-button-color-background-active)"
|
|
223
|
-
>
|
|
224
|
-
<span>
|
|
225
|
-
--dx-g-brand-current-button-color-background-active:
|
|
226
|
-
<span>--dx-g-brand-industries-button-color-background-active</span>
|
|
227
|
-
</span>
|
|
228
|
-
</div>
|
|
229
|
-
<div
|
|
230
|
-
id="block"
|
|
231
|
-
style="background: var(--dx-g-brand-current-color-border)"
|
|
232
|
-
>
|
|
233
|
-
<span>
|
|
234
|
-
--dx-g-brand-current-color-border:
|
|
235
|
-
<span>--dx-g-brand-industries-color-border</span>
|
|
236
|
-
</span>
|
|
237
|
-
</div>
|
|
238
|
-
<div
|
|
239
|
-
id="block"
|
|
240
|
-
style="background: var(--dx-g-brand-current-color-border-2)"
|
|
241
|
-
>
|
|
242
|
-
<span>
|
|
243
|
-
--dx-g-brand-current-color-border-2:
|
|
244
|
-
<span>--dx-g-brand-industries-color-border-2</span>
|
|
245
|
-
</span>
|
|
246
|
-
</div>
|
|
247
|
-
</dx-brand-theme-provider>`;
|
|
248
|
-
|
|
249
|
-
// prettier-ignore
|
|
250
|
-
export const Sales = () => html ` ${style()}
|
|
251
|
-
<dx-brand-theme-provider>
|
|
252
|
-
<div id="block" style="background: var(--dx-g-brand-current-color)">
|
|
253
|
-
<span>
|
|
254
|
-
--dx-g-brand-current-color:
|
|
255
|
-
<span>--dx-g-brand-sales-color</span>
|
|
256
|
-
</span>
|
|
257
|
-
</div>
|
|
258
|
-
<div
|
|
259
|
-
id="block"
|
|
260
|
-
style="background: var(--dx-g-brand-current-color-background)"
|
|
261
|
-
>
|
|
262
|
-
<span>
|
|
263
|
-
--dx-g-brand-current-color-background:
|
|
264
|
-
<span>--dx-g-brand-sales-color-background</span>
|
|
265
|
-
</span>
|
|
266
|
-
</div>
|
|
267
|
-
<div
|
|
268
|
-
id="block"
|
|
269
|
-
style="background: var(--dx-g-brand-current-color-background-2)"
|
|
270
|
-
>
|
|
271
|
-
<span>
|
|
272
|
-
--dx-g-brand-current-color-background-2:
|
|
273
|
-
<span>--dx-g-brand-sales-color-background-2</span>
|
|
274
|
-
</span>
|
|
275
|
-
</div>
|
|
276
|
-
<div
|
|
277
|
-
id="block"
|
|
278
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive)"
|
|
279
|
-
>
|
|
280
|
-
<span>
|
|
281
|
-
--dx-g-brand-current-button-color-background-inactive:
|
|
282
|
-
<span>--dx-g-brand-sales-button-color-background-inactive</span>
|
|
283
|
-
</span>
|
|
284
|
-
</div>
|
|
285
|
-
<div
|
|
286
|
-
id="block"
|
|
287
|
-
style="background: var(--dx-g-brand-current-button-color-background-inactive-hover)"
|
|
288
|
-
>
|
|
289
|
-
<span>
|
|
290
|
-
--dx-g-brand-current-button-color-background-inactive-hover:
|
|
291
|
-
<span>--dx-g-brand-sales-button-color-background-inactive-hover</span>
|
|
292
|
-
</span>
|
|
293
|
-
</div>
|
|
294
|
-
<div
|
|
295
|
-
id="block"
|
|
296
|
-
style="background: var(--dx-g-brand-current-button-color-background-active)"
|
|
297
|
-
>
|
|
298
|
-
<span>
|
|
299
|
-
--dx-g-brand-current-button-color-background-active:
|
|
300
|
-
<span>--dx-g-brand-sales-button-color-background-active</span>
|
|
301
|
-
</span>
|
|
302
|
-
</div>
|
|
303
|
-
<div
|
|
304
|
-
id="block"
|
|
305
|
-
style="background: var(--dx-g-brand-current-color-border)"
|
|
306
|
-
>
|
|
307
|
-
<span>
|
|
308
|
-
--dx-g-brand-current-color-border:
|
|
309
|
-
<span>--dx-g-brand-sales-color-border</span>
|
|
310
|
-
</span>
|
|
311
|
-
</div>
|
|
312
|
-
<div
|
|
313
|
-
id="block"
|
|
314
|
-
style="background: var(--dx-g-brand-current-color-border-2)"
|
|
315
|
-
>
|
|
316
|
-
<span>
|
|
317
|
-
--dx-g-brand-current-color-border-2:
|
|
318
|
-
<span>--dx-g-brand-sales-color-border-2</span>
|
|
319
|
-
</span>
|
|
320
|
-
</div>
|
|
321
|
-
</dx-brand-theme-provider>`;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import Breadcrumbs from "dx/breadcrumbs";
|
|
2
|
-
import Dropdown from "dx/dropdown";
|
|
3
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
4
|
-
import { mockPathname, mockBreadcrumbs, mockNavItems } from "./mockProps";
|
|
5
|
-
|
|
6
|
-
const TAG = "dx-breadcrumbs";
|
|
7
|
-
const render = createRenderComponent(TAG, Breadcrumbs);
|
|
8
|
-
|
|
9
|
-
describe(TAG, () => {
|
|
10
|
-
it("renders the correct number of crumbs", () => {
|
|
11
|
-
const expectedOptionsLength = mockBreadcrumbs.length - 1;
|
|
12
|
-
|
|
13
|
-
const element = render({ breadcrumbs: mockBreadcrumbs });
|
|
14
|
-
|
|
15
|
-
const navElement: HTMLElement = element.shadowRoot.querySelector("nav");
|
|
16
|
-
expect(navElement).not.toBeNull();
|
|
17
|
-
expect(navElement.classList).toHaveLength(0);
|
|
18
|
-
|
|
19
|
-
const breadcrumbs: Array<HTMLElement> =
|
|
20
|
-
element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
21
|
-
const { length } = breadcrumbs;
|
|
22
|
-
expect(breadcrumbs).toHaveLength(length);
|
|
23
|
-
expect(
|
|
24
|
-
Array.from(breadcrumbs)
|
|
25
|
-
.splice(0, length - 1)
|
|
26
|
-
.every(({ tagName }) => tagName === "A")
|
|
27
|
-
).toBe(true);
|
|
28
|
-
expect(breadcrumbs[length - 1].tagName).toBe("SPAN");
|
|
29
|
-
|
|
30
|
-
const dropdown: Dropdown =
|
|
31
|
-
element.shadowRoot.querySelector("dx-dropdown");
|
|
32
|
-
expect(dropdown).not.toBeNull();
|
|
33
|
-
expect(dropdown.options).toHaveLength(expectedOptionsLength);
|
|
34
|
-
|
|
35
|
-
dropdown.options.forEach((option, index) => {
|
|
36
|
-
const { href, label } = mockBreadcrumbs[index];
|
|
37
|
-
expect(option.label).toBe(label);
|
|
38
|
-
expect(option.id).toBe(href);
|
|
39
|
-
expect(option.link?.href).toBe(href);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return expect(element).toBeAccessible();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("renders with current location hidden", () => {
|
|
46
|
-
const element = render({
|
|
47
|
-
breadcrumbs: mockBreadcrumbs,
|
|
48
|
-
hideCurrentLocation: true
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const navElement: HTMLElement = element.shadowRoot.querySelector("nav");
|
|
52
|
-
expect(navElement).not.toBeNull();
|
|
53
|
-
expect(navElement.classList).toHaveLength(1);
|
|
54
|
-
expect(navElement.classList).toContain("hide-current-location");
|
|
55
|
-
|
|
56
|
-
const breadcrumbs: Array<HTMLElement> =
|
|
57
|
-
element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
58
|
-
expect(breadcrumbs).toHaveLength(mockBreadcrumbs.length - 1);
|
|
59
|
-
expect(
|
|
60
|
-
Array.from(breadcrumbs).every(({ tagName }) => tagName === "A")
|
|
61
|
-
).toBe(true);
|
|
62
|
-
|
|
63
|
-
return expect(element).toBeAccessible();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("renders with state-long class when passing truncate as true and has to many breadcrumbs", () => {
|
|
67
|
-
const element = render({
|
|
68
|
-
breadcrumbs: mockBreadcrumbs,
|
|
69
|
-
truncate: true
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const navElement: HTMLElement = element.shadowRoot.querySelector("nav");
|
|
73
|
-
expect(navElement).not.toBeNull();
|
|
74
|
-
expect(navElement.classList).toHaveLength(1);
|
|
75
|
-
expect(navElement.classList[0]).toBe("state-long");
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("sets base href and title correctly", () => {
|
|
79
|
-
const baseHref = "/test";
|
|
80
|
-
const title = "testtitle";
|
|
81
|
-
const element = render({ baseHref, title, logo: true });
|
|
82
|
-
|
|
83
|
-
const logo = element.shadowRoot.querySelector("dx-logo");
|
|
84
|
-
expect(logo).not.toBeNull();
|
|
85
|
-
expect(logo.href).toEqual(baseHref);
|
|
86
|
-
expect(logo.label).toEqual(title);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it("if not given breadcrumbs, parses the pathname and renders the correct number of links, each with the correct href", () => {
|
|
90
|
-
const element = render({
|
|
91
|
-
navItems: mockNavItems,
|
|
92
|
-
pathname: mockPathname
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const breadcrumbs = element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
96
|
-
expect(breadcrumbs.length).toEqual(mockBreadcrumbs.length);
|
|
97
|
-
|
|
98
|
-
breadcrumbs.forEach((breadcrumb: HTMLLinkElement, i: number) => {
|
|
99
|
-
const mockBreadcrumb = mockBreadcrumbs[i];
|
|
100
|
-
if (i < breadcrumbs.length - 1) {
|
|
101
|
-
const href = breadcrumb.getAttribute("href");
|
|
102
|
-
expect(breadcrumb.tagName).toEqual("A");
|
|
103
|
-
expect(href).toEqual(mockBreadcrumb.href);
|
|
104
|
-
} else {
|
|
105
|
-
expect(breadcrumb.tagName).toEqual("SPAN");
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
return expect(element).toBeAccessible();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("renders no links or spans when given an empty pathname", () => {
|
|
112
|
-
const element = render({ pathname: "/" });
|
|
113
|
-
|
|
114
|
-
const els = element.shadowRoot.querySelectorAll(
|
|
115
|
-
".breadcrumb .breadcrumb-slash span"
|
|
116
|
-
);
|
|
117
|
-
expect(els.length).toEqual(0);
|
|
118
|
-
|
|
119
|
-
expect(element.shadowRoot.querySelector("dx-dropdown")).toBeNull();
|
|
120
|
-
return expect(element).toBeAccessible();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("Successfully sets a breadcrumb label", () => {
|
|
124
|
-
const element = render({
|
|
125
|
-
pathname: mockPathname,
|
|
126
|
-
navItems: mockNavItems
|
|
127
|
-
});
|
|
128
|
-
const breadcrumbs = element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
129
|
-
expect(breadcrumbs[breadcrumbs.length - 1].textContent).toEqual(
|
|
130
|
-
"New Label"
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("renders correctly with duplicate path segments", async () => {
|
|
135
|
-
const element = render({ pathname: "/home/home/home.html" });
|
|
136
|
-
|
|
137
|
-
const breadcrumbs = element.shadowRoot.querySelectorAll(".breadcrumb");
|
|
138
|
-
expect(breadcrumbs.length).toEqual(3);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Option } from "typings/custom";
|
|
2
|
-
|
|
3
|
-
export const mockPathname = "/piece1/piece2/piece3/piece4/piece5";
|
|
4
|
-
|
|
5
|
-
export const mockBreadcrumbs = [
|
|
6
|
-
{ href: "/piece1", label: "Piece 1" },
|
|
7
|
-
{ href: "/piece1/piece2", label: "Piece 2" },
|
|
8
|
-
{ href: "/piece1/piece2/piece3", label: "Piece 3" },
|
|
9
|
-
{ href: "/piece1/piece2/piece3/piece4", label: "Piece 4" },
|
|
10
|
-
{ href: "/piece1/piece2/piece3/piece4/piece5", label: "Piece 5" }
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
export const mockNavItems: Option[] = [
|
|
14
|
-
{ id: "1", label: "Label 1" },
|
|
15
|
-
{ id: "2", label: "Label 2" },
|
|
16
|
-
{
|
|
17
|
-
id: "3",
|
|
18
|
-
label: "New Label",
|
|
19
|
-
link: { href: mockPathname, target: "_blank" }
|
|
20
|
-
},
|
|
21
|
-
{ id: "4", label: "Label 4" },
|
|
22
|
-
{
|
|
23
|
-
id: "5",
|
|
24
|
-
label: "Label 5",
|
|
25
|
-
link: { href: "https://www.heroku.com/", target: "_parent" },
|
|
26
|
-
options: [{ id: "5.1", label: "Label 5.1", options: [] }]
|
|
27
|
-
}
|
|
28
|
-
];
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
import { mockBreadcrumbs } from "./__tests__/mockProps";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "dx/dx-breadcrumbs",
|
|
6
|
-
component: "dx-breadcrumbs",
|
|
7
|
-
argTypes: {
|
|
8
|
-
breadcrumbs: {
|
|
9
|
-
defaultValue: JSON.stringify(mockBreadcrumbs),
|
|
10
|
-
control: {
|
|
11
|
-
type: "text"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Base = (args: any) => html`
|
|
18
|
-
<dx-breadcrumbs breadcrumbs="${args.breadcrumbs}"></dx-breadcrumbs>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const HideCurrentLocation = (args: any) => html`
|
|
22
|
-
<dx-breadcrumbs
|
|
23
|
-
breadcrumbs="${args.breadcrumbs}"
|
|
24
|
-
hide-current-location="true"
|
|
25
|
-
truncate="true"
|
|
26
|
-
></dx-breadcrumbs>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const autoBreadcrumbs = () => html`
|
|
30
|
-
<dx-breadcrumbs logo="true"></dx-breadcrumbs>
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
export const WithLogo = (args: any) => html`
|
|
34
|
-
<dx-breadcrumbs
|
|
35
|
-
breadcrumbs="${args.breadcrumbs}"
|
|
36
|
-
logo="true"
|
|
37
|
-
truncate="true"
|
|
38
|
-
></dx-breadcrumbs>
|
|
39
|
-
`;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import Button from "dx/button";
|
|
2
|
-
import ButtonTest from "test-components/buttonTest";
|
|
3
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
4
|
-
|
|
5
|
-
const TAG = "dx-button";
|
|
6
|
-
const render = createRenderComponent(TAG, Button);
|
|
7
|
-
const renderSlotted = createRenderComponent("dx-button-test", ButtonTest);
|
|
8
|
-
|
|
9
|
-
describe(TAG, () => {
|
|
10
|
-
it("renders an empty button element with no icon", () => {
|
|
11
|
-
const element = render({ ariaLabel: "Default" });
|
|
12
|
-
const buttonEl = element.shadowRoot.querySelector("button");
|
|
13
|
-
const iconEl = element.shadowRoot.querySelector("dx-icon");
|
|
14
|
-
expect(buttonEl).not.toBeNull();
|
|
15
|
-
expect(iconEl).toBeNull();
|
|
16
|
-
return expect(element).toBeAccessible();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("renders button defaults if no overrides are specified", () => {
|
|
20
|
-
const element = render({ ariaLabel: "Default" });
|
|
21
|
-
|
|
22
|
-
const buttonEl = element.shadowRoot.querySelector("button");
|
|
23
|
-
const buttonElClasses = buttonEl.getAttribute("class");
|
|
24
|
-
expect(buttonEl.getAttribute("disabled")).toBeFalsy();
|
|
25
|
-
expect(buttonEl.getAttribute("type")).toBe("button");
|
|
26
|
-
expect(buttonElClasses).toContain("variant_primary");
|
|
27
|
-
expect(buttonElClasses).toContain("size-small");
|
|
28
|
-
expect(buttonElClasses).not.toContain("style-full");
|
|
29
|
-
expect(buttonElClasses).not.toContain("style-icon");
|
|
30
|
-
|
|
31
|
-
return expect(element).toBeAccessible();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("is accessible when the slot is used", () => {
|
|
35
|
-
const element = renderSlotted();
|
|
36
|
-
|
|
37
|
-
return expect(element).toBeAccessible();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("can focus itself", () => {
|
|
41
|
-
const element = render({ ariaLabel: "Default" });
|
|
42
|
-
|
|
43
|
-
const buttonEl = element.shadowRoot.querySelector("button");
|
|
44
|
-
|
|
45
|
-
element.focus();
|
|
46
|
-
|
|
47
|
-
expect(element.shadowRoot.activeElement.isSameNode(buttonEl)).toEqual(
|
|
48
|
-
true
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("only shows a loading message when the component is in `loading` state", () => {
|
|
53
|
-
const element = render({ loading: true, iconSymbol: "search" });
|
|
54
|
-
const loadingEl = element.shadowRoot.querySelector(
|
|
55
|
-
".temp-loading-message"
|
|
56
|
-
);
|
|
57
|
-
expect(loadingEl).not.toBeNull();
|
|
58
|
-
const spans = element.shadowRoot.querySelectorAll("span");
|
|
59
|
-
expect(spans.length).toEqual(1);
|
|
60
|
-
const icon = element.shadowRoot.querySelector("dx-icon");
|
|
61
|
-
expect(icon).toBeNull();
|
|
62
|
-
return expect(element).toBeAccessible();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("can display an icon with the expected settings", () => {
|
|
66
|
-
const iconSize = "large";
|
|
67
|
-
const iconSymbol = "automate";
|
|
68
|
-
const ariaLabel = "Automate";
|
|
69
|
-
const element = render({
|
|
70
|
-
ariaLabel,
|
|
71
|
-
iconSize,
|
|
72
|
-
iconSymbol,
|
|
73
|
-
loading: false
|
|
74
|
-
});
|
|
75
|
-
const iconEl = element.shadowRoot.querySelector("dx-icon");
|
|
76
|
-
expect(iconEl).not.toBeNull();
|
|
77
|
-
expect(iconEl.sprite).toBe("utility");
|
|
78
|
-
expect(iconEl.size).toBe(iconSize);
|
|
79
|
-
expect(iconEl.symbol).toBe(iconSymbol);
|
|
80
|
-
return expect(element).toBeAccessible();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("displays a link when given an href", () => {
|
|
84
|
-
const element = render({
|
|
85
|
-
ariaLabel: "Google",
|
|
86
|
-
href: "https://www.google.com"
|
|
87
|
-
});
|
|
88
|
-
expect(element.shadowRoot.querySelector("a")).toBeDefined();
|
|
89
|
-
expect(element.shadowRoot.querySelector("button")).toBeFalsy();
|
|
90
|
-
|
|
91
|
-
return expect(element).toBeAccessible();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("applies correct font family class", () => {
|
|
95
|
-
const element = render({ ariaLabel: "Default" });
|
|
96
|
-
const buttonEl = element.shadowRoot.querySelector(".button");
|
|
97
|
-
const className = buttonEl.getAttribute("class");
|
|
98
|
-
expect(className.includes("font-display")).toBeTruthy();
|
|
99
|
-
|
|
100
|
-
const elementOther = render({ font: "sans" });
|
|
101
|
-
const buttonElOther = elementOther.shadowRoot.querySelector(".button");
|
|
102
|
-
const classNameOther = buttonElOther.getAttribute("class");
|
|
103
|
-
expect(classNameOther.includes("font-sans")).toBeTruthy();
|
|
104
|
-
|
|
105
|
-
return expect(element).toBeAccessible();
|
|
106
|
-
});
|
|
107
|
-
});
|