@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,172 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
import {
|
|
3
|
-
mockPropsDevelopers,
|
|
4
|
-
mockPropsEmployees,
|
|
5
|
-
mockPropsMarketing,
|
|
6
|
-
mockPropsNoNavigation,
|
|
7
|
-
mockPropsPartners,
|
|
8
|
-
mockPropsCommerce,
|
|
9
|
-
mockPropsSales,
|
|
10
|
-
mockPropsSuccess,
|
|
11
|
-
mockPropsIntegration,
|
|
12
|
-
mockPropsPlatform,
|
|
13
|
-
mockPropsIndustries,
|
|
14
|
-
mockPropsLearning,
|
|
15
|
-
mockPropsService,
|
|
16
|
-
mockPropsAnalytics
|
|
17
|
-
} from "./__tests__/mockProps";
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
title: "dx/dx-header",
|
|
21
|
-
component: "dx-header"
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
window.addEventListener("click", (e: MouseEvent) => {
|
|
25
|
-
const link = e
|
|
26
|
-
.composedPath()
|
|
27
|
-
.find((el: EventTarget) =>
|
|
28
|
-
el
|
|
29
|
-
? (<HTMLElement>el).tagName === "A" &&
|
|
30
|
-
(<HTMLElement>el).getAttribute("target") === null
|
|
31
|
-
: false
|
|
32
|
-
);
|
|
33
|
-
if (link) {
|
|
34
|
-
const header = document.querySelector("dx-header"); // eslint-disable-line
|
|
35
|
-
if (!header) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
const href = (<HTMLElement>link).getAttribute("href");
|
|
40
|
-
const fakeUrl = document.querySelector(".fake-url"); // eslint-disable-line
|
|
41
|
-
if (fakeUrl) {
|
|
42
|
-
fakeUrl.textContent = href;
|
|
43
|
-
}
|
|
44
|
-
if (href && !href.includes("http")) {
|
|
45
|
-
//@ts-ignore
|
|
46
|
-
header.href = `https://localhost:6006${href}`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// prettier-ignore
|
|
52
|
-
const styles = () => html `
|
|
53
|
-
<style>
|
|
54
|
-
body {
|
|
55
|
-
padding: 0 !important;
|
|
56
|
-
}
|
|
57
|
-
.fake-url {
|
|
58
|
-
padding: 8px;
|
|
59
|
-
font-size: 12px;
|
|
60
|
-
color: white;
|
|
61
|
-
background: grey;
|
|
62
|
-
word-break: break-word;
|
|
63
|
-
}
|
|
64
|
-
</style>`;
|
|
65
|
-
|
|
66
|
-
const headerStoryGenerator = (
|
|
67
|
-
mockProps: any,
|
|
68
|
-
brand: string,
|
|
69
|
-
subtitle: string
|
|
70
|
-
) => html` ${styles()}
|
|
71
|
-
<div class="fake-url">/</div>
|
|
72
|
-
<dx-header
|
|
73
|
-
coveo-organization-id="${mockProps.coveoOrganizationId}"
|
|
74
|
-
coveo-public-access-token="${mockProps.coveoPublicAccessToken}"
|
|
75
|
-
coveo-search-pipeline="${mockProps.coveoSearchPipeline}"
|
|
76
|
-
coveo-search-hub="${mockProps.coveoSearchHub}"
|
|
77
|
-
subtitle="${subtitle}"
|
|
78
|
-
nav-items="${mockProps.navItems}"
|
|
79
|
-
versions="${mockProps.versions}"
|
|
80
|
-
version="1"
|
|
81
|
-
bail-href="/quip-dev-center"
|
|
82
|
-
bail-label="Quip Development Center"
|
|
83
|
-
brand="${brand}"
|
|
84
|
-
breadcrumbs="${mockProps.breadcrumbs}"
|
|
85
|
-
signup-link="${mockProps.signupLink}"
|
|
86
|
-
banner-markup="${mockProps.bannerMarkup}"
|
|
87
|
-
></dx-header>`;
|
|
88
|
-
|
|
89
|
-
// ALL STORIES
|
|
90
|
-
|
|
91
|
-
// prettier-ignore
|
|
92
|
-
export const Developers = ({navItems, coveoOrganizationId, coveoPublicAccessToken, coveoSearchPipeline, coveoSearchHub}: any) => html `
|
|
93
|
-
${styles()}
|
|
94
|
-
<div class="fake-url"> / </div>
|
|
95
|
-
<dx-header
|
|
96
|
-
signup-link='https://www.google.com'
|
|
97
|
-
login-link='https://www.google.com'
|
|
98
|
-
coveo-organization-id='${coveoOrganizationId}'
|
|
99
|
-
coveo-public-access-token='${coveoPublicAccessToken}'
|
|
100
|
-
coveo-search-pipeline='${coveoSearchPipeline}'
|
|
101
|
-
coveo-search-hub='${coveoSearchHub}'
|
|
102
|
-
subtitle='Developers'
|
|
103
|
-
nav-items='${navItems}'
|
|
104
|
-
></dx-header>`;
|
|
105
|
-
Developers.args = mockPropsDevelopers;
|
|
106
|
-
|
|
107
|
-
// prettier-ignore
|
|
108
|
-
export const ConfigurationNoSearch = ({ navItems }: any) => html `
|
|
109
|
-
${styles()}
|
|
110
|
-
<div class="fake-url"> / </div>
|
|
111
|
-
<dx-header
|
|
112
|
-
subtitle='Developers'
|
|
113
|
-
nav-items='${navItems}'
|
|
114
|
-
></dx-header>`;
|
|
115
|
-
ConfigurationNoSearch.args = mockPropsDevelopers;
|
|
116
|
-
|
|
117
|
-
export const ConfigurationNoNavigation = () =>
|
|
118
|
-
headerStoryGenerator(mockPropsNoNavigation, "default", "Docs");
|
|
119
|
-
|
|
120
|
-
// BRAND STORIES
|
|
121
|
-
export const Employees = () =>
|
|
122
|
-
headerStoryGenerator(mockPropsEmployees, "employees", "Employees");
|
|
123
|
-
export const Marketing = () =>
|
|
124
|
-
headerStoryGenerator(mockPropsMarketing, "marketing", "Marketing");
|
|
125
|
-
export const Partners = () =>
|
|
126
|
-
headerStoryGenerator(mockPropsPartners, "partners", "Partners");
|
|
127
|
-
export const Commerce = () =>
|
|
128
|
-
headerStoryGenerator(mockPropsCommerce, "commerce", "Commerce");
|
|
129
|
-
export const Sales = () =>
|
|
130
|
-
headerStoryGenerator(mockPropsSales, "sales", "Sales");
|
|
131
|
-
export const Success = () =>
|
|
132
|
-
headerStoryGenerator(mockPropsSuccess, "success", "Success");
|
|
133
|
-
export const Integration = () =>
|
|
134
|
-
headerStoryGenerator(mockPropsIntegration, "integration", "Integration");
|
|
135
|
-
export const Platform = () =>
|
|
136
|
-
headerStoryGenerator(mockPropsPlatform, "platform", "Platform");
|
|
137
|
-
export const Industries = () =>
|
|
138
|
-
headerStoryGenerator(mockPropsIndustries, "industries", "Industries");
|
|
139
|
-
export const Learning = () =>
|
|
140
|
-
headerStoryGenerator(mockPropsLearning, "learning", "Learning");
|
|
141
|
-
export const Service = () =>
|
|
142
|
-
headerStoryGenerator(mockPropsService, "service", "Service");
|
|
143
|
-
export const Analytics = () =>
|
|
144
|
-
headerStoryGenerator(mockPropsAnalytics, "analytics", "Analytics");
|
|
145
|
-
|
|
146
|
-
export const MarketingWithoutSignup = () =>
|
|
147
|
-
headerStoryGenerator(
|
|
148
|
-
{ ...mockPropsMarketing, signupLink: "" },
|
|
149
|
-
"marketing",
|
|
150
|
-
"Marketing"
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
export const MarketingWithCustomBannerText = () =>
|
|
154
|
-
headerStoryGenerator(
|
|
155
|
-
{
|
|
156
|
-
...mockPropsMarketing,
|
|
157
|
-
bannerMarkup:
|
|
158
|
-
'Salesforce Subscription Management API ("the API") is available as a developer preview. The API is not generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All components of the API including request names, parameters, objects, and fields are subject to change or deprecation at any time, with or without notice. Do not use the API with real data or in a production environment.'
|
|
159
|
-
},
|
|
160
|
-
"marketing",
|
|
161
|
-
"Marketing"
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
export const MarketingWithoutBanner = () =>
|
|
165
|
-
headerStoryGenerator(
|
|
166
|
-
{
|
|
167
|
-
...mockPropsMarketing,
|
|
168
|
-
bannerMarkup: ""
|
|
169
|
-
},
|
|
170
|
-
"marketing",
|
|
171
|
-
"Marketing"
|
|
172
|
-
);
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import HeaderMobileNavMenu from "dx/headerMobileNavMenu";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
import { getOptionsCount } from "utils-internal/options";
|
|
4
|
-
import navItems from "../../header/__tests__/mockNavDevelopers";
|
|
5
|
-
|
|
6
|
-
const TAG = "dx-header-mobile-nav-menu";
|
|
7
|
-
const render = createRenderComponent(TAG, HeaderMobileNavMenu);
|
|
8
|
-
|
|
9
|
-
const navItemsCount = getOptionsCount(navItems);
|
|
10
|
-
|
|
11
|
-
describe(TAG, () => {
|
|
12
|
-
it("renders defaulted to closed", () => {
|
|
13
|
-
const element = render({ navItems });
|
|
14
|
-
|
|
15
|
-
const el = element.shadowRoot.querySelector("nav");
|
|
16
|
-
|
|
17
|
-
expect(el).not.toBeNull();
|
|
18
|
-
expect(el.className).toContain("state-closed");
|
|
19
|
-
|
|
20
|
-
return expect(element).toBeAccessible();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("removes closed class when open and has no menu items open by default", () => {
|
|
24
|
-
const element = render({ navItems, open: true });
|
|
25
|
-
|
|
26
|
-
const el = element.shadowRoot.querySelector("nav");
|
|
27
|
-
const menuItemEl = element.shadowRoot.querySelector(
|
|
28
|
-
"nav-menu_item.state-open"
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
expect(el.className).not.toContain("state-closed");
|
|
32
|
-
expect(menuItemEl).toBeNull();
|
|
33
|
-
|
|
34
|
-
return expect(element).toBeAccessible();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("renders the corect number of li", () => {
|
|
38
|
-
const element = render({ navItems, open: true });
|
|
39
|
-
const lis = element.shadowRoot.querySelectorAll("li");
|
|
40
|
-
expect(lis.length).toEqual(navItems.length);
|
|
41
|
-
return expect(element).toBeAccessible();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("renders the corect number of links", () => {
|
|
45
|
-
const element = render({ navItems, open: true });
|
|
46
|
-
const links = element.shadowRoot.querySelectorAll(
|
|
47
|
-
"a, dx-header-mobile-nav-menu-option"
|
|
48
|
-
);
|
|
49
|
-
expect(links.length).toEqual(navItemsCount);
|
|
50
|
-
return expect(element).toBeAccessible();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("applies active class to option href that matches the current pathname", () => {
|
|
54
|
-
const element = render({
|
|
55
|
-
navItems,
|
|
56
|
-
open: true,
|
|
57
|
-
pathname: "/developers"
|
|
58
|
-
});
|
|
59
|
-
const links = element.shadowRoot.querySelectorAll(
|
|
60
|
-
".nav-menu_item_cta.state-active"
|
|
61
|
-
);
|
|
62
|
-
expect(links.length).toEqual(1);
|
|
63
|
-
expect(links[0].textContent).toEqual(navItems[0].label);
|
|
64
|
-
return expect(element).toBeAccessible();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("applies state-open class to a menu item with options based off of the incoming value", () => {
|
|
68
|
-
const value = "discover";
|
|
69
|
-
const element = render({ navItems, open: true, value });
|
|
70
|
-
|
|
71
|
-
const menuItem = element.shadowRoot.querySelector(
|
|
72
|
-
`li[data-id="${value}"]`
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
expect(menuItem.className).toContain("state-open");
|
|
76
|
-
return expect(element).toBeAccessible();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("fires change with the correct value on click of menuitem with options", () => {
|
|
80
|
-
const id = "discover";
|
|
81
|
-
const onChangeMock = jest.fn();
|
|
82
|
-
const element = render({
|
|
83
|
-
navItems,
|
|
84
|
-
open: true,
|
|
85
|
-
onchange: onChangeMock
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const menuItem = element.shadowRoot.querySelector(
|
|
89
|
-
`button[data-id="${id}"]`
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
menuItem.click();
|
|
93
|
-
|
|
94
|
-
expect(onChangeMock).toHaveBeenCalledTimes(1);
|
|
95
|
-
expect(onChangeMock.mock.calls[0][0].detail).toEqual(id);
|
|
96
|
-
return expect(element).toBeAccessible();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("renders the backdrop div when open and closes nav when clicked", () => {
|
|
100
|
-
const element = render({
|
|
101
|
-
navItems,
|
|
102
|
-
open: true
|
|
103
|
-
});
|
|
104
|
-
const backdropEl = element.shadowRoot.querySelector(`.backdrop`);
|
|
105
|
-
|
|
106
|
-
const onCloseMock = jest.fn();
|
|
107
|
-
element.addEventListener("requestclose", onCloseMock);
|
|
108
|
-
|
|
109
|
-
expect(backdropEl).not.toBeNull();
|
|
110
|
-
|
|
111
|
-
backdropEl.click();
|
|
112
|
-
expect(onCloseMock).toHaveBeenCalledTimes(1);
|
|
113
|
-
|
|
114
|
-
return expect(element).toBeAccessible();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("does not render the backdrop div when closed", () => {
|
|
118
|
-
const element = render({ navItems, open: false });
|
|
119
|
-
const backdropEl = element.shadowRoot.querySelector(`.backdrop`);
|
|
120
|
-
expect(backdropEl).toBeNull();
|
|
121
|
-
return expect(element).toBeAccessible();
|
|
122
|
-
});
|
|
123
|
-
});
|
package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import HeaderMobileNavMenuOption from "dx/headerMobileNavMenuOption";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "dx-header-mobile-nav-menu-option";
|
|
5
|
-
const render = createRenderComponent(TAG, HeaderMobileNavMenuOption);
|
|
6
|
-
|
|
7
|
-
const PROPS = {
|
|
8
|
-
menuLabel: "build",
|
|
9
|
-
itemLabel: "documentation"
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
describe(TAG, () => {
|
|
13
|
-
it("renders a single dx-button component", () => {
|
|
14
|
-
const element = render(PROPS);
|
|
15
|
-
|
|
16
|
-
const button = element.shadowRoot.querySelectorAll("dx-button");
|
|
17
|
-
|
|
18
|
-
expect(button.length).toEqual(1);
|
|
19
|
-
|
|
20
|
-
return expect(element).toBeAccessible();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("fires sendGtm function when button is clicked", () => {
|
|
24
|
-
const sendGtmMock = jest.fn();
|
|
25
|
-
const element = render({
|
|
26
|
-
...PROPS,
|
|
27
|
-
onclick: sendGtmMock
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const button = element.shadowRoot.querySelector("dx-button");
|
|
31
|
-
|
|
32
|
-
button.click();
|
|
33
|
-
|
|
34
|
-
expect(sendGtmMock).toHaveBeenCalled();
|
|
35
|
-
|
|
36
|
-
return expect(element).toBeAccessible();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import HeaderNav from "dx/headerNav";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
import navItems from "../../header/__tests__/mockNavArchitects";
|
|
4
|
-
const TAG = "dx-header-nav";
|
|
5
|
-
|
|
6
|
-
const render = createRenderComponent(TAG, HeaderNav);
|
|
7
|
-
|
|
8
|
-
describe(TAG, () => {
|
|
9
|
-
describe("render", () => {
|
|
10
|
-
it("renders the correct number of nav-list-items", () => {
|
|
11
|
-
const element = render({ navItems });
|
|
12
|
-
|
|
13
|
-
const items = element.shadowRoot.querySelectorAll(".nav-list-item");
|
|
14
|
-
const dropdownItems = element.shadowRoot.querySelectorAll("dx-tab");
|
|
15
|
-
|
|
16
|
-
// items with more options render something different on mobile and desktop whose display is toggled by `display: none;`
|
|
17
|
-
const expectedItemLength =
|
|
18
|
-
navItems.length +
|
|
19
|
-
navItems.filter((app) => !!app.options).length;
|
|
20
|
-
|
|
21
|
-
expect(items.length + dropdownItems.length).toBe(
|
|
22
|
-
expectedItemLength
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return expect(element).toBeAccessible();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe("interactions", () => {
|
|
30
|
-
it("fires requestopennavmenu event when mobile button is clicked", () => {
|
|
31
|
-
const element = render({ navItems });
|
|
32
|
-
const mockOpenNav = jest.fn();
|
|
33
|
-
element.addEventListener("requestopennavmenu", mockOpenNav);
|
|
34
|
-
const navOption: HTMLElement = element.shadowRoot.querySelector(
|
|
35
|
-
"dx-tab.nav-list-item-nav-menu"
|
|
36
|
-
);
|
|
37
|
-
expect(navOption).not.toBeNull();
|
|
38
|
-
navOption.click();
|
|
39
|
-
|
|
40
|
-
expect(mockOpenNav).toBeCalledTimes(1);
|
|
41
|
-
const singleCall = mockOpenNav.mock.calls[0][0];
|
|
42
|
-
expect(singleCall.detail).toBe(
|
|
43
|
-
navItems.find(({ options }) => options)!.id
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
return expect(element).toBeAccessible();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { buildSearchEngine, buildStandaloneSearchBox } from "@coveo/headless";
|
|
2
|
-
import Input from "dx/input";
|
|
3
|
-
import Button from "dx/button";
|
|
4
|
-
import Dropdown from "dx/dropdown";
|
|
5
|
-
import HeaderSearch from "dx/headerSearch";
|
|
6
|
-
import { PopoverRequestCloseType } from "typings/custom";
|
|
7
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
8
|
-
import { coveoHeaderConfig } from "utils-internal/coveo";
|
|
9
|
-
import { MOCK_SUGGESTIONS } from "./mockData";
|
|
10
|
-
import mockProps from "./mockProps";
|
|
11
|
-
|
|
12
|
-
const COVEO_CONFIG = {
|
|
13
|
-
configuration: {
|
|
14
|
-
organizationId: coveoHeaderConfig.coveoOrganizationId,
|
|
15
|
-
accessToken: coveoHeaderConfig.coveoPublicAccessToken,
|
|
16
|
-
search: {
|
|
17
|
-
pipeline: coveoHeaderConfig.coveoSearchPipeline,
|
|
18
|
-
searchHub: coveoHeaderConfig.coveoSearchHub
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const REDIRECT_URL = "https://developer.salesforce.com";
|
|
24
|
-
|
|
25
|
-
const TAG = "dx-header-search";
|
|
26
|
-
const render = createRenderComponent(TAG, HeaderSearch);
|
|
27
|
-
|
|
28
|
-
let subscribeCallback: Function | null = null;
|
|
29
|
-
const mockSubscribe = jest.fn((callback) => {
|
|
30
|
-
subscribeCallback = callback;
|
|
31
|
-
});
|
|
32
|
-
const mockUpdateText = jest.fn();
|
|
33
|
-
|
|
34
|
-
jest.mock("@coveo/headless", () => {
|
|
35
|
-
return {
|
|
36
|
-
buildSearchEngine: jest.fn(),
|
|
37
|
-
buildStandaloneSearchBox: jest.fn()
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const expectMobileToDefaultRender = ({
|
|
42
|
-
input,
|
|
43
|
-
dropdown,
|
|
44
|
-
button
|
|
45
|
-
}: {
|
|
46
|
-
input: Input;
|
|
47
|
-
dropdown: Dropdown;
|
|
48
|
-
button: Button;
|
|
49
|
-
}) => {
|
|
50
|
-
expect(dropdown).not.toBeNull();
|
|
51
|
-
expect(dropdown.classList).toHaveLength(1);
|
|
52
|
-
expect(dropdown.classList).toContain("mobile_search-dropdown");
|
|
53
|
-
|
|
54
|
-
expect(dropdown.open).toBe(false);
|
|
55
|
-
|
|
56
|
-
expect(input).not.toBeNull();
|
|
57
|
-
expect(input.classList).toHaveLength(1);
|
|
58
|
-
expect(input.classList).toContain("mobile_search-input");
|
|
59
|
-
|
|
60
|
-
expect(button).not.toBeNull();
|
|
61
|
-
expect(button.iconSymbol).toBe("search");
|
|
62
|
-
expect(button.ariaLabel).toBe("Show mobile search");
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const expectSearchToInit = () => {
|
|
66
|
-
expect(buildSearchEngine).toHaveBeenCalledTimes(1);
|
|
67
|
-
expect(buildSearchEngine).toHaveBeenCalledWith(COVEO_CONFIG);
|
|
68
|
-
expect(buildStandaloneSearchBox).toHaveBeenCalledTimes(1);
|
|
69
|
-
const options = (buildStandaloneSearchBox as jest.Mock).mock.calls[0][1];
|
|
70
|
-
|
|
71
|
-
expect(options).toEqual({
|
|
72
|
-
options: {
|
|
73
|
-
numberOfSuggestions: 3,
|
|
74
|
-
redirectionUrl: REDIRECT_URL
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
expect(mockSubscribe).toHaveBeenCalledTimes(1);
|
|
78
|
-
expect(subscribeCallback).not.toBeNull();
|
|
79
|
-
expect(subscribeCallback).toBeInstanceOf(Function);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
describe(TAG, () => {
|
|
83
|
-
beforeEach(() => {
|
|
84
|
-
(buildStandaloneSearchBox as jest.Mock).mockReturnValue({
|
|
85
|
-
subscribe: mockSubscribe,
|
|
86
|
-
updateText: mockUpdateText,
|
|
87
|
-
state: { suggestions: MOCK_SUGGESTIONS }
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
afterEach(() => {
|
|
92
|
-
subscribeCallback = null;
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe("render", () => {
|
|
96
|
-
it("renders as desktop view", () => {
|
|
97
|
-
const element = render(mockProps);
|
|
98
|
-
|
|
99
|
-
const container: HTMLElement = element.shadowRoot.querySelector(
|
|
100
|
-
".desktop_search-container"
|
|
101
|
-
);
|
|
102
|
-
expect(container).not.toBeNull();
|
|
103
|
-
expect(container.classList).toContain("desktop_search-container");
|
|
104
|
-
|
|
105
|
-
const suggestionsDropdown: Dropdown =
|
|
106
|
-
element.shadowRoot.querySelector("dx-dropdown");
|
|
107
|
-
expect(suggestionsDropdown.options).toHaveLength(0);
|
|
108
|
-
expect(suggestionsDropdown.open).toBe(false);
|
|
109
|
-
|
|
110
|
-
const inputEl = element.shadowRoot.querySelector("dx-input");
|
|
111
|
-
expect(inputEl).not.toBeNull();
|
|
112
|
-
|
|
113
|
-
const button = element.shadowRoot.querySelector("dx-button");
|
|
114
|
-
expect(button).toBeNull();
|
|
115
|
-
|
|
116
|
-
expectSearchToInit();
|
|
117
|
-
|
|
118
|
-
return expect(element).toBeAccessible();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it("renders as mobile view", () => {
|
|
122
|
-
const element = render({ ...mockProps, mobile: true });
|
|
123
|
-
const container: HTMLElement =
|
|
124
|
-
element.shadowRoot.querySelector("div");
|
|
125
|
-
expect(container).not.toBeNull();
|
|
126
|
-
expect(container.classList).toHaveLength(0);
|
|
127
|
-
|
|
128
|
-
const dropdowns: Dropdown[] =
|
|
129
|
-
element.shadowRoot.querySelectorAll("dx-dropdown");
|
|
130
|
-
expect(dropdowns).toHaveLength(1);
|
|
131
|
-
const [dropdown] = dropdowns;
|
|
132
|
-
const input: Input = element.shadowRoot.querySelector("dx-input");
|
|
133
|
-
const button: Button =
|
|
134
|
-
element.shadowRoot.querySelector("dx-button");
|
|
135
|
-
expectMobileToDefaultRender({
|
|
136
|
-
input,
|
|
137
|
-
dropdown,
|
|
138
|
-
button
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
expectSearchToInit();
|
|
142
|
-
|
|
143
|
-
return expect(element).toBeAccessible();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
describe("mobile only interactions", () => {
|
|
148
|
-
it("opens dropdown on button click, input is focus and then is requestclose event as keypress-escape", () => {
|
|
149
|
-
const testType: PopoverRequestCloseType = "keypress-escape";
|
|
150
|
-
const element = render({ ...mockProps, mobile: true });
|
|
151
|
-
|
|
152
|
-
const input: Input = element.shadowRoot.querySelector("dx-input");
|
|
153
|
-
const dropdown: Dropdown =
|
|
154
|
-
element.shadowRoot.querySelector("dx-dropdown");
|
|
155
|
-
const button = element.shadowRoot.querySelector("dx-button");
|
|
156
|
-
button.click();
|
|
157
|
-
|
|
158
|
-
return Promise.resolve()
|
|
159
|
-
.then(() => {
|
|
160
|
-
expect(input.classList).toHaveLength(2);
|
|
161
|
-
expect(input.classList).toContain("mobile_search-input");
|
|
162
|
-
expect(input.classList).toContain("state-open");
|
|
163
|
-
expect(button.iconSymbol).toBe("close");
|
|
164
|
-
expect(button.ariaLabel).toBe("Hide mobile search");
|
|
165
|
-
|
|
166
|
-
// yarn jest does not complain about it, but yarn test:unit yes. Comment this for now.
|
|
167
|
-
// expect(dropdown.open).toBe(true);
|
|
168
|
-
|
|
169
|
-
dropdown.dispatchEvent(
|
|
170
|
-
new CustomEvent("requestclose", { detail: testType })
|
|
171
|
-
);
|
|
172
|
-
})
|
|
173
|
-
.then(() => {
|
|
174
|
-
expectMobileToDefaultRender({
|
|
175
|
-
input,
|
|
176
|
-
dropdown,
|
|
177
|
-
button
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import Helmet from "dx/helmet";
|
|
2
|
-
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
-
import { HelmetVariant } from "typings/custom";
|
|
4
|
-
|
|
5
|
-
const TAG = "dx-helmet";
|
|
6
|
-
const render = createRenderComponent(TAG, Helmet);
|
|
7
|
-
|
|
8
|
-
describe("dx-helmet", () => {
|
|
9
|
-
it("renders title according to the api", () => {
|
|
10
|
-
const title = "Super Cool Title";
|
|
11
|
-
const component = render({ title });
|
|
12
|
-
|
|
13
|
-
const titleSpan: HTMLElement =
|
|
14
|
-
component.shadowRoot.querySelector(".home-link-title");
|
|
15
|
-
expect(titleSpan.textContent).toBe(title);
|
|
16
|
-
|
|
17
|
-
const links: HTMLElement[] = component.shadowRoot.querySelectorAll("a");
|
|
18
|
-
expect(links.length).toBe(1);
|
|
19
|
-
|
|
20
|
-
return expect(component).toBeAccessible();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("renders second link if currentPropertyHref is passed in through the api", () => {
|
|
24
|
-
const currentPropertyTitle = "MuleSoft";
|
|
25
|
-
const currentPropertyHref = "https://developer.mulesoft.com";
|
|
26
|
-
const component = render({ currentPropertyTitle, currentPropertyHref });
|
|
27
|
-
|
|
28
|
-
const links: HTMLElement[] = component.shadowRoot.querySelectorAll("a");
|
|
29
|
-
expect(links.length).toBe(2);
|
|
30
|
-
|
|
31
|
-
const currentPropertyLink: HTMLElement = links[1];
|
|
32
|
-
expect(currentPropertyLink.textContent).toBe(currentPropertyTitle);
|
|
33
|
-
expect(currentPropertyLink.getAttribute("href")).toBe(
|
|
34
|
-
currentPropertyHref
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return expect(component).toBeAccessible();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("renders variant according to the api", () => {
|
|
41
|
-
const variant: HelmetVariant = "dark";
|
|
42
|
-
const component = render({ variant });
|
|
43
|
-
|
|
44
|
-
const div: HTMLElement = component.shadowRoot.querySelector("div");
|
|
45
|
-
expect(div).not.toBeNull();
|
|
46
|
-
expect(div.classList).toHaveLength(2);
|
|
47
|
-
expect(div.classList).toContain("helmet");
|
|
48
|
-
expect(div.classList).toContain("variant_dark");
|
|
49
|
-
|
|
50
|
-
return expect(component).toBeAccessible();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "dx/dx-helmet",
|
|
5
|
-
component: "dx-helmet"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const markup = html`
|
|
9
|
-
<style>
|
|
10
|
-
body {
|
|
11
|
-
padding: 0 !important;
|
|
12
|
-
}
|
|
13
|
-
</style>
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
export const Clear = () => html`
|
|
17
|
-
${markup}
|
|
18
|
-
<dx-helmet title="Salesforce Developers" variant="clear"></dx-helmet>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const Dark = () => html`
|
|
22
|
-
${markup}
|
|
23
|
-
<dx-helmet title="Salesforce Developers" variant="dark"></dx-helmet>
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export const Light = () => html`
|
|
27
|
-
${markup}
|
|
28
|
-
<dx-helmet title="Salesforce Developers" variant="light"></dx-helmet>
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
export const Neutral = () => html`
|
|
32
|
-
${markup}
|
|
33
|
-
<dx-helmet title="Salesforce Developers" variant="neutral"></dx-helmet>
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
export const CustomPadding = () => html`
|
|
37
|
-
${markup}
|
|
38
|
-
<dx-helmet
|
|
39
|
-
title="Salesforce Developers"
|
|
40
|
-
variant="neutral"
|
|
41
|
-
horizontal-padding="2rem"
|
|
42
|
-
></dx-helmet>
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
export const NeutralWithCurrentPropertyLink = () => html`
|
|
46
|
-
${markup}
|
|
47
|
-
<dx-helmet
|
|
48
|
-
title="Salesforce Developers"
|
|
49
|
-
current-property-title="MuleSoft"
|
|
50
|
-
current-property-href="https://developer.mulesoft.com/"
|
|
51
|
-
variant="neutral"
|
|
52
|
-
></dx-helmet>
|
|
53
|
-
`;
|