@salesforcedevs/docs-components 0.5.0-alpha1 → 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/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "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": "
|
|
17
|
+
"gitHead": "924c919f0e9214fffb628926b1ac0ad73f9304b7"
|
|
18
18
|
}
|
|
@@ -136,8 +136,10 @@ export default class Content extends LightningElement {
|
|
|
136
136
|
calloutEl.appendChild(calloutCompEl);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
// Modify links to work with any domain
|
|
140
|
-
const anchorEls = templateEl.content.querySelectorAll(
|
|
139
|
+
// Modify links to work with any domain, links that start with "#" are excluded
|
|
140
|
+
const anchorEls = templateEl.content.querySelectorAll(
|
|
141
|
+
"a:not([href^='#'])"
|
|
142
|
+
);
|
|
141
143
|
anchorEls.forEach((anchorEl) => {
|
|
142
144
|
if (
|
|
143
145
|
anchorEl.textContent.includes("Next →") ||
|
|
@@ -149,6 +151,7 @@ export default class Content extends LightningElement {
|
|
|
149
151
|
anchorEl.remove();
|
|
150
152
|
}
|
|
151
153
|
}
|
|
154
|
+
|
|
152
155
|
const href = anchorEl.href.split("/");
|
|
153
156
|
if (
|
|
154
157
|
(href[3] === this.pageReference.docId && this.isStorybook) ||
|
|
@@ -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,8 +90,14 @@ 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();
|
|
99
|
+
expect(element.headerHref).toBe("/");
|
|
100
|
+
|
|
89
101
|
const headerEl: HTMLElement = element.shadowRoot.querySelector(
|
|
90
102
|
"header"
|
|
91
103
|
);
|
|
@@ -280,6 +292,21 @@ describe(TAG, () => {
|
|
|
280
292
|
expect(headerSearch).toBeNull();
|
|
281
293
|
return expect(element).toBeAccessible();
|
|
282
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
|
+
});
|
|
283
310
|
});
|
|
284
311
|
|
|
285
312
|
describe("tablet", () => {
|
|
@@ -33,6 +33,16 @@
|
|
|
33
33
|
onstatechange={handleStateChange}
|
|
34
34
|
></dx-header-search>
|
|
35
35
|
</div>
|
|
36
|
+
<div if:true={showSignup} class="header-login-signup">
|
|
37
|
+
<dx-button
|
|
38
|
+
aria-label="Sign Up For Salesforce Developer Edition"
|
|
39
|
+
size="small"
|
|
40
|
+
href={signupLink}
|
|
41
|
+
onclick={handleSignUpClick}
|
|
42
|
+
>
|
|
43
|
+
Sign Up
|
|
44
|
+
</dx-button>
|
|
45
|
+
</div>
|
|
36
46
|
<dx-header-mobile-nav-menu
|
|
37
47
|
if:true={hasNavItems}
|
|
38
48
|
nav-items={navItems}
|
|
@@ -55,7 +65,7 @@
|
|
|
55
65
|
</div>
|
|
56
66
|
<div class="header_l2">
|
|
57
67
|
<div class="header_l2_group header_l2_group-title">
|
|
58
|
-
<a href=
|
|
68
|
+
<a href={headerHref} class="home-link">
|
|
59
69
|
<dx-icon
|
|
60
70
|
class="brand-icon"
|
|
61
71
|
if:true={isValidBrand}
|
|
@@ -11,6 +11,7 @@ const SMALL_MOBILE_MATCH = "740px";
|
|
|
11
11
|
|
|
12
12
|
export default class Header extends HeaderBase {
|
|
13
13
|
@api langValuePath: string = "id"; // allows to override how language property is interpreted, follows valuePath dropdown api.
|
|
14
|
+
@api headerHref: string = "/";
|
|
14
15
|
|
|
15
16
|
@api
|
|
16
17
|
get scopedNavItems() {
|