@salesforcedevs/docs-components 0.6.0 → 0.7.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.6.0",
3
+ "version": "0.7.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": "58b06bc8a8006d832bb2e25999423404bee9e523"
17
+ "gitHead": "924c919f0e9214fffb628926b1ac0ad73f9304b7"
18
18
  }
@@ -11,14 +11,20 @@ import {
11
11
  } from "./mockProps";
12
12
  import Dropdown from "dx/dropdown";
13
13
  import { Option } from "typings/custom";
14
+ import { track } from "dx/instrumentation";
14
15
 
15
16
  const EXPECTED_QUERY_TABLET = "(max-width: 980px)";
16
17
  const EXPECTED_QUERY_MOBILE = "(max-width: 880px)";
17
18
  const SMALL_MOBILE_MATCH = "(max-width: 740px)";
18
19
 
20
+ jest.mock("dx/instrumentation");
21
+
19
22
  const TAG = "doc-header";
20
23
  const render = createRenderComponent(TAG, Header);
21
24
 
25
+ const GTM_EVENT_NAME = "custEv_signUpClick";
26
+ const SIGN_UP_LABEL = "Sign Up";
27
+
22
28
  const assertMediaMatchCalls = () => {
23
29
  expect(window.matchMedia).toBeCalledTimes(3);
24
30
  expect(window.matchMedia).toHaveBeenNthCalledWith(1, EXPECTED_QUERY_MOBILE);
@@ -84,6 +90,10 @@ describe(TAG, () => {
84
90
  });
85
91
 
86
92
  describe("desktop", () => {
93
+ afterEach(() => {
94
+ jest.clearAllMocks();
95
+ });
96
+
87
97
  it("renders", () => {
88
98
  const element = render();
89
99
  expect(element.headerHref).toBe("/");
@@ -282,6 +292,21 @@ describe(TAG, () => {
282
292
  expect(headerSearch).toBeNull();
283
293
  return expect(element).toBeAccessible();
284
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
+ });
285
310
  });
286
311
 
287
312
  describe("tablet", () => {
@@ -38,6 +38,7 @@
38
38
  aria-label="Sign Up For Salesforce Developer Edition"
39
39
  size="small"
40
40
  href={signupLink}
41
+ onclick={handleSignUpClick}
41
42
  >
42
43
  Sign Up
43
44
  </dx-button>