@salesforcedevs/dx-components 0.16.1 → 0.18.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 +3 -3
- package/src/assets/svg/sidebar-loading.svg +34 -0
- package/src/modules/dx/banner/__tests__/banner.test.ts +31 -0
- package/src/modules/dx/{feedbackBanner/feedbackBanner.css → banner/banner.css} +6 -6
- package/src/modules/dx/banner/banner.html +13 -0
- package/src/modules/dx/banner/banner.ts +14 -0
- package/src/modules/dx/dropdown/dropdown.html +2 -0
- package/src/modules/dx/dropdown/dropdown.ts +4 -2
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +32 -2
- package/src/modules/dx/dropdownOption/dropdownOption.ts +9 -6
- package/src/modules/dx/footer/footer.ts +13 -1
- package/src/modules/dx/header/__tests__/header.test.ts +38 -21
- package/src/modules/dx/header/__tests__/mockProps.ts +29 -37
- package/src/modules/dx/header/header.html +4 -1
- package/src/modules/dx/header/header.stories.ts +30 -0
- package/src/modules/dx/header/header.ts +4 -1
- package/src/modules/dx/headerNav/headerNav.html +1 -0
- package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +24 -39
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +2 -7
- package/src/modules/dx/headerSearch/headerSearch.ts +13 -19
- package/src/modules/dx/lazy/lazy.ts +0 -7
- package/src/modules/dx/newsletterForm/newsletterForm.ts +20 -11
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEmptyEvent.ts +6 -0
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEvent.ts +527 -0
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +210 -247
- package/src/modules/dx/sidebar/sidebar.css +40 -17
- package/src/modules/dx/sidebar/sidebar.html +58 -34
- package/src/modules/dx/sidebar/sidebar.stories.ts +54 -4
- package/src/modules/dx/sidebar/sidebar.ts +141 -73
- package/src/modules/dx/sidebarOld/__tests__/mockProps.ts +178 -0
- package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +574 -0
- package/src/modules/dx/sidebarOld/sidebarOld.css +158 -0
- package/src/modules/dx/sidebarOld/sidebarOld.html +70 -0
- package/src/modules/dx/sidebarOld/sidebarOld.stories.ts +139 -0
- package/src/modules/dx/sidebarOld/sidebarOld.ts +187 -0
- package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +8843 -0
- package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +113 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.css +3 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.html +26 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +421 -0
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +55 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +36 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +14 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +56 -0
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +27 -38
- package/src/modules/dx/treeTile/treeTile.css +3 -19
- package/src/modules/dx/treeTile/treeTile.html +4 -1
- package/src/modules/dx/treeTile/treeTile.ts +2 -2
- package/src/modules/helpers/sidebar/sidebar.css +21 -0
- package/src/modules/utils/coveo/coveo.ts +69 -0
- package/src/modules/utils/headerBase/headerBase.ts +13 -2
- package/src/modules/utils/highlight/__tests__/highlight.test.ts +108 -0
- package/src/modules/utils/highlight/__tests__/mockProps.ts +45 -0
- package/src/modules/utils/highlight/highlight.ts +2 -1
- package/src/modules/utils/jest/jest.ts +35 -0
- package/src/modules/utils/recentSearches/__tests__/recentSearches.test.ts +79 -0
- package/src/modules/utils/recentSearches/recentSearches.ts +57 -0
- package/src/modules/utils/tests/tests.ts +18 -11
- package/src/modules/dx/feedbackBanner/__tests__/feedbackBanner.test.ts +0 -19
- package/src/modules/dx/feedbackBanner/feedbackBanner.html +0 -13
- package/src/modules/dx/feedbackBanner/feedbackBanner.ts +0 -3
package/lwc.config.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dx/featuredContentHeader",
|
|
27
27
|
"dx/featureGrid",
|
|
28
28
|
"dx/featuresList",
|
|
29
|
-
"dx/
|
|
29
|
+
"dx/banner",
|
|
30
30
|
"dx/footer",
|
|
31
31
|
"dx/newsletterForm",
|
|
32
32
|
"dx/formattedDateTime",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"dx/sectionSmall",
|
|
61
61
|
"dx/select",
|
|
62
62
|
"dx/sidebar",
|
|
63
|
+
"dx/sidebarOld",
|
|
63
64
|
"dx/socials",
|
|
64
65
|
"dx/toc",
|
|
65
66
|
"dx/tree",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@coveo/headless": "
|
|
17
|
+
"@coveo/headless": "^1.32.0",
|
|
18
18
|
"@popperjs/core": "2.9.1",
|
|
19
19
|
"@sfdocs-internal/wires": "^0.6.3",
|
|
20
20
|
"classnames": "^2.2.6",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"@types/debounce": "^1.2.0",
|
|
30
30
|
"@types/lodash.get": "^4.4.6"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d211c35163de06a1f77f0450391639278661a481"
|
|
33
33
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
<svg width="100%" height="374px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<g id="Scoped-Search" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
4
|
+
<g id="Docs-–-Search-Results-Loading" transform="translate(-52.000000, -240.000000)" fill="#DAD8D7">
|
|
5
|
+
<g id="Group-12" transform="translate(52.000000, 240.000000)">
|
|
6
|
+
<g id="Group-5">
|
|
7
|
+
<rect id="Rectangle" x="0" y="0" width="90%" height="10" rx="5"></rect>
|
|
8
|
+
<rect id="Rectangle" x="0" y="26" width="80%" height="10" rx="5"></rect>
|
|
9
|
+
<rect id="Rectangle" x="0" y="52" width="70%" height="10" rx="5"></rect>
|
|
10
|
+
</g>
|
|
11
|
+
<g id="Group-5" opacity="0.8" transform="translate(0.000000, 78.000000)">
|
|
12
|
+
<rect id="Rectangle" x="0" y="0" width="90%" height="10" rx="5"></rect>
|
|
13
|
+
<rect id="Rectangle" x="0" y="26" width="80%" height="10" rx="5"></rect>
|
|
14
|
+
<rect id="Rectangle" x="0" y="52" width="70%" height="10" rx="5"></rect>
|
|
15
|
+
</g>
|
|
16
|
+
<g id="Group-5" opacity="0.6" transform="translate(0.000000, 156.000000)">
|
|
17
|
+
<rect id="Rectangle" x="0" y="0" width="90%" height="10" rx="5"></rect>
|
|
18
|
+
<rect id="Rectangle" x="0" y="26" width="80%" height="10" rx="5"></rect>
|
|
19
|
+
<rect id="Rectangle" x="0" y="52" width="70%" height="10" rx="5"></rect>
|
|
20
|
+
</g>
|
|
21
|
+
<g id="Group-5" opacity="0.4" transform="translate(0.000000, 234.000000)">
|
|
22
|
+
<rect id="Rectangle" x="0" y="0" width="90%" height="10" rx="5"></rect>
|
|
23
|
+
<rect id="Rectangle" x="0" y="26" width="80%" height="10" rx="5"></rect>
|
|
24
|
+
<rect id="Rectangle" x="0" y="52" width="70%" height="10" rx="5"></rect>
|
|
25
|
+
</g>
|
|
26
|
+
<g id="Group-5" opacity="0.197206577" transform="translate(0.000000, 312.000000)">
|
|
27
|
+
<rect id="Rectangle" x="0" y="0" width="90%" height="10" rx="5"></rect>
|
|
28
|
+
<rect id="Rectangle" x="0" y="26" width="80%" height="10" rx="5"></rect>
|
|
29
|
+
<rect id="Rectangle" x="0" y="52" width="70%" height="10" rx="5"></rect>
|
|
30
|
+
</g>
|
|
31
|
+
</g>
|
|
32
|
+
</g>
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Banner from "dx/banner";
|
|
2
|
+
import { createRenderComponent } from "utils/tests";
|
|
3
|
+
|
|
4
|
+
const TAG = "dx-banner";
|
|
5
|
+
const render = createRenderComponent(TAG, Banner);
|
|
6
|
+
|
|
7
|
+
describe(TAG, () => {
|
|
8
|
+
it("renders banner component", () => {
|
|
9
|
+
const element = render();
|
|
10
|
+
|
|
11
|
+
const innerContainer = element.shadowRoot.querySelectorAll(
|
|
12
|
+
".container_inner"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(innerContainer).not.toBeNull();
|
|
16
|
+
|
|
17
|
+
return expect(element).toBeAccessible();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("renders custom banner markup in the banner", () => {
|
|
21
|
+
const element = render({ bannerMarkup: "Give feedback about our new site" });
|
|
22
|
+
|
|
23
|
+
const bannerContainer = element.shadowRoot.querySelector(
|
|
24
|
+
".info-container"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return Promise.resolve().then(() => {
|
|
28
|
+
expect(bannerContainer.innerHTML).toContain('Give feedback about our new site')
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import "helpers/reset";
|
|
2
2
|
@import "helpers/text";
|
|
3
3
|
|
|
4
|
-
.
|
|
4
|
+
.container {
|
|
5
5
|
--primary-color: var(--dx-g-cloud-blue-vibrant-50);
|
|
6
6
|
--secondary-color: var(--dx-g-cloud-blue-vibrant-40);
|
|
7
7
|
|
|
@@ -21,26 +21,26 @@
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.container_inner {
|
|
25
25
|
height: 100%;
|
|
26
26
|
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
27
|
background: var(--primary-color);
|
|
29
28
|
padding: var(--dx-g-spacing-xs) var(--dx-g-spacing-sm);
|
|
30
29
|
color: white;
|
|
31
30
|
font-weight: bold;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
.
|
|
33
|
+
.container a {
|
|
35
34
|
text-decoration: underline;
|
|
36
35
|
transition: var(--dx-g-transition-hue-1x);
|
|
37
36
|
margin-right: 4px;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
.
|
|
39
|
+
.container a:hover {
|
|
41
40
|
opacity: 0.8;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
.
|
|
43
|
+
.container dx-icon {
|
|
45
44
|
margin-right: var(--dx-g-spacing-sm);
|
|
45
|
+
margin-top:var( --dx-g-spacing-2xs)
|
|
46
46
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="container_inner dx-text-body-4">
|
|
4
|
+
<dx-icon symbol="announcement"></dx-icon>
|
|
5
|
+
<!--
|
|
6
|
+
NOTE: Here we are rendering mark up using lwc:dom & innerHTML
|
|
7
|
+
option instead of slots because the html markup will come as a
|
|
8
|
+
property to the component from a configuration
|
|
9
|
+
-->
|
|
10
|
+
<div lwc:dom="manual" class="info-container"></div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
export default class Banner extends LightningElement {
|
|
4
|
+
@api bannerMarkup =
|
|
5
|
+
'<span><a href="https://forms.gle/TdSyKFPHXoBx7seM9" target="blank">Share your feedback</a>about our new site.</span>';
|
|
6
|
+
|
|
7
|
+
renderedCallback(){
|
|
8
|
+
const container = this.template.querySelector(".info-container");
|
|
9
|
+
if(container){
|
|
10
|
+
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
11
|
+
container.innerHTML = this.bannerMarkup
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
>
|
|
22
22
|
<template for:each={options} for:item="option">
|
|
23
23
|
<dx-dropdown-option
|
|
24
|
+
analytics-event={analyticsEvent}
|
|
24
25
|
active={option.active}
|
|
25
26
|
key-value={option.keyValue}
|
|
26
27
|
if:false={option.options}
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
<span class="menu_heading">{option.label}</span>
|
|
40
41
|
<template for:each={option.options} for:item="suboption">
|
|
41
42
|
<dx-dropdown-option
|
|
43
|
+
analytics-event={analyticsEvent}
|
|
42
44
|
active={suboption.active}
|
|
43
45
|
key={suboption.id}
|
|
44
46
|
key-value={suboption.keyValue}
|
|
@@ -29,8 +29,10 @@ export default class Dropdown extends LightningElement {
|
|
|
29
29
|
@api small?: boolean = false;
|
|
30
30
|
@api openOnHover?: boolean = false; // dropdown opens/closes with hover
|
|
31
31
|
@api width?: string | null = null;
|
|
32
|
-
@api fullWidth?: boolean | null;
|
|
33
|
-
|
|
32
|
+
@api fullWidth?: boolean | null; @api navItemLabel: string | null = null;
|
|
33
|
+
|
|
34
|
+
// props forwarded to dropdown option
|
|
35
|
+
@api analyticsEvent: string | null = null
|
|
34
36
|
|
|
35
37
|
@api
|
|
36
38
|
get options() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DropdownOption from "dx/dropdownOption";
|
|
2
2
|
import { createRenderComponent } from "utils/tests";
|
|
3
3
|
import { MOCK_BUTTON_PROPS, MOCK_LINK_PROPS } from "./mockProps";
|
|
4
|
+
import * as instrumentation from "dx/instrumentation";
|
|
4
5
|
|
|
5
6
|
const TAG = "dx-dropdown-option";
|
|
6
7
|
const render = createRenderComponent(TAG, DropdownOption);
|
|
@@ -13,6 +14,10 @@ const appendToMenu = (element: HTMLElement) => {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
describe(TAG, () => {
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
jest.clearAllMocks();
|
|
19
|
+
});
|
|
20
|
+
|
|
16
21
|
it("renders a button by default", () => {
|
|
17
22
|
const component = render(MOCK_BUTTON_PROPS);
|
|
18
23
|
expect(component.shadowRoot.querySelector("button")).not.toBeNull();
|
|
@@ -23,8 +28,8 @@ describe(TAG, () => {
|
|
|
23
28
|
|
|
24
29
|
it("renders the correct label, description, and img", () => {
|
|
25
30
|
const component = render(MOCK_BUTTON_PROPS);
|
|
26
|
-
const label =
|
|
27
|
-
.textContent;
|
|
31
|
+
const label =
|
|
32
|
+
component.shadowRoot.querySelector(".option_label").textContent;
|
|
28
33
|
expect(label).toEqual(MOCK_BUTTON_PROPS.option.label);
|
|
29
34
|
|
|
30
35
|
const description = component.shadowRoot.querySelector(
|
|
@@ -79,4 +84,29 @@ describe(TAG, () => {
|
|
|
79
84
|
|
|
80
85
|
expect(onClickMock).toBeCalled();
|
|
81
86
|
});
|
|
87
|
+
|
|
88
|
+
it("fires analytics when given an analytics event", () => {
|
|
89
|
+
const track = jest.spyOn(instrumentation, "track");
|
|
90
|
+
|
|
91
|
+
const component = render({
|
|
92
|
+
...MOCK_BUTTON_PROPS,
|
|
93
|
+
analyticsEvent: "mock"
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const option = component.shadowRoot.querySelector(".option");
|
|
97
|
+
option.click();
|
|
98
|
+
|
|
99
|
+
expect(track).toHaveBeenCalledTimes(1);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("doesn't fire analytics when not given an analytics event", () => {
|
|
103
|
+
const track = jest.spyOn(instrumentation, "track");
|
|
104
|
+
|
|
105
|
+
const component = render(MOCK_BUTTON_PROPS);
|
|
106
|
+
|
|
107
|
+
const option = component.shadowRoot.querySelector(".option");
|
|
108
|
+
option.click();
|
|
109
|
+
|
|
110
|
+
expect(track).not.toHaveBeenCalled();
|
|
111
|
+
});
|
|
82
112
|
});
|
|
@@ -8,6 +8,7 @@ export default class DropdownOption extends LightningElement {
|
|
|
8
8
|
@api keyValue!: string;
|
|
9
9
|
@api active: boolean = false;
|
|
10
10
|
@api navItemLabel: String | null = null;
|
|
11
|
+
@api analyticsEvent: string | null = null;
|
|
11
12
|
|
|
12
13
|
@api focus() {
|
|
13
14
|
const option = this.template.querySelector(".option");
|
|
@@ -26,11 +27,13 @@ export default class DropdownOption extends LightningElement {
|
|
|
26
27
|
new CustomEvent("select", { detail: this.keyValue })
|
|
27
28
|
);
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
if (this.analyticsEvent && e.currentTarget) {
|
|
31
|
+
track(e.currentTarget, this.analyticsEvent, {
|
|
32
|
+
navHeading: this.navItemLabel || undefined,
|
|
33
|
+
navSubHeading: this.option.label || undefined,
|
|
34
|
+
clickText: this.keyValue || undefined,
|
|
35
|
+
pageLocation: window.location.pathname || undefined
|
|
36
|
+
});
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -14,6 +14,12 @@ import { track } from "dx/instrumentation";
|
|
|
14
14
|
const createNewsletterSignupHref = (email: string): string =>
|
|
15
15
|
`/newsletter?subscriberEmail=${email}`;
|
|
16
16
|
|
|
17
|
+
const ANALYTICS_INFO = {
|
|
18
|
+
itemTitle: "Newsletter Sign Up Footer",
|
|
19
|
+
elementType: "button",
|
|
20
|
+
destinationType: "internal",
|
|
21
|
+
ctaClick: true
|
|
22
|
+
};
|
|
17
23
|
export default class Footer extends LightningElement {
|
|
18
24
|
@api locale: string | null = null;
|
|
19
25
|
@api
|
|
@@ -85,7 +91,13 @@ export default class Footer extends LightningElement {
|
|
|
85
91
|
|
|
86
92
|
private onSubmitEmail = async (e: CustomEvent) => {
|
|
87
93
|
const href = createNewsletterSignupHref(e.detail);
|
|
88
|
-
|
|
94
|
+
|
|
95
|
+
track(e.currentTarget, "custEv_ctaButtonClick", {
|
|
96
|
+
...ANALYTICS_INFO,
|
|
97
|
+
clickText: e.detail,
|
|
98
|
+
clickUrl: href,
|
|
99
|
+
});
|
|
100
|
+
|
|
89
101
|
window.location.assign(href);
|
|
90
102
|
};
|
|
91
103
|
|
|
@@ -9,23 +9,20 @@ import {
|
|
|
9
9
|
mockPropsNoNavigation
|
|
10
10
|
} from "./mockProps";
|
|
11
11
|
import { track } from "dx/instrumentation";
|
|
12
|
+
import { ANALYTICS_INFO } from "utils/headerBase";
|
|
12
13
|
|
|
13
14
|
const TAG = "dx-header";
|
|
14
15
|
const render = createRenderComponent(TAG, Header);
|
|
15
16
|
|
|
16
17
|
jest.mock("dx/instrumentation");
|
|
17
18
|
|
|
18
|
-
const GTM_EVENT_NAME = "custEv_signupStart";
|
|
19
|
-
const SIGN_UP_LABEL = "Sign Up";
|
|
20
|
-
|
|
21
19
|
describe("dx-header", () => {
|
|
22
20
|
it("renders", () => {
|
|
23
21
|
const subtitle = "testsubtitle";
|
|
24
22
|
const element = render({ ...mockPropsDevelopers, subtitle });
|
|
25
23
|
const subtitleEl = element.shadowRoot.querySelector(".subtitle");
|
|
26
|
-
const buttons: Array<HTMLElement> =
|
|
27
|
-
"dx-button"
|
|
28
|
-
);
|
|
24
|
+
const buttons: Array<HTMLElement> =
|
|
25
|
+
element.shadowRoot.querySelectorAll("dx-button");
|
|
29
26
|
const dropdown = element.shadowRoot.querySelector("dx-dropdown");
|
|
30
27
|
const headerEl = element.shadowRoot.querySelector("dx-header-nav");
|
|
31
28
|
|
|
@@ -88,9 +85,8 @@ describe("dx-header", () => {
|
|
|
88
85
|
...mockPropsDevelopers,
|
|
89
86
|
versions: JSON.stringify([version])
|
|
90
87
|
});
|
|
91
|
-
const dropdown: Dropdown =
|
|
92
|
-
"dx-dropdown"
|
|
93
|
-
);
|
|
88
|
+
const dropdown: Dropdown =
|
|
89
|
+
element.shadowRoot.querySelector("dx-dropdown");
|
|
94
90
|
expect(dropdown).not.toBeNull();
|
|
95
91
|
expect(dropdown.options).toHaveLength(1);
|
|
96
92
|
|
|
@@ -180,9 +176,8 @@ describe("dx-header", () => {
|
|
|
180
176
|
bailLabel: "test",
|
|
181
177
|
signupLink: "/"
|
|
182
178
|
});
|
|
183
|
-
const buttons: Array<Button> =
|
|
184
|
-
"dx-button"
|
|
185
|
-
);
|
|
179
|
+
const buttons: Array<Button> =
|
|
180
|
+
element.shadowRoot.querySelectorAll("dx-button");
|
|
186
181
|
|
|
187
182
|
expect(buttons[0].href).toEqual("/");
|
|
188
183
|
expect(buttons[2].href).toEqual("test");
|
|
@@ -194,26 +189,48 @@ describe("dx-header", () => {
|
|
|
194
189
|
subtitle: mockPropsDevelopers.subtitle,
|
|
195
190
|
navItems: mockPropsDevelopers.navItems
|
|
196
191
|
});
|
|
197
|
-
const headerSearch =
|
|
198
|
-
"dx-header-search"
|
|
199
|
-
);
|
|
192
|
+
const headerSearch =
|
|
193
|
+
element.shadowRoot.querySelector("dx-header-search");
|
|
200
194
|
|
|
201
195
|
expect(headerSearch).toBeNull();
|
|
202
196
|
return expect(element).toBeAccessible();
|
|
203
197
|
});
|
|
204
198
|
|
|
205
|
-
it("signup button track is
|
|
199
|
+
it("signup button track is being called", () => {
|
|
206
200
|
const element = render(mockPropsDevelopers);
|
|
207
201
|
|
|
208
|
-
const button: HTMLElement =
|
|
209
|
-
"dx-button"
|
|
210
|
-
);
|
|
202
|
+
const button: HTMLElement =
|
|
203
|
+
element.shadowRoot.querySelector("dx-button");
|
|
211
204
|
|
|
212
205
|
button.click();
|
|
213
206
|
|
|
214
207
|
expect(track).toBeCalledTimes(1);
|
|
215
|
-
expect(track).toBeCalledWith(button,
|
|
216
|
-
|
|
208
|
+
expect(track).toBeCalledWith(button, "custEv_signupStart", {
|
|
209
|
+
...ANALYTICS_INFO,
|
|
210
|
+
clickUrl: "/sign-up"
|
|
217
211
|
});
|
|
218
212
|
});
|
|
213
|
+
|
|
214
|
+
it("hides signup button when signupLink property is empty", () => {
|
|
215
|
+
const updatedMockPropsDevelopers = {
|
|
216
|
+
...mockPropsDevelopers,
|
|
217
|
+
signupLink: ""
|
|
218
|
+
};
|
|
219
|
+
const element = render(updatedMockPropsDevelopers);
|
|
220
|
+
const signupButtonContainer: HTMLElement =
|
|
221
|
+
element.shadowRoot.querySelector(".header-login-signup");
|
|
222
|
+
expect(signupButtonContainer).toBeNull();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("hides banner when banner markup is empty", () => {
|
|
226
|
+
const bannerMarkup = "";
|
|
227
|
+
const updatedMockPropsDevelopers = {
|
|
228
|
+
...mockPropsDevelopers,
|
|
229
|
+
bannerMarkup
|
|
230
|
+
};
|
|
231
|
+
const element = render(updatedMockPropsDevelopers);
|
|
232
|
+
const bannerElement: HTMLElement =
|
|
233
|
+
element.shadowRoot.querySelector("dx-banner");
|
|
234
|
+
expect(bannerElement).toBeNull();
|
|
235
|
+
});
|
|
219
236
|
});
|
|
@@ -13,7 +13,13 @@ import {
|
|
|
13
13
|
mockNavAnalytics
|
|
14
14
|
} from "./mockNavs";
|
|
15
15
|
import mockNavDevelopers from "./mockNavDevelopers";
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
export const coveoConfig = {
|
|
18
|
+
coveoOrganizationId: "coveosalesforcetestakshatha",
|
|
19
|
+
coveoPublicAccessToken: "xx114e9d50-bc6b-40f1-b25b-fa5a06c7e168",
|
|
20
|
+
coveoSearchPipeline: "salesforcedevdoc",
|
|
21
|
+
coveoSearchHub: "salesforcedevdoc2"
|
|
22
|
+
};
|
|
17
23
|
|
|
18
24
|
const versions = JSON.stringify([
|
|
19
25
|
{
|
|
@@ -37,6 +43,7 @@ const versions = JSON.stringify([
|
|
|
37
43
|
export const mockPropsDevelopers = {
|
|
38
44
|
navItems: JSON.stringify(mockNavDevelopers),
|
|
39
45
|
subtitle: "Developers",
|
|
46
|
+
signupLink: "/sign-up",
|
|
40
47
|
...coveoConfig
|
|
41
48
|
};
|
|
42
49
|
|
|
@@ -45,15 +52,22 @@ export const mockPropsNoNavigation = {
|
|
|
45
52
|
...coveoConfig
|
|
46
53
|
};
|
|
47
54
|
|
|
55
|
+
export const mockPropsDevWebsite = {
|
|
56
|
+
version: "1",
|
|
57
|
+
versions,
|
|
58
|
+
...coveoConfig,
|
|
59
|
+
signupLink: "/sign-up",
|
|
60
|
+
bannerMarkup:
|
|
61
|
+
'<span><a href="https://forms.gle/TdSyKFPHXoBx7seM9" target="blank">Share your feedback</a>about our new site.</span>'
|
|
62
|
+
};
|
|
63
|
+
|
|
48
64
|
export const mockPropsEmployees = {
|
|
49
65
|
bailHref: "/quip-dev-center",
|
|
50
66
|
bailLabel: "Quip Development Center",
|
|
51
67
|
brand: "employees",
|
|
52
68
|
navItems: JSON.stringify(mockNavEmployees),
|
|
53
69
|
subtitle: "Employees",
|
|
54
|
-
|
|
55
|
-
versions,
|
|
56
|
-
...coveoConfig
|
|
70
|
+
...mockPropsDevWebsite
|
|
57
71
|
};
|
|
58
72
|
|
|
59
73
|
export const mockPropsMarketing = {
|
|
@@ -62,9 +76,7 @@ export const mockPropsMarketing = {
|
|
|
62
76
|
brand: "marketing",
|
|
63
77
|
navItems: JSON.stringify(mockNavMarketing),
|
|
64
78
|
subtitle: "Marketing",
|
|
65
|
-
|
|
66
|
-
versions,
|
|
67
|
-
...coveoConfig
|
|
79
|
+
...mockPropsDevWebsite
|
|
68
80
|
};
|
|
69
81
|
|
|
70
82
|
export const mockPropsPartners = {
|
|
@@ -73,9 +85,7 @@ export const mockPropsPartners = {
|
|
|
73
85
|
brand: "partners",
|
|
74
86
|
navItems: JSON.stringify(mockNavPartners),
|
|
75
87
|
subtitle: "Partners",
|
|
76
|
-
|
|
77
|
-
versions,
|
|
78
|
-
...coveoConfig
|
|
88
|
+
...mockPropsDevWebsite
|
|
79
89
|
};
|
|
80
90
|
|
|
81
91
|
export const mockPropsCommerce = {
|
|
@@ -84,9 +94,7 @@ export const mockPropsCommerce = {
|
|
|
84
94
|
brand: "commerce",
|
|
85
95
|
navItems: JSON.stringify(mockNavCommerce),
|
|
86
96
|
subtitle: "Commerce",
|
|
87
|
-
|
|
88
|
-
versions,
|
|
89
|
-
...coveoConfig
|
|
97
|
+
...mockPropsDevWebsite
|
|
90
98
|
};
|
|
91
99
|
|
|
92
100
|
export const mockPropsSales = {
|
|
@@ -95,9 +103,7 @@ export const mockPropsSales = {
|
|
|
95
103
|
brand: "sales",
|
|
96
104
|
navItems: JSON.stringify(mockNavSales),
|
|
97
105
|
subtitle: "Sales",
|
|
98
|
-
|
|
99
|
-
versions,
|
|
100
|
-
...coveoConfig
|
|
106
|
+
...mockPropsDevWebsite
|
|
101
107
|
};
|
|
102
108
|
|
|
103
109
|
export const mockPropsSuccess = {
|
|
@@ -106,9 +112,7 @@ export const mockPropsSuccess = {
|
|
|
106
112
|
brand: "success",
|
|
107
113
|
navItems: JSON.stringify(mockNavSuccess),
|
|
108
114
|
subtitle: "Success",
|
|
109
|
-
|
|
110
|
-
versions,
|
|
111
|
-
...coveoConfig
|
|
115
|
+
...mockPropsDevWebsite
|
|
112
116
|
};
|
|
113
117
|
|
|
114
118
|
export const mockPropsIntegration = {
|
|
@@ -117,9 +121,7 @@ export const mockPropsIntegration = {
|
|
|
117
121
|
brand: "integration",
|
|
118
122
|
navItems: JSON.stringify(mockNavIntegration),
|
|
119
123
|
subtitle: "Integration",
|
|
120
|
-
|
|
121
|
-
versions,
|
|
122
|
-
...coveoConfig
|
|
124
|
+
...mockPropsDevWebsite
|
|
123
125
|
};
|
|
124
126
|
|
|
125
127
|
export const mockPropsPlatform = {
|
|
@@ -128,9 +130,7 @@ export const mockPropsPlatform = {
|
|
|
128
130
|
brand: "platform",
|
|
129
131
|
navItems: JSON.stringify(mockNavPlatform),
|
|
130
132
|
subtitle: "Platform",
|
|
131
|
-
|
|
132
|
-
versions,
|
|
133
|
-
...coveoConfig
|
|
133
|
+
...mockPropsDevWebsite
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export const mockPropsIndustries = {
|
|
@@ -139,9 +139,7 @@ export const mockPropsIndustries = {
|
|
|
139
139
|
brand: "industries",
|
|
140
140
|
navItems: JSON.stringify(mockNavIndustries),
|
|
141
141
|
subtitle: "Industries",
|
|
142
|
-
|
|
143
|
-
versions,
|
|
144
|
-
...coveoConfig
|
|
142
|
+
...mockPropsDevWebsite
|
|
145
143
|
};
|
|
146
144
|
|
|
147
145
|
export const mockPropsLearning = {
|
|
@@ -150,9 +148,7 @@ export const mockPropsLearning = {
|
|
|
150
148
|
brand: "learning",
|
|
151
149
|
navItems: JSON.stringify(mockNavLearning),
|
|
152
150
|
subtitle: "Learning",
|
|
153
|
-
|
|
154
|
-
versions,
|
|
155
|
-
...coveoConfig
|
|
151
|
+
...mockPropsDevWebsite
|
|
156
152
|
};
|
|
157
153
|
|
|
158
154
|
export const mockPropsService = {
|
|
@@ -161,9 +157,7 @@ export const mockPropsService = {
|
|
|
161
157
|
brand: "service",
|
|
162
158
|
navItems: JSON.stringify(mockNavService),
|
|
163
159
|
subtitle: "Service",
|
|
164
|
-
|
|
165
|
-
versions,
|
|
166
|
-
...coveoConfig
|
|
160
|
+
...mockPropsDevWebsite
|
|
167
161
|
};
|
|
168
162
|
|
|
169
163
|
export const mockPropsAnalytics = {
|
|
@@ -172,7 +166,5 @@ export const mockPropsAnalytics = {
|
|
|
172
166
|
brand: "analytics",
|
|
173
167
|
navItems: JSON.stringify(mockNavAnalytics),
|
|
174
168
|
subtitle: "Analytics",
|
|
175
|
-
|
|
176
|
-
versions,
|
|
177
|
-
...coveoConfig
|
|
169
|
+
...mockPropsDevWebsite
|
|
178
170
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<dx-brand-theme-provider brand={brand}>
|
|
3
3
|
<header class={className}>
|
|
4
|
-
<dx-
|
|
4
|
+
<dx-banner
|
|
5
|
+
if:true={bannerMarkup}
|
|
6
|
+
banner-markup={bannerMarkup}
|
|
7
|
+
></dx-banner>
|
|
5
8
|
<div class="header_l1">
|
|
6
9
|
<dx-breadcrumbs
|
|
7
10
|
title={title}
|
|
@@ -82,6 +82,8 @@ const headerStoryGenerator = (
|
|
|
82
82
|
bail-label="Quip Development Center"
|
|
83
83
|
brand="${brand}"
|
|
84
84
|
breadcrumbs="${mockProps.breadcrumbs}"
|
|
85
|
+
signup-link="${mockProps.signupLink}"
|
|
86
|
+
banner-markup="${mockProps.bannerMarkup}"
|
|
85
87
|
></dx-header>`;
|
|
86
88
|
|
|
87
89
|
// ALL STORIES
|
|
@@ -140,3 +142,31 @@ export const Service = () =>
|
|
|
140
142
|
headerStoryGenerator(mockPropsService, "service", "Service");
|
|
141
143
|
export const Analytics = () =>
|
|
142
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
|
+
);
|
|
@@ -10,12 +10,15 @@ export default class Header extends HeaderBase {
|
|
|
10
10
|
get breadcrumbs() {
|
|
11
11
|
return this._breadcrumbs;
|
|
12
12
|
}
|
|
13
|
+
|
|
13
14
|
set breadcrumbs(value) {
|
|
14
15
|
this._breadcrumbs = toJson(value);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
private get showSignup(): boolean {
|
|
18
|
-
return
|
|
19
|
+
return this.signupLink
|
|
20
|
+
? (this.mobile && !this.isSearchOpen) || !this.mobile
|
|
21
|
+
: false;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
protected mobileBreakpoint(): string {
|