@salesforcedevs/docs-components 0.15.0 → 0.16.2
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 +2 -2
- package/src/modules/doc/header/__tests__/header.test.ts +24 -1
- package/src/modules/doc/header/__tests__/mockProps.ts +3 -0
- package/src/modules/doc/header/header.html +4 -1
- package/src/modules/doc/header/header.stories.ts +30 -0
- package/src/modules/doc/header/header.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.2",
|
|
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": "4695c8e7dc16a958beb7717cfe01e432c57f5872"
|
|
18
18
|
}
|
|
@@ -104,7 +104,7 @@ describe(TAG, () => {
|
|
|
104
104
|
expect(headerEl).not.toBeNull();
|
|
105
105
|
expect(headerEl.classList).toHaveLength(0);
|
|
106
106
|
|
|
107
|
-
expect(headerEl.querySelector("dx-
|
|
107
|
+
expect(headerEl.querySelector("dx-banner")).not.toBeNull();
|
|
108
108
|
|
|
109
109
|
const logo = element.shadowRoot.querySelector("dx-logo");
|
|
110
110
|
expect(logo).not.toBeNull();
|
|
@@ -307,6 +307,29 @@ describe(TAG, () => {
|
|
|
307
307
|
clickText: SIGN_UP_LABEL
|
|
308
308
|
});
|
|
309
309
|
});
|
|
310
|
+
|
|
311
|
+
it("hides signup button when signupLink property is empty", () => {
|
|
312
|
+
const updatedMockPropsDevelopers = {
|
|
313
|
+
...mockPropsDevelopers,
|
|
314
|
+
signupLink:""
|
|
315
|
+
};
|
|
316
|
+
const element = render(updatedMockPropsDevelopers);
|
|
317
|
+
const signupButtonContainer: HTMLElement =
|
|
318
|
+
element.shadowRoot.querySelector(".header-login-signup");
|
|
319
|
+
expect(signupButtonContainer).toBeNull();
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("hides banner when banner markup is empty", () => {
|
|
323
|
+
const bannerMarkup = "";
|
|
324
|
+
const updatedMockPropsDevelopers = {
|
|
325
|
+
...mockPropsDevelopers,
|
|
326
|
+
bannerMarkup
|
|
327
|
+
};
|
|
328
|
+
const element = render(updatedMockPropsDevelopers);
|
|
329
|
+
const bannerElement: HTMLElement =
|
|
330
|
+
element.shadowRoot.querySelector("dx-banner");
|
|
331
|
+
expect(bannerElement).toBeNull();
|
|
332
|
+
});
|
|
310
333
|
});
|
|
311
334
|
|
|
312
335
|
describe("tablet", () => {
|
|
@@ -32,6 +32,9 @@ export const mockPropsDevelopers = {
|
|
|
32
32
|
title: "Salesforce Developers",
|
|
33
33
|
subtitle: "Apex Developer Guides",
|
|
34
34
|
languages,
|
|
35
|
+
signupLink: "/sign-up",
|
|
36
|
+
bannerMarkup:
|
|
37
|
+
'<span><a href="https://forms.gle/TdSyKFPHXoBx7seM9" target="blank">Share your feedback</a>about our new site.</span>',
|
|
35
38
|
...coveoConfig
|
|
36
39
|
};
|
|
37
40
|
|
|
@@ -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
|
<div if:true={showMenuButton} class="nav_menu-ctas">
|
|
7
10
|
<dx-button
|
|
@@ -101,6 +101,8 @@ const headerStoryGenerator = (
|
|
|
101
101
|
bail-label="${args.bailLabel}"
|
|
102
102
|
brand="${brand}"
|
|
103
103
|
onclick="headerClick(event)"
|
|
104
|
+
signup-link="${mockProps.signupLink}"
|
|
105
|
+
banner-markup="${mockProps.bannerMarkup}"
|
|
104
106
|
></doc-header>`;
|
|
105
107
|
|
|
106
108
|
export const Base = (args: any) => html`
|
|
@@ -158,3 +160,31 @@ export const Service = (args: any) =>
|
|
|
158
160
|
|
|
159
161
|
export const Analytics = (args: any) =>
|
|
160
162
|
headerStoryGenerator(mockPropsAnalytics, "analytics", args);
|
|
163
|
+
|
|
164
|
+
export const AnalyticsWithoutSignup = (args: any) =>
|
|
165
|
+
headerStoryGenerator(
|
|
166
|
+
{ ...mockPropsAnalytics, signupLink:"" },
|
|
167
|
+
"analytics",
|
|
168
|
+
args
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
export const AnalyticsWithCustomBannerText = (args: any) =>
|
|
172
|
+
headerStoryGenerator(
|
|
173
|
+
{
|
|
174
|
+
...mockPropsMarketing,
|
|
175
|
+
bannerMarkup:
|
|
176
|
+
'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.'
|
|
177
|
+
},
|
|
178
|
+
"analytics",
|
|
179
|
+
args
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
export const AnalyticsWithoutBanner = (args: any) =>
|
|
183
|
+
headerStoryGenerator(
|
|
184
|
+
{
|
|
185
|
+
...mockPropsMarketing,
|
|
186
|
+
bannerMarkup: ""
|
|
187
|
+
},
|
|
188
|
+
"analytics",
|
|
189
|
+
args
|
|
190
|
+
);
|
|
@@ -63,7 +63,9 @@ export default class Header extends HeaderBase {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
private get showSignup(): boolean {
|
|
66
|
-
return
|
|
66
|
+
return this.signupLink
|
|
67
|
+
? (this.tablet && !this.isSearchOpen) || !this.tablet
|
|
68
|
+
: false;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
private get hasLanguages(): boolean {
|