@salesforcedevs/docs-components 0.7.0 → 0.7.59-sppage-alpha2
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 +17 -3
- package/package.json +16 -6
- package/src/modules/README.md +41 -0
- package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
- package/src/modules/doc/amfReference/amfReference.css +25 -0
- package/src/modules/doc/amfReference/amfReference.html +60 -0
- package/src/modules/doc/amfReference/amfReference.ts +1494 -0
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +125 -0
- package/src/modules/doc/amfTopic/amfTopic.css +21 -0
- package/src/modules/doc/amfTopic/amfTopic.html +3 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
- package/src/modules/doc/amfTopic/types.ts +56 -0
- package/src/modules/doc/amfTopic/utils.ts +136 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +192 -0
- package/src/modules/doc/content/content.css +94 -70
- package/src/modules/doc/content/content.ts +233 -169
- package/src/modules/doc/contentCallout/contentCallout.css +17 -23
- package/src/modules/doc/contentCallout/contentCallout.html +13 -4
- package/src/modules/doc/contentCallout/contentCallout.ts +16 -3
- package/src/modules/doc/contentLayout/contentLayout.css +131 -0
- package/src/modules/doc/contentLayout/contentLayout.html +64 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +610 -0
- package/src/modules/doc/doDont/doDont.css +47 -0
- package/src/modules/doc/doDont/doDont.html +27 -0
- package/src/modules/doc/doDont/doDont.ts +17 -0
- package/src/modules/doc/header/header.css +70 -37
- package/src/modules/doc/header/header.html +40 -135
- package/src/modules/doc/header/header.ts +29 -78
- package/src/modules/doc/heading/heading.css +33 -0
- package/src/modules/doc/heading/heading.html +14 -0
- package/src/modules/doc/heading/heading.ts +67 -0
- package/src/modules/doc/headingAnchor/headingAnchor.css +33 -0
- package/src/modules/doc/headingAnchor/headingAnchor.html +19 -0
- package/src/modules/doc/headingAnchor/headingAnchor.ts +43 -0
- package/src/modules/doc/headingContent/headingContent.css +53 -0
- package/src/modules/doc/headingContent/headingContent.html +13 -0
- package/src/modules/doc/headingContent/headingContent.ts +30 -0
- package/src/modules/doc/overview/overview.css +40 -0
- package/src/modules/doc/overview/overview.html +34 -0
- package/src/modules/doc/overview/overview.ts +12 -0
- package/src/modules/doc/phase/phase.css +70 -0
- package/src/modules/doc/phase/phase.html +38 -0
- package/src/modules/doc/phase/phase.ts +93 -0
- package/src/modules/doc/specificationContent/specificationContent.css +3 -0
- package/src/modules/doc/specificationContent/specificationContent.html +99 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +56 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/versionPicker/versionPicker.css +64 -0
- package/src/modules/doc/versionPicker/versionPicker.html +38 -0
- package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
- package/src/modules/doc/xmlContent/types.ts +120 -0
- package/src/modules/doc/xmlContent/utils.ts +163 -0
- package/src/modules/doc/xmlContent/xmlContent.css +54 -0
- package/src/modules/doc/xmlContent/xmlContent.html +52 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +780 -0
- package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
- package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
- package/src/modules/docHelpers/status/status.css +22 -0
- package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
- package/src/modules/docUtils/utils/utils.ts +32 -0
- package/LICENSE +0 -12
- package/src/modules/doc/content/__tests__/content.test.ts +0 -120
- package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -292
- package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/content/content.stories.ts +0 -108
- package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
- package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
- package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
- package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
- package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
- package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
- package/src/modules/doc/header/__tests__/header.test.ts +0 -434
- package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
- package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/doc/header/__tests__/mockProps.ts +0 -149
- package/src/modules/doc/header/header.stories.ts +0 -160
- package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
- package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
- package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "docs/doc-content-media",
|
|
5
|
-
component: "doc-content-media"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// prettier-ignore
|
|
9
|
-
const styles = () => html `
|
|
10
|
-
<style>
|
|
11
|
-
.container-sm {
|
|
12
|
-
max-width: 540px;
|
|
13
|
-
margin: 0 auto;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.container-fw {
|
|
17
|
-
width: 100%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
h1 {
|
|
21
|
-
font-size: 36px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
h2 {
|
|
25
|
-
font-size: 24px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
h1, h2 {
|
|
29
|
-
font-weight: bold;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
// prettier-ignore
|
|
35
|
-
export const Base = () => html`${styles()}
|
|
36
|
-
<div class="container-sm">
|
|
37
|
-
<h1>Small Container</h1>
|
|
38
|
-
<h2>Images</h2>
|
|
39
|
-
<doc-content-media
|
|
40
|
-
content-type="image"
|
|
41
|
-
content-src="https://placekitten.com/400/300"
|
|
42
|
-
media-title="A cute kitten"
|
|
43
|
-
caption="An incredibly cute kitten"
|
|
44
|
-
></doc-content-media>
|
|
45
|
-
<doc-content-media
|
|
46
|
-
content-type="image"
|
|
47
|
-
content-src="https://placekitten.com/400/300"
|
|
48
|
-
media-title="A cute kitten"
|
|
49
|
-
></doc-content-media>
|
|
50
|
-
<doc-content-media
|
|
51
|
-
content-type="image"
|
|
52
|
-
content-src="https://placekitten.com/400/300"
|
|
53
|
-
caption="An incredibly cute kitten"
|
|
54
|
-
></doc-content-media>
|
|
55
|
-
<doc-content-media
|
|
56
|
-
content-type="image"
|
|
57
|
-
content-src="https://placekitten.com/400/300"
|
|
58
|
-
></doc-content-media>
|
|
59
|
-
|
|
60
|
-
<h2>IFrames</h2>
|
|
61
|
-
<doc-content-media
|
|
62
|
-
content-type="iframe"
|
|
63
|
-
content-src="https://www.youtube.com/embed/DfV7WnyEPTE"
|
|
64
|
-
media-title="Master Lightning Web Components in 8 Easy Steps (1)"
|
|
65
|
-
caption="Lightning Web Components are a new development platform for Salesforce."
|
|
66
|
-
></doc-content-media>
|
|
67
|
-
<doc-content-media
|
|
68
|
-
content-type="iframe"
|
|
69
|
-
content-src="https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline"
|
|
70
|
-
media-title="Non-YouTube Video"
|
|
71
|
-
caption="doc-content-media supports iframes from any origin."
|
|
72
|
-
></doc-content-media>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="container-fw">
|
|
76
|
-
<h1>Full-width Container</h1>
|
|
77
|
-
<h2>Images</h2>
|
|
78
|
-
<doc-content-media
|
|
79
|
-
content-type="image"
|
|
80
|
-
content-src="https://placekitten.com/400/300"
|
|
81
|
-
media-title="A cute kitten"
|
|
82
|
-
caption="An incredibly cute kitten"
|
|
83
|
-
></doc-content-media>
|
|
84
|
-
<doc-content-media
|
|
85
|
-
content-type="image"
|
|
86
|
-
content-src="https://placekitten.com/400/300"
|
|
87
|
-
media-title="A cute kitten"
|
|
88
|
-
></doc-content-media>
|
|
89
|
-
<doc-content-media
|
|
90
|
-
content-type="image"
|
|
91
|
-
content-src="https://placekitten.com/400/300"
|
|
92
|
-
caption="An incredibly cute kitten"
|
|
93
|
-
></doc-content-media>
|
|
94
|
-
<doc-content-media
|
|
95
|
-
content-type="image"
|
|
96
|
-
content-src="https://placekitten.com/400/300"
|
|
97
|
-
></doc-content-media>
|
|
98
|
-
|
|
99
|
-
<h2>IFrames</h2>
|
|
100
|
-
<doc-content-media
|
|
101
|
-
content-type="iframe"
|
|
102
|
-
content-src="https://www.youtube.com/embed/DfV7WnyEPTE"
|
|
103
|
-
media-title="Master Lightning Web Components in 8 Easy Steps (1)"
|
|
104
|
-
caption="Lightning Web Components are a new development platform for Salesforce."
|
|
105
|
-
></doc-content-media>
|
|
106
|
-
<doc-content-media
|
|
107
|
-
content-type="iframe"
|
|
108
|
-
content-src="https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline"
|
|
109
|
-
media-title="Non-YouTube Video"
|
|
110
|
-
caption="doc-content-media supports iframes from any origin."
|
|
111
|
-
></doc-content-media>
|
|
112
|
-
</div>
|
|
113
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// TODO: Move coveoConfig to a specific module to share it.
|
|
2
|
-
export const coveoConfig = {
|
|
3
|
-
coveoOrganizationId: "coveosalesforcetestakshatha",
|
|
4
|
-
coveoPublicAccessToken: "xx8d9c92ef-1018-4d92-a3c7-647dff01c21c",
|
|
5
|
-
coveoSearchPipeline: "salesforcedevdoc",
|
|
6
|
-
coveoSearchHub: "salesforcedevdoc"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
mobile: false,
|
|
11
|
-
...coveoConfig
|
|
12
|
-
};
|
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
import Button from "dx/button";
|
|
2
|
-
import Header from "doc/header";
|
|
3
|
-
import HeaderNav from "dx/headerNav";
|
|
4
|
-
import Icon from "dx/icon";
|
|
5
|
-
import { createRenderComponent } from "utils/tests";
|
|
6
|
-
import { createMediaMock } from "utils/jest";
|
|
7
|
-
import {
|
|
8
|
-
mockPropsDevelopers,
|
|
9
|
-
mockPropsEmployees,
|
|
10
|
-
mockPropsNoNavigation
|
|
11
|
-
} from "./mockProps";
|
|
12
|
-
import Dropdown from "dx/dropdown";
|
|
13
|
-
import { Option } from "typings/custom";
|
|
14
|
-
import { track } from "dx/instrumentation";
|
|
15
|
-
|
|
16
|
-
const EXPECTED_QUERY_TABLET = "(max-width: 980px)";
|
|
17
|
-
const EXPECTED_QUERY_MOBILE = "(max-width: 880px)";
|
|
18
|
-
const SMALL_MOBILE_MATCH = "(max-width: 740px)";
|
|
19
|
-
|
|
20
|
-
jest.mock("dx/instrumentation");
|
|
21
|
-
|
|
22
|
-
const TAG = "doc-header";
|
|
23
|
-
const render = createRenderComponent(TAG, Header);
|
|
24
|
-
|
|
25
|
-
const GTM_EVENT_NAME = "custEv_signUpClick";
|
|
26
|
-
const SIGN_UP_LABEL = "Sign Up";
|
|
27
|
-
|
|
28
|
-
const assertMediaMatchCalls = () => {
|
|
29
|
-
expect(window.matchMedia).toBeCalledTimes(3);
|
|
30
|
-
expect(window.matchMedia).toHaveBeenNthCalledWith(1, EXPECTED_QUERY_MOBILE);
|
|
31
|
-
expect(window.matchMedia).toHaveBeenNthCalledWith(2, EXPECTED_QUERY_TABLET);
|
|
32
|
-
|
|
33
|
-
expect(window.matchMedia).toHaveBeenLastCalledWith(SMALL_MOBILE_MATCH);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const assertDropdownRender = (
|
|
37
|
-
element: Header,
|
|
38
|
-
dropdown: Dropdown,
|
|
39
|
-
languages: Array<Option>
|
|
40
|
-
) => {
|
|
41
|
-
expect(dropdown).not.toBeNull();
|
|
42
|
-
expect(dropdown.classList).toHaveLength(1);
|
|
43
|
-
expect(dropdown.classList).toContain("header_lang-dropdown");
|
|
44
|
-
expect(dropdown.options).toHaveLength(languages.length);
|
|
45
|
-
dropdown.options.forEach((option, index) => {
|
|
46
|
-
const mockLang = languages[index];
|
|
47
|
-
expect(option).toHaveProperty("id", mockLang.id);
|
|
48
|
-
expect(option).toHaveProperty("label", mockLang.label);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
expect(dropdown.valuePath).toBe(element.langValuePath);
|
|
52
|
-
expect(dropdown.value).toBe(element.language);
|
|
53
|
-
|
|
54
|
-
expect(dropdown.querySelector("dx-button")).not.toBeNull();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const testLangEvent = () => {
|
|
58
|
-
const { languages } = mockPropsDevelopers;
|
|
59
|
-
const [firstLang, secondLang] = languages;
|
|
60
|
-
|
|
61
|
-
const element = render({
|
|
62
|
-
...mockPropsDevelopers,
|
|
63
|
-
language: firstLang.id
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
expect(element.language).toBe(firstLang.id);
|
|
67
|
-
|
|
68
|
-
const dropdown: HTMLElement = element.shadowRoot.querySelector(
|
|
69
|
-
".header_lang-dropdown"
|
|
70
|
-
);
|
|
71
|
-
const mockLangChange = jest.fn();
|
|
72
|
-
element.addEventListener("langchange", mockLangChange);
|
|
73
|
-
|
|
74
|
-
dropdown.dispatchEvent(
|
|
75
|
-
new CustomEvent("change", { detail: secondLang.id })
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
expect(element.language).toBe(secondLang.id);
|
|
79
|
-
expect(mockLangChange).toBeCalledTimes(1);
|
|
80
|
-
expect(mockLangChange.mock.calls[0][0]).toHaveProperty(
|
|
81
|
-
"detail",
|
|
82
|
-
secondLang.id
|
|
83
|
-
);
|
|
84
|
-
return expect(element).toBeAccessible();
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
describe(TAG, () => {
|
|
88
|
-
afterAll(() => {
|
|
89
|
-
jest.resetAllMocks();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
describe("desktop", () => {
|
|
93
|
-
afterEach(() => {
|
|
94
|
-
jest.clearAllMocks();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("renders", () => {
|
|
98
|
-
const element = render();
|
|
99
|
-
expect(element.headerHref).toBe("/");
|
|
100
|
-
|
|
101
|
-
const headerEl: HTMLElement = element.shadowRoot.querySelector(
|
|
102
|
-
"header"
|
|
103
|
-
);
|
|
104
|
-
expect(headerEl).not.toBeNull();
|
|
105
|
-
expect(headerEl.classList).toHaveLength(0);
|
|
106
|
-
|
|
107
|
-
expect(headerEl.querySelector("dx-feedback-banner")).not.toBeNull();
|
|
108
|
-
|
|
109
|
-
const logo = element.shadowRoot.querySelector("dx-logo");
|
|
110
|
-
expect(logo).not.toBeNull();
|
|
111
|
-
expect(logo.label).toBe("Salesforce");
|
|
112
|
-
|
|
113
|
-
expect(
|
|
114
|
-
element.shadowRoot.querySelector("dx-header-nav")
|
|
115
|
-
).toBeNull();
|
|
116
|
-
|
|
117
|
-
expect(
|
|
118
|
-
element.shadowRoot.querySelector("dx-header-search")
|
|
119
|
-
).toBeNull();
|
|
120
|
-
|
|
121
|
-
expect(
|
|
122
|
-
element.shadowRoot.querySelector("dx-header-mobile-nav-menu")
|
|
123
|
-
).toBeNull();
|
|
124
|
-
|
|
125
|
-
const homeLink: HTMLAnchorElement = element.shadowRoot.querySelector(
|
|
126
|
-
".home-link"
|
|
127
|
-
);
|
|
128
|
-
expect(homeLink).not.toBeNull();
|
|
129
|
-
expect(homeLink.href).toMatch(/\/$/);
|
|
130
|
-
expect(homeLink.querySelector("dx-icon")).toBeNull();
|
|
131
|
-
|
|
132
|
-
expect(element.shadowRoot.querySelector("dx-dropdown")).toBeNull();
|
|
133
|
-
|
|
134
|
-
expect(
|
|
135
|
-
element.shadowRoot.querySelector(
|
|
136
|
-
".header_l2_group.header_l2_group-nav"
|
|
137
|
-
)
|
|
138
|
-
).toBeNull();
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it("renders with some properties", () => {
|
|
142
|
-
const subtitle = "testsubtitle";
|
|
143
|
-
const element = render({ ...mockPropsDevelopers, subtitle });
|
|
144
|
-
|
|
145
|
-
const subtitleEl = element.shadowRoot.querySelector(".subtitle");
|
|
146
|
-
expect(subtitleEl.textContent).toEqual(subtitle);
|
|
147
|
-
|
|
148
|
-
const signUp: HTMLElement = element.shadowRoot.querySelector(
|
|
149
|
-
".header-login-signup dx-button"
|
|
150
|
-
);
|
|
151
|
-
expect(signUp).not.toBeNull();
|
|
152
|
-
|
|
153
|
-
const headerNavs: Array<HeaderNav> = element.shadowRoot.querySelectorAll(
|
|
154
|
-
"dx-header-nav"
|
|
155
|
-
);
|
|
156
|
-
expect(headerNavs).toHaveLength(1);
|
|
157
|
-
const [globalNav] = headerNavs;
|
|
158
|
-
expect(globalNav.ariaLabel).toBe("Global Navigation Bar");
|
|
159
|
-
|
|
160
|
-
const dropdown: Dropdown = element.shadowRoot.querySelector(
|
|
161
|
-
".header_l2_group.header_l2_group-right-ctas dx-dropdown"
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
assertDropdownRender(
|
|
165
|
-
element,
|
|
166
|
-
dropdown,
|
|
167
|
-
mockPropsDevelopers.languages
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
expect(
|
|
171
|
-
element.shadowRoot.querySelector(
|
|
172
|
-
".header_l2_group.header_l2_group-title dx-dropdown"
|
|
173
|
-
)
|
|
174
|
-
).toBeNull();
|
|
175
|
-
|
|
176
|
-
const brandIcon = element.shadowRoot.querySelector(".brand-icon");
|
|
177
|
-
expect(brandIcon).toBeNull();
|
|
178
|
-
return expect(element).toBeAccessible();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it("renders with scoped nav items", () => {
|
|
182
|
-
const element = render(mockPropsEmployees);
|
|
183
|
-
|
|
184
|
-
const headerNavs: Array<HeaderNav> = element.shadowRoot.querySelectorAll(
|
|
185
|
-
"dx-header-nav"
|
|
186
|
-
);
|
|
187
|
-
expect(headerNavs).toHaveLength(2);
|
|
188
|
-
const [globalNav, scopedNav] = headerNavs;
|
|
189
|
-
expect(globalNav.ariaLabel).toBe("Global Navigation Bar");
|
|
190
|
-
expect(scopedNav.ariaLabel).toBe("Scoped Navigation Bar");
|
|
191
|
-
|
|
192
|
-
const brandIcon = element.shadowRoot.querySelector(".brand-icon");
|
|
193
|
-
expect(brandIcon).not.toBeNull();
|
|
194
|
-
return expect(element).toBeAccessible();
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it("doesn't render subnav when navitems is empty", () => {
|
|
198
|
-
const element = render(mockPropsNoNavigation);
|
|
199
|
-
|
|
200
|
-
const els = element.querySelectorAll(
|
|
201
|
-
"dx-header-mobile-nav-menu, .header_l2_group-nav"
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
expect(els).toHaveLength(0);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it("renders the brand icon when a brand has an icon associated", () => {
|
|
208
|
-
const element = render(mockPropsEmployees);
|
|
209
|
-
|
|
210
|
-
const brandIcon: Icon = element.shadowRoot.querySelector(
|
|
211
|
-
".brand-icon"
|
|
212
|
-
);
|
|
213
|
-
expect(brandIcon).not.toBeNull();
|
|
214
|
-
expect(brandIcon.symbol).toBe(mockPropsEmployees.brand);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it("doesn't render brand icon when no brand is provided", () => {
|
|
218
|
-
const element = render({
|
|
219
|
-
...mockPropsDevelopers,
|
|
220
|
-
brand: undefined
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const brandIcon: Icon = element.shadowRoot.querySelector(
|
|
224
|
-
".brand-icon"
|
|
225
|
-
);
|
|
226
|
-
expect(brandIcon).toBeNull();
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// eslint-disable-next-line jest/expect-expect
|
|
230
|
-
it("triggers event on language change", testLangEvent);
|
|
231
|
-
|
|
232
|
-
it("triggers event onrequestopennav", () => {
|
|
233
|
-
const element = render({
|
|
234
|
-
...mockPropsDevelopers
|
|
235
|
-
});
|
|
236
|
-
const headerEl = element.shadowRoot.querySelector("dx-header-nav");
|
|
237
|
-
const headerMobile = element.shadowRoot.querySelector(
|
|
238
|
-
"dx-header-mobile-nav-menu"
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
headerEl.dispatchEvent(
|
|
242
|
-
new CustomEvent("requestopennavmenu", { detail: "123" })
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
return Promise.resolve().then(() => {
|
|
246
|
-
expect(headerMobile.value).toEqual("123");
|
|
247
|
-
expect(headerMobile.open).toEqual(true);
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it("tests mobile nav change", () => {
|
|
252
|
-
const element = render({
|
|
253
|
-
...mockPropsDevelopers
|
|
254
|
-
});
|
|
255
|
-
const headerMobile = element.shadowRoot.querySelector(
|
|
256
|
-
"dx-header-mobile-nav-menu"
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
headerMobile.dispatchEvent(
|
|
260
|
-
new CustomEvent("change", { detail: "test" })
|
|
261
|
-
);
|
|
262
|
-
return Promise.resolve().then(() => {
|
|
263
|
-
expect(headerMobile.value).toEqual("test");
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it("renders signup button and has bailLink", () => {
|
|
268
|
-
const element = render({
|
|
269
|
-
...mockPropsEmployees,
|
|
270
|
-
bailHref: "test",
|
|
271
|
-
bailLabel: "test",
|
|
272
|
-
signupLink: "/"
|
|
273
|
-
});
|
|
274
|
-
const buttons: Array<Button> = element.shadowRoot.querySelectorAll(
|
|
275
|
-
"dx-button"
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
expect(buttons[0].href).toEqual("/");
|
|
279
|
-
expect(buttons[1].href).toEqual("test");
|
|
280
|
-
return expect(element).toBeAccessible();
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it("won't render search if any coveo properties are missing", () => {
|
|
284
|
-
const element = render({
|
|
285
|
-
subtitle: mockPropsDevelopers.subtitle,
|
|
286
|
-
navItems: mockPropsDevelopers.navItems
|
|
287
|
-
});
|
|
288
|
-
const headerSearch = element.shadowRoot.querySelector(
|
|
289
|
-
"dx-header-search"
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
expect(headerSearch).toBeNull();
|
|
293
|
-
return expect(element).toBeAccessible();
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it("signup button track is beign called", () => {
|
|
297
|
-
const element = render(mockPropsDevelopers);
|
|
298
|
-
|
|
299
|
-
const button: HTMLElement = element.shadowRoot.querySelector(
|
|
300
|
-
"dx-button"
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
button.click();
|
|
304
|
-
|
|
305
|
-
expect(track).toBeCalledTimes(1);
|
|
306
|
-
expect(track).toBeCalledWith(button, GTM_EVENT_NAME, {
|
|
307
|
-
clickText: SIGN_UP_LABEL
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
describe("tablet", () => {
|
|
313
|
-
beforeEach(() => {
|
|
314
|
-
window.matchMedia = createMediaMock(false, [false, true, false]);
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("renders tablet specific elements", () => {
|
|
318
|
-
const element = render(mockPropsDevelopers);
|
|
319
|
-
|
|
320
|
-
const button: HTMLElement = element.shadowRoot.querySelector(
|
|
321
|
-
".nav_menu-ctas .nav_menu-button"
|
|
322
|
-
);
|
|
323
|
-
expect(button).toBeNull();
|
|
324
|
-
|
|
325
|
-
const headerSearch = element.shadowRoot.querySelector(
|
|
326
|
-
"dx-header-search"
|
|
327
|
-
);
|
|
328
|
-
expect(headerSearch).not.toBeNull();
|
|
329
|
-
expect(headerSearch.mobile).toBe(true);
|
|
330
|
-
|
|
331
|
-
const signupDiv = element.shadowRoot.querySelector(
|
|
332
|
-
".header-login-signup"
|
|
333
|
-
);
|
|
334
|
-
expect(signupDiv).not.toBeNull();
|
|
335
|
-
expect(
|
|
336
|
-
element.shadowRoot.querySelector(
|
|
337
|
-
".header_l2_group.header_l2_group-right-ctas dx-dropdown"
|
|
338
|
-
)
|
|
339
|
-
).not.toBeNull();
|
|
340
|
-
expect(
|
|
341
|
-
element.shadowRoot.querySelector(
|
|
342
|
-
".header_l2_group.header_l2_group-title dx-dropdown"
|
|
343
|
-
)
|
|
344
|
-
).toBeNull();
|
|
345
|
-
|
|
346
|
-
assertMediaMatchCalls();
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
describe("mobile", () => {
|
|
351
|
-
beforeEach(() => {
|
|
352
|
-
window.matchMedia = createMediaMock(false, [true, true, false]);
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
it("renders mobile specific elements", () => {
|
|
356
|
-
const element = render(mockPropsDevelopers);
|
|
357
|
-
|
|
358
|
-
const button: HTMLElement = element.shadowRoot.querySelector(
|
|
359
|
-
".nav_menu-ctas .nav_menu-button"
|
|
360
|
-
);
|
|
361
|
-
expect(button).not.toBeNull();
|
|
362
|
-
|
|
363
|
-
const headerSearch = element.shadowRoot.querySelector(
|
|
364
|
-
"dx-header-search"
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
expect(
|
|
368
|
-
element.shadowRoot.querySelector(
|
|
369
|
-
".header_l2_group.header_l2_group-right-ctas dx-dropdown"
|
|
370
|
-
)
|
|
371
|
-
).not.toBeNull();
|
|
372
|
-
expect(
|
|
373
|
-
element.shadowRoot.querySelector(
|
|
374
|
-
".header_l2_group.header_l2_group-title dx-dropdown"
|
|
375
|
-
)
|
|
376
|
-
).toBeNull();
|
|
377
|
-
expect(headerSearch).not.toBeNull();
|
|
378
|
-
expect(headerSearch.mobile).toBe(true);
|
|
379
|
-
|
|
380
|
-
assertMediaMatchCalls();
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
it("tests toggle button", () => {
|
|
384
|
-
const element = render(mockPropsDevelopers);
|
|
385
|
-
const button: HTMLElement = element.shadowRoot.querySelector(
|
|
386
|
-
".nav_menu-ctas .nav_menu-button"
|
|
387
|
-
);
|
|
388
|
-
expect(button).not.toBeNull();
|
|
389
|
-
const header = element.shadowRoot.querySelector(
|
|
390
|
-
"dx-header-mobile-nav-menu"
|
|
391
|
-
);
|
|
392
|
-
expect(header).not.toBeNull();
|
|
393
|
-
|
|
394
|
-
const toggleStatus = header.open;
|
|
395
|
-
|
|
396
|
-
button.click();
|
|
397
|
-
|
|
398
|
-
return Promise.resolve().then(() =>
|
|
399
|
-
expect(header.open).toEqual(!toggleStatus)
|
|
400
|
-
);
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
describe("small mobile", () => {
|
|
405
|
-
beforeEach(() => {
|
|
406
|
-
window.matchMedia = createMediaMock(true);
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
it("renders small mobile specific elements", () => {
|
|
410
|
-
const element = render(mockPropsDevelopers);
|
|
411
|
-
const dropdown = element.shadowRoot.querySelector(
|
|
412
|
-
".header_l2_group.header_l2_group-title dx-dropdown"
|
|
413
|
-
);
|
|
414
|
-
|
|
415
|
-
expect(dropdown).not.toBeNull();
|
|
416
|
-
assertDropdownRender(
|
|
417
|
-
element,
|
|
418
|
-
dropdown,
|
|
419
|
-
mockPropsDevelopers.languages
|
|
420
|
-
);
|
|
421
|
-
|
|
422
|
-
expect(
|
|
423
|
-
element.shadowRoot.querySelector(
|
|
424
|
-
".header_l2_group.header_l2_group-right-ctas dx-dropdown"
|
|
425
|
-
)
|
|
426
|
-
).toBeNull();
|
|
427
|
-
|
|
428
|
-
return expect(element).toBeAccessible();
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
// eslint-disable-next-line jest/expect-expect
|
|
432
|
-
it("triggers event on language change", testLangEvent);
|
|
433
|
-
});
|
|
434
|
-
});
|