@salesforcedevs/docs-components 0.17.1 → 0.17.12-search-alpha
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 +17 -3
- package/package.json +18 -7
- package/src/modules/README.md +41 -0
- package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
- package/src/modules/doc/amfReference/amfReference.css +25 -0
- package/src/modules/doc/amfReference/amfReference.html +55 -0
- package/src/modules/doc/amfReference/amfReference.ts +1467 -0
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +125 -0
- package/src/modules/doc/amfTopic/amfTopic.css +21 -0
- package/src/modules/doc/amfTopic/amfTopic.html +3 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
- package/src/modules/doc/amfTopic/types.ts +56 -0
- package/src/modules/doc/amfTopic/utils.ts +136 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +183 -0
- package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
- package/src/modules/doc/componentPlayground/componentPlayground.html +20 -0
- package/src/modules/doc/componentPlayground/componentPlayground.ts +42 -0
- package/src/modules/doc/content/content.css +89 -70
- package/src/modules/doc/content/content.html +1 -0
- package/src/modules/doc/content/content.ts +188 -195
- package/src/modules/doc/contentCallout/contentCallout.css +18 -10
- package/src/modules/doc/contentCallout/contentCallout.html +13 -4
- package/src/modules/doc/contentCallout/contentCallout.ts +14 -2
- package/src/modules/doc/contentLayout/contentLayout.css +1 -0
- package/src/modules/doc/contentLayout/contentLayout.html +46 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +524 -0
- package/src/modules/doc/doDont/doDont.css +47 -0
- package/src/modules/doc/doDont/doDont.html +27 -0
- package/src/modules/doc/doDont/doDont.ts +17 -0
- package/src/modules/doc/header/header.css +70 -37
- package/src/modules/doc/header/header.html +41 -138
- package/src/modules/doc/header/header.ts +56 -78
- package/src/modules/doc/heading/heading.css +33 -0
- package/src/modules/doc/heading/heading.html +14 -0
- package/src/modules/doc/heading/heading.ts +67 -0
- package/src/modules/doc/headingAnchor/headingAnchor.css +3 -3
- package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
- package/src/modules/doc/headingContent/headingContent.css +53 -0
- package/src/modules/doc/headingContent/headingContent.html +13 -0
- package/src/modules/doc/headingContent/headingContent.ts +30 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +45 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +256 -0
- package/src/modules/doc/overview/overview.css +40 -0
- package/src/modules/doc/overview/overview.html +34 -0
- package/src/modules/doc/overview/overview.ts +12 -0
- package/src/modules/doc/phase/phase.css +21 -6
- package/src/modules/doc/phase/phase.html +15 -3
- package/src/modules/doc/phase/phase.ts +48 -12
- package/src/modules/doc/specificationContent/specificationContent.css +36 -0
- package/src/modules/doc/specificationContent/specificationContent.html +167 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +127 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/versionPicker/versionPicker.css +64 -0
- package/src/modules/doc/versionPicker/versionPicker.html +38 -0
- package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
- package/src/modules/doc/xmlContent/types.ts +120 -0
- package/src/modules/doc/xmlContent/utils.ts +163 -0
- package/src/modules/doc/xmlContent/xmlContent.css +54 -0
- package/src/modules/doc/xmlContent/xmlContent.html +54 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +763 -0
- package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
- package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
- package/src/modules/{helpers → docHelpers}/status/status.css +1 -1
- package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
- package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
- package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
- package/src/modules/docUtils/utils/utils.ts +32 -0
- package/LICENSE +0 -12
- package/src/modules/doc/content/__tests__/content.test.ts +0 -312
- package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -348
- package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/content/__tests__/mockSidebar.ts +0 -81
- package/src/modules/doc/content/content.stories.ts +0 -148
- package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
- package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
- package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
- package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
- package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
- package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
- package/src/modules/doc/header/__tests__/header.test.ts +0 -445
- package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
- package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/doc/header/__tests__/mockProps.ts +0 -152
- package/src/modules/doc/header/header.stories.ts +0 -190
- package/src/modules/doc/headingAnchor/__tests__/headingAnchor.test.ts +0 -111
- package/src/modules/doc/headingAnchor/headingAnchor.stories.ts +0 -33
- package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
- package/src/modules/doc/phase/__tests__/mockProps.ts +0 -13
- package/src/modules/doc/phase/__tests__/phase.test.ts +0 -60
- package/src/modules/doc/phase/phase.stories.ts +0 -12
- package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
- package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export default [
|
|
2
|
-
{
|
|
3
|
-
label: "Getting started",
|
|
4
|
-
name: "started",
|
|
5
|
-
isExpanded: true,
|
|
6
|
-
children: [
|
|
7
|
-
{
|
|
8
|
-
label: "Introduction",
|
|
9
|
-
name: "introduction"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
label: "Getting started",
|
|
13
|
-
name: "started-child"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: "Authentication",
|
|
17
|
-
name: "authentication"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: "Token",
|
|
21
|
-
name: "token"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Error",
|
|
25
|
-
name: "error"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "Limits",
|
|
29
|
-
name: "limit"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "Release note",
|
|
33
|
-
name: "release-note"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: "Einstein Vision",
|
|
39
|
-
name: "einstein-vision",
|
|
40
|
-
children: [
|
|
41
|
-
{
|
|
42
|
-
label: "Introduction",
|
|
43
|
-
name: "einstein-introduction"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "Terminology",
|
|
47
|
-
name: "terminology"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: "Object detection quickstart for beginner",
|
|
51
|
-
name: "object-quickstart",
|
|
52
|
-
isExpanded: true,
|
|
53
|
-
children: [
|
|
54
|
-
{
|
|
55
|
-
label: "Scenario: this block is intended to show how a large text looks like in the sidebar",
|
|
56
|
-
name: "scenario",
|
|
57
|
-
isExpanded: true,
|
|
58
|
-
children: [
|
|
59
|
-
{
|
|
60
|
-
label: "Scenario A: this block is intended to show how a large text looks like in the sidebar",
|
|
61
|
-
name: "scenario-a"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "Scenario B",
|
|
65
|
-
name: "scenario-b"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: "Prerequisites",
|
|
71
|
-
name: "prerequisites"
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: "Best Practices",
|
|
77
|
-
name: "best-practices"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
];
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import * as mockDocContent from "./__tests__/mockDocContent";
|
|
2
|
-
import mockPageReference from "./__tests__/mockPageReference";
|
|
3
|
-
import mockSidebar from "./__tests__/mockSidebar";
|
|
4
|
-
import { html } from "lit-html";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "docs/doc-content",
|
|
8
|
-
component: "doc-content",
|
|
9
|
-
|
|
10
|
-
argTypes: {
|
|
11
|
-
showPaginationButtons: {
|
|
12
|
-
defaultValue: false,
|
|
13
|
-
control: {
|
|
14
|
-
type: "boolean"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultArgs = {
|
|
21
|
-
pageReference: mockPageReference,
|
|
22
|
-
isStorybook: true
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Base = (args: any) => {
|
|
26
|
-
return `
|
|
27
|
-
<doc-content
|
|
28
|
-
is-storybook="${args.isStorybook}"
|
|
29
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
30
|
-
docs-data="${args.docsData}"
|
|
31
|
-
></doc-content>`;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Base.args = {
|
|
35
|
-
...defaultArgs,
|
|
36
|
-
docsData: mockDocContent.content
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Images = (args: any) => {
|
|
40
|
-
return `
|
|
41
|
-
<doc-content
|
|
42
|
-
is-storybook="${args.isStorybook}"
|
|
43
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
44
|
-
docs-data="${args.docsData}"
|
|
45
|
-
></doc-content>`;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Images.args = {
|
|
49
|
-
...defaultArgs,
|
|
50
|
-
docsData: mockDocContent.withImages
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const Table = (args: any) => html`
|
|
54
|
-
<doc-content
|
|
55
|
-
is-storybook="${args.isStorybook}"
|
|
56
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
57
|
-
docs-data="${args.docsData}"
|
|
58
|
-
>
|
|
59
|
-
</doc-content>
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
Table.args = {
|
|
63
|
-
...defaultArgs,
|
|
64
|
-
docsData: mockDocContent.withTable
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const Videos = (args: any) => {
|
|
68
|
-
return `
|
|
69
|
-
<doc-content
|
|
70
|
-
is-storybook="${args.isStorybook}"
|
|
71
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
72
|
-
docs-data="${args.docsData}"
|
|
73
|
-
></doc-content>`;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
Videos.args = {
|
|
77
|
-
...defaultArgs,
|
|
78
|
-
docsData: mockDocContent.withVideos
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const Notes = (args: any) => {
|
|
82
|
-
return `
|
|
83
|
-
<doc-content
|
|
84
|
-
is-storybook="${args.isStorybook}"
|
|
85
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
86
|
-
docs-data="${args.docsData}"
|
|
87
|
-
></doc-content>`;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
Notes.args = {
|
|
91
|
-
...defaultArgs,
|
|
92
|
-
docsData: mockDocContent.withNotes
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export const PaginationButtons = (args: any) => {
|
|
96
|
-
return `
|
|
97
|
-
<doc-content
|
|
98
|
-
is-storybook="${args.isStorybook}"
|
|
99
|
-
page-reference="${JSON.stringify(args.pageReference)}"
|
|
100
|
-
docs-data="${args.docsData}"
|
|
101
|
-
${args.showPaginationButtons ? `show-pagination-buttons=true` : ``}
|
|
102
|
-
></doc-content>`;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
PaginationButtons.args = {
|
|
106
|
-
...defaultArgs,
|
|
107
|
-
showPaginationButtons: false,
|
|
108
|
-
docsData: mockDocContent.withButtons
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export const HighlightedTerm = ({ docsData, trees }: any) => html`
|
|
112
|
-
<style>
|
|
113
|
-
.sb-show-main.sb-main-padded {
|
|
114
|
-
padding: 0;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.container {
|
|
118
|
-
display: flex;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
dx-sidebar {
|
|
122
|
-
--dx-c-sidebar-min-height: 100vh;
|
|
123
|
-
margin-right: 16px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
doc-content {
|
|
127
|
-
margin: 16px 16px;
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
130
|
-
|
|
131
|
-
<div class="container">
|
|
132
|
-
<dx-sidebar
|
|
133
|
-
header="Guides"
|
|
134
|
-
trees="${JSON.stringify(trees)}"
|
|
135
|
-
></dx-sidebar>
|
|
136
|
-
<doc-content
|
|
137
|
-
is-storybook="true"
|
|
138
|
-
page-reference="${JSON.stringify(mockPageReference)}"
|
|
139
|
-
docs-data="${docsData}"
|
|
140
|
-
></doc-content>
|
|
141
|
-
</div>
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
HighlightedTerm.args = {
|
|
145
|
-
...defaultArgs,
|
|
146
|
-
docsData: mockDocContent.sampleCodeBlockAndNote,
|
|
147
|
-
trees: mockSidebar
|
|
148
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import ContentCallout from "../contentCallout";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
-
import mockProps from "./mockProps";
|
|
4
|
-
|
|
5
|
-
const TAG = "dx-content-callout";
|
|
6
|
-
const render = createRenderComponent(TAG, ContentCallout);
|
|
7
|
-
|
|
8
|
-
describe(TAG, () => {
|
|
9
|
-
it("renders the icon, title & body with the tip variant", async () => {
|
|
10
|
-
const element = render({
|
|
11
|
-
title: mockProps.title,
|
|
12
|
-
variant: "tip"
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const els = [
|
|
16
|
-
".dx-callout-icon",
|
|
17
|
-
".dx-callout-title",
|
|
18
|
-
".dx-callout-body",
|
|
19
|
-
".dx-callout-tip"
|
|
20
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
21
|
-
|
|
22
|
-
expect(els).not.toContain(null);
|
|
23
|
-
|
|
24
|
-
await expect(element).toBeAccessible();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("renders the icon, title & body with the warning variant", async () => {
|
|
28
|
-
const element = render({
|
|
29
|
-
title: mockProps.title,
|
|
30
|
-
variant: "warning"
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const els = [
|
|
34
|
-
".dx-callout-icon",
|
|
35
|
-
".dx-callout-title",
|
|
36
|
-
".dx-callout-body",
|
|
37
|
-
".dx-callout-warning"
|
|
38
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
39
|
-
|
|
40
|
-
expect(els).not.toContain(null);
|
|
41
|
-
|
|
42
|
-
await expect(element).toBeAccessible();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("renders the icon, title & body with the note variant", async () => {
|
|
46
|
-
const element = render({
|
|
47
|
-
title: mockProps.title,
|
|
48
|
-
variant: "note"
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const els = [
|
|
52
|
-
".dx-callout-icon",
|
|
53
|
-
".dx-callout-title",
|
|
54
|
-
".dx-callout-body",
|
|
55
|
-
".dx-callout-note"
|
|
56
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
57
|
-
|
|
58
|
-
expect(els).not.toContain(null);
|
|
59
|
-
|
|
60
|
-
await expect(element).toBeAccessible();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("renders the icon, title & body with the caution variant", async () => {
|
|
64
|
-
const element = render({
|
|
65
|
-
title: mockProps.title,
|
|
66
|
-
variant: "caution"
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const els = [
|
|
70
|
-
".dx-callout-icon",
|
|
71
|
-
".dx-callout-title",
|
|
72
|
-
".dx-callout-body",
|
|
73
|
-
".dx-callout-caution"
|
|
74
|
-
].map((query) => element.shadowRoot.querySelector(query));
|
|
75
|
-
|
|
76
|
-
expect(els).not.toContain(null);
|
|
77
|
-
|
|
78
|
-
await expect(element).toBeAccessible();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
body: `<ul class="ul bulletList">
|
|
3
|
-
<li class="li">Apex SOAP web services allow an external application to invoke Apex methods
|
|
4
|
-
through SOAP Web services. <a class="xref" href="docs/atlas.en-us.226.0.apexcode.meta/apexcode/apex_callouts.htm" data-id="docs/atlas.en-us.226.0.apexcode.meta/apexcode/apex_callouts.htm">Apex callouts</a> enable Apex to invoke external web or HTTP
|
|
5
|
-
services.</li>
|
|
6
|
-
|
|
7
|
-
<li class="li">Apex REST API exposes your Apex classes and methods as REST web services. See
|
|
8
|
-
<a class="xref" href="docs/atlas.en-us.226.0.apexcode.meta/apexcode/apex_rest.htm" title="You can expose your Apex classes and methods so that external applications can access your code and your application through the REST architecture." data-id="docs/atlas.en-us.226.0.apexcode.meta/apexcode/apex_rest.htm">Exposing Apex Classes as REST Web
|
|
9
|
-
Services</a>.</li>
|
|
10
|
-
|
|
11
|
-
</ul>`,
|
|
12
|
-
title: "Caution",
|
|
13
|
-
variant: "Caution"
|
|
14
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import mockProps from "./__tests__/mockProps";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "docs/doc-content-callout",
|
|
5
|
-
component: "doc-content-callout"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const Base = (args: any) => `
|
|
9
|
-
<style>
|
|
10
|
-
doc-content-callout {
|
|
11
|
-
display:block;
|
|
12
|
-
margin-bottom:12px;
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
<doc-content-callout title='Note'variant="note">
|
|
16
|
-
${args.body}
|
|
17
|
-
</doc-content-callout>
|
|
18
|
-
<doc-content-callout title='Tip'variant="tip">
|
|
19
|
-
${args.body}
|
|
20
|
-
</doc-content-callout>
|
|
21
|
-
<doc-content-callout title='Warning' variant="warning">
|
|
22
|
-
${args.body}
|
|
23
|
-
</doc-content-callout>
|
|
24
|
-
<doc-content-callout title='Caution' variant="caution">
|
|
25
|
-
${args.body}
|
|
26
|
-
</doc-content-callout>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
Base.args = mockProps;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import ContentMedia from "doc/contentMedia";
|
|
2
|
-
import { createRenderComponent } from "utils/tests";
|
|
3
|
-
|
|
4
|
-
const TAG = "doc-content-media";
|
|
5
|
-
const render = createRenderComponent(TAG, ContentMedia);
|
|
6
|
-
|
|
7
|
-
describe(TAG, () => {
|
|
8
|
-
const originalConsole = global.console;
|
|
9
|
-
|
|
10
|
-
beforeAll(() => {
|
|
11
|
-
global.console = { ...global.console, error: jest.fn() };
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
jest.clearAllMocks();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
afterAll(() => {
|
|
19
|
-
global.console = originalConsole;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("renders image with passed in props", () => {
|
|
23
|
-
const element = render({
|
|
24
|
-
mediaTitle: "test title",
|
|
25
|
-
contentType: "image",
|
|
26
|
-
contentSrc: "https://placekitten.com/400/300",
|
|
27
|
-
caption: "test caption"
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const title = element.shadowRoot.querySelector(".content-media-title");
|
|
31
|
-
expect(title).not.toBeNull();
|
|
32
|
-
expect(title.textContent).toBe("test title");
|
|
33
|
-
|
|
34
|
-
const caption = element.shadowRoot.querySelector(
|
|
35
|
-
".content-media-caption"
|
|
36
|
-
);
|
|
37
|
-
expect(caption).not.toBeNull();
|
|
38
|
-
expect(caption.textContent).toBe("test caption");
|
|
39
|
-
|
|
40
|
-
const image = element.shadowRoot.querySelector(
|
|
41
|
-
".content-media-image img"
|
|
42
|
-
);
|
|
43
|
-
expect(image).not.toBeNull();
|
|
44
|
-
expect(image.src).toBe("https://placekitten.com/400/300");
|
|
45
|
-
|
|
46
|
-
return expect(element).toBeAccessible();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("renders iframe with passed in props", () => {
|
|
50
|
-
const element = render({
|
|
51
|
-
mediaTitle: "test title",
|
|
52
|
-
contentType: "iframe",
|
|
53
|
-
contentSrc: "https://www.youtube.com/embed/DfV7WnyEPTE",
|
|
54
|
-
caption: "test caption"
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const title = element.shadowRoot.querySelector(".content-media-title");
|
|
58
|
-
expect(title).not.toBeNull();
|
|
59
|
-
expect(title.textContent).toBe("test title");
|
|
60
|
-
|
|
61
|
-
const caption = element.shadowRoot.querySelector(
|
|
62
|
-
".content-media-caption"
|
|
63
|
-
);
|
|
64
|
-
expect(caption).not.toBeNull();
|
|
65
|
-
expect(caption.textContent).toBe("test caption");
|
|
66
|
-
|
|
67
|
-
const iframe = element.shadowRoot.querySelector(
|
|
68
|
-
".content-media-iframe iframe"
|
|
69
|
-
);
|
|
70
|
-
expect(iframe).not.toBeNull();
|
|
71
|
-
expect(iframe.src).toBe("https://www.youtube.com/embed/DfV7WnyEPTE");
|
|
72
|
-
|
|
73
|
-
return expect(element).toBeAccessible();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("doesn't render title or caption when not provided", () => {
|
|
77
|
-
const element = render({
|
|
78
|
-
contentType: "iframe",
|
|
79
|
-
contentSrc: "https://www.youtube.com/embed/DfV7WnyEPTE"
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const title = element.shadowRoot.querySelector(".content-media-title");
|
|
83
|
-
expect(title).toBeNull();
|
|
84
|
-
|
|
85
|
-
const caption = element.shadowRoot.querySelector(
|
|
86
|
-
".content-media-caption"
|
|
87
|
-
);
|
|
88
|
-
expect(caption).toBeNull();
|
|
89
|
-
|
|
90
|
-
expect(global.console.error).toBeCalledTimes(1);
|
|
91
|
-
expect(global.console.error).toBeCalledWith(
|
|
92
|
-
"media-title must be specified when using iframe-src attribute."
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return expect(element).toBeAccessible();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "docs/doc-content-media",
|
|
5
|
-
component: "doc-content-media"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// prettier-ignore
|
|
9
|
-
const styles = () => html `
|
|
10
|
-
<style>
|
|
11
|
-
.container-sm {
|
|
12
|
-
max-width: 540px;
|
|
13
|
-
margin: 0 auto;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.container-fw {
|
|
17
|
-
width: 100%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
h1 {
|
|
21
|
-
font-size: 36px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
h2 {
|
|
25
|
-
font-size: 24px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
h1, h2 {
|
|
29
|
-
font-weight: bold;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
// prettier-ignore
|
|
35
|
-
export const Base = () => html`${styles()}
|
|
36
|
-
<div class="container-sm">
|
|
37
|
-
<h1>Small Container</h1>
|
|
38
|
-
<h2>Images</h2>
|
|
39
|
-
<doc-content-media
|
|
40
|
-
content-type="image"
|
|
41
|
-
content-src="https://placekitten.com/400/300"
|
|
42
|
-
media-title="A cute kitten"
|
|
43
|
-
caption="An incredibly cute kitten"
|
|
44
|
-
></doc-content-media>
|
|
45
|
-
<doc-content-media
|
|
46
|
-
content-type="image"
|
|
47
|
-
content-src="https://placekitten.com/400/300"
|
|
48
|
-
media-title="A cute kitten"
|
|
49
|
-
></doc-content-media>
|
|
50
|
-
<doc-content-media
|
|
51
|
-
content-type="image"
|
|
52
|
-
content-src="https://placekitten.com/400/300"
|
|
53
|
-
caption="An incredibly cute kitten"
|
|
54
|
-
></doc-content-media>
|
|
55
|
-
<doc-content-media
|
|
56
|
-
content-type="image"
|
|
57
|
-
content-src="https://placekitten.com/400/300"
|
|
58
|
-
></doc-content-media>
|
|
59
|
-
|
|
60
|
-
<h2>IFrames</h2>
|
|
61
|
-
<doc-content-media
|
|
62
|
-
content-type="iframe"
|
|
63
|
-
content-src="https://www.youtube.com/embed/DfV7WnyEPTE"
|
|
64
|
-
media-title="Master Lightning Web Components in 8 Easy Steps (1)"
|
|
65
|
-
caption="Lightning Web Components are a new development platform for Salesforce."
|
|
66
|
-
></doc-content-media>
|
|
67
|
-
<doc-content-media
|
|
68
|
-
content-type="iframe"
|
|
69
|
-
content-src="https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline"
|
|
70
|
-
media-title="Non-YouTube Video"
|
|
71
|
-
caption="doc-content-media supports iframes from any origin."
|
|
72
|
-
></doc-content-media>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="container-fw">
|
|
76
|
-
<h1>Full-width Container</h1>
|
|
77
|
-
<h2>Images</h2>
|
|
78
|
-
<doc-content-media
|
|
79
|
-
content-type="image"
|
|
80
|
-
content-src="https://placekitten.com/400/300"
|
|
81
|
-
media-title="A cute kitten"
|
|
82
|
-
caption="An incredibly cute kitten"
|
|
83
|
-
></doc-content-media>
|
|
84
|
-
<doc-content-media
|
|
85
|
-
content-type="image"
|
|
86
|
-
content-src="https://placekitten.com/400/300"
|
|
87
|
-
media-title="A cute kitten"
|
|
88
|
-
></doc-content-media>
|
|
89
|
-
<doc-content-media
|
|
90
|
-
content-type="image"
|
|
91
|
-
content-src="https://placekitten.com/400/300"
|
|
92
|
-
caption="An incredibly cute kitten"
|
|
93
|
-
></doc-content-media>
|
|
94
|
-
<doc-content-media
|
|
95
|
-
content-type="image"
|
|
96
|
-
content-src="https://placekitten.com/400/300"
|
|
97
|
-
></doc-content-media>
|
|
98
|
-
|
|
99
|
-
<h2>IFrames</h2>
|
|
100
|
-
<doc-content-media
|
|
101
|
-
content-type="iframe"
|
|
102
|
-
content-src="https://www.youtube.com/embed/DfV7WnyEPTE"
|
|
103
|
-
media-title="Master Lightning Web Components in 8 Easy Steps (1)"
|
|
104
|
-
caption="Lightning Web Components are a new development platform for Salesforce."
|
|
105
|
-
></doc-content-media>
|
|
106
|
-
<doc-content-media
|
|
107
|
-
content-type="iframe"
|
|
108
|
-
content-src="https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline"
|
|
109
|
-
media-title="Non-YouTube Video"
|
|
110
|
-
caption="doc-content-media supports iframes from any origin."
|
|
111
|
-
></doc-content-media>
|
|
112
|
-
</div>
|
|
113
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// TODO: Move coveoConfig to a specific module to share it.
|
|
2
|
-
export const coveoConfig = {
|
|
3
|
-
coveoOrganizationId: "coveosalesforcetestakshatha",
|
|
4
|
-
coveoPublicAccessToken: "xx8d9c92ef-1018-4d92-a3c7-647dff01c21c",
|
|
5
|
-
coveoSearchPipeline: "salesforcedevdoc",
|
|
6
|
-
coveoSearchHub: "salesforcedevdoc"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
mobile: false,
|
|
11
|
-
...coveoConfig
|
|
12
|
-
};
|