@salesforcedevs/docs-components 0.16.2 → 0.17.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "b7a26c9e46cee9298b3ebc7cbea85930320b83a0"
|
|
18
18
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import Dropdown from "dx/dropdown";
|
|
13
13
|
import { Option } from "typings/custom";
|
|
14
14
|
import { track } from "dx/instrumentation";
|
|
15
|
+
import { ANALYTICS_INFO } from "utils/headerBase";
|
|
15
16
|
|
|
16
17
|
const EXPECTED_QUERY_TABLET = "(max-width: 980px)";
|
|
17
18
|
const EXPECTED_QUERY_MOBILE = "(max-width: 880px)";
|
|
@@ -22,9 +23,6 @@ jest.mock("dx/instrumentation");
|
|
|
22
23
|
const TAG = "doc-header";
|
|
23
24
|
const render = createRenderComponent(TAG, Header);
|
|
24
25
|
|
|
25
|
-
const GTM_EVENT_NAME = "custEv_signupStart";
|
|
26
|
-
const SIGN_UP_LABEL = "Sign Up";
|
|
27
|
-
|
|
28
26
|
const assertMediaMatchCalls = () => {
|
|
29
27
|
expect(window.matchMedia).toBeCalledTimes(3);
|
|
30
28
|
expect(window.matchMedia).toHaveBeenNthCalledWith(1, EXPECTED_QUERY_MOBILE);
|
|
@@ -98,9 +96,8 @@ describe(TAG, () => {
|
|
|
98
96
|
const element = render();
|
|
99
97
|
expect(element.headerHref).toBe("/");
|
|
100
98
|
|
|
101
|
-
const headerEl: HTMLElement =
|
|
102
|
-
"header"
|
|
103
|
-
);
|
|
99
|
+
const headerEl: HTMLElement =
|
|
100
|
+
element.shadowRoot.querySelector("header");
|
|
104
101
|
expect(headerEl).not.toBeNull();
|
|
105
102
|
expect(headerEl.classList).toHaveLength(0);
|
|
106
103
|
|
|
@@ -122,9 +119,8 @@ describe(TAG, () => {
|
|
|
122
119
|
element.shadowRoot.querySelector("dx-header-mobile-nav-menu")
|
|
123
120
|
).toBeNull();
|
|
124
121
|
|
|
125
|
-
const homeLink: HTMLAnchorElement =
|
|
126
|
-
".home-link"
|
|
127
|
-
);
|
|
122
|
+
const homeLink: HTMLAnchorElement =
|
|
123
|
+
element.shadowRoot.querySelector(".home-link");
|
|
128
124
|
expect(homeLink).not.toBeNull();
|
|
129
125
|
expect(homeLink.href).toMatch(/\/$/);
|
|
130
126
|
expect(homeLink.querySelector("dx-icon")).toBeNull();
|
|
@@ -150,9 +146,8 @@ describe(TAG, () => {
|
|
|
150
146
|
);
|
|
151
147
|
expect(signUp).not.toBeNull();
|
|
152
148
|
|
|
153
|
-
const headerNavs: Array<HeaderNav> =
|
|
154
|
-
"dx-header-nav"
|
|
155
|
-
);
|
|
149
|
+
const headerNavs: Array<HeaderNav> =
|
|
150
|
+
element.shadowRoot.querySelectorAll("dx-header-nav");
|
|
156
151
|
expect(headerNavs).toHaveLength(1);
|
|
157
152
|
const [globalNav] = headerNavs;
|
|
158
153
|
expect(globalNav.ariaLabel).toBe("Global Navigation Bar");
|
|
@@ -181,9 +176,8 @@ describe(TAG, () => {
|
|
|
181
176
|
it("renders with scoped nav items", () => {
|
|
182
177
|
const element = render(mockPropsEmployees);
|
|
183
178
|
|
|
184
|
-
const headerNavs: Array<HeaderNav> =
|
|
185
|
-
"dx-header-nav"
|
|
186
|
-
);
|
|
179
|
+
const headerNavs: Array<HeaderNav> =
|
|
180
|
+
element.shadowRoot.querySelectorAll("dx-header-nav");
|
|
187
181
|
expect(headerNavs).toHaveLength(2);
|
|
188
182
|
const [globalNav, scopedNav] = headerNavs;
|
|
189
183
|
expect(globalNav.ariaLabel).toBe("Global Navigation Bar");
|
|
@@ -207,9 +201,8 @@ describe(TAG, () => {
|
|
|
207
201
|
it("renders the brand icon when a brand has an icon associated", () => {
|
|
208
202
|
const element = render(mockPropsEmployees);
|
|
209
203
|
|
|
210
|
-
const brandIcon: Icon =
|
|
211
|
-
".brand-icon"
|
|
212
|
-
);
|
|
204
|
+
const brandIcon: Icon =
|
|
205
|
+
element.shadowRoot.querySelector(".brand-icon");
|
|
213
206
|
expect(brandIcon).not.toBeNull();
|
|
214
207
|
expect(brandIcon.symbol).toBe(mockPropsEmployees.brand);
|
|
215
208
|
});
|
|
@@ -220,9 +213,8 @@ describe(TAG, () => {
|
|
|
220
213
|
brand: undefined
|
|
221
214
|
});
|
|
222
215
|
|
|
223
|
-
const brandIcon: Icon =
|
|
224
|
-
".brand-icon"
|
|
225
|
-
);
|
|
216
|
+
const brandIcon: Icon =
|
|
217
|
+
element.shadowRoot.querySelector(".brand-icon");
|
|
226
218
|
expect(brandIcon).toBeNull();
|
|
227
219
|
});
|
|
228
220
|
|
|
@@ -271,9 +263,8 @@ describe(TAG, () => {
|
|
|
271
263
|
bailLabel: "test",
|
|
272
264
|
signupLink: "/"
|
|
273
265
|
});
|
|
274
|
-
const buttons: Array<Button> =
|
|
275
|
-
"dx-button"
|
|
276
|
-
);
|
|
266
|
+
const buttons: Array<Button> =
|
|
267
|
+
element.shadowRoot.querySelectorAll("dx-button");
|
|
277
268
|
|
|
278
269
|
expect(buttons[0].href).toEqual("/");
|
|
279
270
|
expect(buttons[1].href).toEqual("test");
|
|
@@ -285,33 +276,32 @@ describe(TAG, () => {
|
|
|
285
276
|
subtitle: mockPropsDevelopers.subtitle,
|
|
286
277
|
navItems: mockPropsDevelopers.navItems
|
|
287
278
|
});
|
|
288
|
-
const headerSearch =
|
|
289
|
-
"dx-header-search"
|
|
290
|
-
);
|
|
279
|
+
const headerSearch =
|
|
280
|
+
element.shadowRoot.querySelector("dx-header-search");
|
|
291
281
|
|
|
292
282
|
expect(headerSearch).toBeNull();
|
|
293
283
|
return expect(element).toBeAccessible();
|
|
294
284
|
});
|
|
295
285
|
|
|
296
|
-
it("signup button track is
|
|
286
|
+
it("signup button track is being called", () => {
|
|
297
287
|
const element = render(mockPropsDevelopers);
|
|
298
288
|
|
|
299
|
-
const button: HTMLElement =
|
|
300
|
-
"dx-button"
|
|
301
|
-
);
|
|
289
|
+
const button: HTMLElement =
|
|
290
|
+
element.shadowRoot.querySelector("dx-button");
|
|
302
291
|
|
|
303
292
|
button.click();
|
|
304
293
|
|
|
305
294
|
expect(track).toBeCalledTimes(1);
|
|
306
|
-
expect(track).toBeCalledWith(button,
|
|
307
|
-
|
|
295
|
+
expect(track).toBeCalledWith(button, "custEv_signupStart", {
|
|
296
|
+
...ANALYTICS_INFO,
|
|
297
|
+
clickUrl: "/sign-up"
|
|
308
298
|
});
|
|
309
299
|
});
|
|
310
300
|
|
|
311
301
|
it("hides signup button when signupLink property is empty", () => {
|
|
312
302
|
const updatedMockPropsDevelopers = {
|
|
313
303
|
...mockPropsDevelopers,
|
|
314
|
-
signupLink:""
|
|
304
|
+
signupLink: ""
|
|
315
305
|
};
|
|
316
306
|
const element = render(updatedMockPropsDevelopers);
|
|
317
307
|
const signupButtonContainer: HTMLElement =
|
|
@@ -345,9 +335,8 @@ describe(TAG, () => {
|
|
|
345
335
|
);
|
|
346
336
|
expect(button).toBeNull();
|
|
347
337
|
|
|
348
|
-
const headerSearch =
|
|
349
|
-
"dx-header-search"
|
|
350
|
-
);
|
|
338
|
+
const headerSearch =
|
|
339
|
+
element.shadowRoot.querySelector("dx-header-search");
|
|
351
340
|
expect(headerSearch).not.toBeNull();
|
|
352
341
|
expect(headerSearch.mobile).toBe(true);
|
|
353
342
|
|
|
@@ -383,9 +372,8 @@ describe(TAG, () => {
|
|
|
383
372
|
);
|
|
384
373
|
expect(button).not.toBeNull();
|
|
385
374
|
|
|
386
|
-
const headerSearch =
|
|
387
|
-
"dx-header-search"
|
|
388
|
-
);
|
|
375
|
+
const headerSearch =
|
|
376
|
+
element.shadowRoot.querySelector("dx-header-search");
|
|
389
377
|
|
|
390
378
|
expect(
|
|
391
379
|
element.shadowRoot.querySelector(
|