@epa-wg/custom-element-dist 0.0.31 → 0.0.33
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/.idea/inspectionProfiles/Project_Default.xml +2 -1
- package/.storybook/main.ts +3 -7
- package/.storybook/preview.ts +4 -6
- package/README.md +4 -4
- package/coverage/coverage-final.json +7 -18
- package/coverage/index.html +30 -30
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +719 -473
- package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
- package/coverage/src/custom-element/http-request.js.html +6 -6
- package/coverage/src/custom-element/index.html +29 -29
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js.html +31 -31
- package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
- package/coverage/src/custom-element/module-url.js.html +20 -20
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/{attributes.test.stories.ts → frame.canvas.ts}/coverage.svg +1 -1
- package/coverage/src/stories/frame.canvas.ts.html +175 -0
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +14 -179
- package/coverage/src/stories/testStoryBook.ts.html +8 -8
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-6slVaFEs.cjs +97 -0
- package/dist/custom-element-WnOqmEOe.js +609 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +30 -28
- package/dist/demo/a.html +51 -38
- package/dist/demo/attributes.html +153 -0
- package/dist/demo/data-slices.html +2 -2
- package/dist/demo/external-template.html +1 -0
- package/dist/demo/external-templates-sb-6.html +42 -0
- package/dist/demo/external-templates-sb-7.html +42 -0
- package/dist/demo/form.html +42 -0
- package/dist/demo/hex-grid-dce.html +1 -1
- package/dist/demo/hex-grid.html +1 -1
- package/dist/demo/html-template.html +1 -1
- package/dist/demo/module-url-sb-2.html +46 -0
- package/dist/demo/module-url-sb-4.html +48 -0
- package/dist/demo/module-url-sb-5.html +53 -0
- package/dist/demo/parameters.html +20 -1
- package/dist/demo/s.xml +66 -9
- package/dist/demo/s.xslt +89 -16
- package/dist/demo/ss.html +12 -22
- package/dist/mockServiceWorker.js +31 -8
- package/package.json +25 -26
- package/public/demo/a.html +51 -38
- package/public/demo/attributes.html +153 -0
- package/public/demo/data-slices.html +2 -2
- package/public/demo/external-template.html +1 -0
- package/public/demo/external-templates-sb-6.html +42 -0
- package/public/demo/external-templates-sb-7.html +42 -0
- package/public/demo/form.html +42 -0
- package/public/demo/hex-grid-dce.html +1 -1
- package/public/demo/hex-grid.html +1 -1
- package/public/demo/html-template.html +1 -1
- package/public/demo/module-url-sb-2.html +46 -0
- package/public/demo/module-url-sb-4.html +48 -0
- package/public/demo/module-url-sb-5.html +53 -0
- package/public/demo/parameters.html +20 -1
- package/public/demo/s.xml +66 -9
- package/public/demo/s.xslt +89 -16
- package/public/demo/ss.html +12 -22
- package/public/mockServiceWorker.js +31 -8
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +148 -66
- package/src/custom-element/demo/a.html +51 -38
- package/src/custom-element/demo/attributes.html +153 -0
- package/src/custom-element/demo/data-slices.html +2 -2
- package/src/custom-element/demo/external-template.html +1 -0
- package/src/custom-element/demo/form.html +42 -0
- package/src/custom-element/demo/hex-grid-dce.html +1 -1
- package/src/custom-element/demo/hex-grid.html +1 -1
- package/src/custom-element/demo/html-template.html +1 -1
- package/src/custom-element/demo/parameters.html +20 -1
- package/src/custom-element/demo/s.xml +66 -9
- package/src/custom-element/demo/s.xslt +89 -16
- package/src/custom-element/demo/ss.html +12 -22
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +1 -1
- package/src/material/components/badge.html +240 -0
- package/src/material/components/dropdown.html +26 -14
- package/src/material/components/icon-link.html +1 -0
- package/src/material/components/icon.html +253 -0
- package/src/material/components/input.html +571 -0
- package/src/material/components/menu.html +7 -5
- package/src/material/components.html +48 -11
- package/src/material/theme/semantic.css +20 -1
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
- package/src/stories/__screenshots__/external-template.test.stories.ts +1 -0
- package/src/stories/__screenshots__/module-url.test.stories.ts +1 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-and-slice-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +177 -11
- package/src/stories/external-template.test.stories.ts +17 -15
- package/src/stories/frame.canvas.ts +31 -0
- package/src/stories/module-url.test.stories.ts +29 -61
- package/storybook-static/assets/Color-F6OSRLHC-Cbp293x2.js +1 -0
- package/storybook-static/assets/Configure-BrFr4SLE.js +165 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-DhHzJiIO.js +2 -0
- package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +1 -0
- package/storybook-static/assets/attributes.test.stories-Gg9LQTEK.js +349 -0
- package/storybook-static/assets/{css.test.stories-Cgn6ICr0.js → css.test.stories-B_3ltOrx.js} +1 -1
- package/storybook-static/assets/custom-element-CPnvJnn8.js +97 -0
- package/storybook-static/assets/{dom-merge.test.stories-CBObfPWg.js → dom-merge.test.stories-nQxcgLoM.js} +1 -1
- package/storybook-static/assets/entry-preview-docs-Dwczwtsc.js +2 -0
- package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +1 -0
- package/storybook-static/assets/{external-template.test.stories-VfKUQ8eu.js → external-template.test.stories-DZ-rjnfd.js} +39 -41
- package/storybook-static/assets/{form.test.stories-CnuGN7Zw.js → form.test.stories-DQhPYtMj.js} +1 -1
- package/storybook-static/assets/frame.canvas-ClTqYyMN.js +1 -0
- package/storybook-static/assets/{handlers-V_T7WjNK.js → handlers-CLkps6Nz.js} +17 -14
- package/storybook-static/assets/{http-request.stories-8NN1Coqm.js → http-request.stories-jo0f73nw.js} +1 -1
- package/storybook-static/assets/iframe-CZwRpnn9.js +199 -0
- package/storybook-static/assets/index-B68YUdzy.js +621 -0
- package/storybook-static/assets/index-BwkS7JH_.js +8 -0
- package/storybook-static/assets/index-CJQtnF9V.js +1 -0
- package/storybook-static/assets/index-Dr4PwNfd.js +240 -0
- package/storybook-static/assets/{local-storage.test.stories-Dk5Yqc7m.js → local-storage.test.stories-uA5EKRPf.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-56um6s5L.js → location-element.test.stories-Cu-6Elcg.js} +1 -1
- package/storybook-static/assets/module-url.test.stories-CD_wusXQ.js +142 -0
- package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +1 -0
- package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
- package/storybook-static/assets/preview-BFlNN3Wj.js +1 -0
- package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
- package/storybook-static/assets/preview-Cm4PPhHS.js +50 -0
- package/storybook-static/assets/preview-CuCH40jj.js +2 -0
- package/storybook-static/assets/preview-DfTudP20.js +1 -0
- package/storybook-static/assets/{set-url.test.stories-B4E6hIe-.js → set-url.test.stories-CY7B9BVZ.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-BR0F-B6I.js → slice-events.test.stories-BVnPXm6e.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-CgfJIyCr.js → slots.test.stories-Dxsa9KdA.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-nmxATIwv.js → version-select.test.stories-Buga1PAa.js} +1 -1
- package/storybook-static/demo/a.html +51 -38
- package/storybook-static/demo/attributes.html +153 -0
- package/storybook-static/demo/data-slices.html +2 -2
- package/storybook-static/demo/external-template.html +1 -0
- package/storybook-static/demo/external-templates-sb-6.html +42 -0
- package/storybook-static/demo/external-templates-sb-7.html +42 -0
- package/storybook-static/demo/form.html +42 -0
- package/storybook-static/demo/hex-grid-dce.html +1 -1
- package/storybook-static/demo/hex-grid.html +1 -1
- package/storybook-static/demo/html-template.html +1 -1
- package/storybook-static/demo/module-url-sb-2.html +46 -0
- package/storybook-static/demo/module-url-sb-4.html +48 -0
- package/storybook-static/demo/module-url-sb-5.html +53 -0
- package/storybook-static/demo/parameters.html +20 -1
- package/storybook-static/demo/s.xml +66 -9
- package/storybook-static/demo/s.xslt +89 -16
- package/storybook-static/demo/ss.html +12 -22
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +6 -10
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +31 -8
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +391 -0
- package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +230 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-9/manager-bundle.js +58 -58
- package/storybook-static/sb-manager/globals-module-info.js +9 -0
- package/storybook-static/sb-manager/globals-runtime.js +10719 -10473
- package/storybook-static/sb-manager/runtime.js +4944 -6321
- package/coverage/src/stories/attributes.test.stories.ts.html +0 -514
- package/coverage/src/stories/css.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/css.test.stories.ts.html +0 -460
- package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/dom-merge.test.stories.ts.html +0 -706
- package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/external-template.test.stories.ts.html +0 -865
- package/coverage/src/stories/form.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/form.test.stories.ts.html +0 -661
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/local-storage.test.stories.ts.html +0 -1315
- package/coverage/src/stories/location-element.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/location-element.test.stories.ts.html +0 -523
- package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/module-url.test.stories.ts.html +0 -640
- package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/set-url.test.stories.ts.html +0 -433
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slice-events.test.stories.ts.html +0 -952
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slots.test.stories.ts.html +0 -742
- package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/version-select.test.stories.ts.html +0 -397
- package/dist/custom-element-BbJMY20-.cjs +0 -97
- package/dist/custom-element-CoRNKeEP.js +0 -567
- package/storybook-static/assets/Color-F6OSRLHC-CFyd3TND.js +0 -1
- package/storybook-static/assets/Configure-UGTbPRKK.js +0 -165
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Dpr5iB0o.js +0 -2
- package/storybook-static/assets/attributes.test.stories-DSOLHHOW.js +0 -152
- package/storybook-static/assets/custom-element-D59Fok1f.js +0 -97
- package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
- package/storybook-static/assets/iframe-DnhkgdtG.js +0 -2
- package/storybook-static/assets/index-3Sfy-t3H.js +0 -769
- package/storybook-static/assets/index-BcZLpTeD.js +0 -8
- package/storybook-static/assets/index-CIBI7sCB.js +0 -1
- package/storybook-static/assets/index-CxRwF5Or.js +0 -234
- package/storybook-static/assets/index-D-8MO0q_.js +0 -1
- package/storybook-static/assets/index-DN1RoK17.js +0 -1
- package/storybook-static/assets/index-DjJD7gkO.js +0 -1
- package/storybook-static/assets/module-url.test.stories-DEponQ7l.js +0 -208
- package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
- package/storybook-static/assets/preview-CNKoaWES.js +0 -1
- package/storybook-static/assets/preview-Czc-sw5H.js +0 -2
- package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
- package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
- package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
- package/storybook-static/assets/preview-vbpHsp94.js +0 -52
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -333
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -40
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
- package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
- package/storybook-static/sb-preview/globals.js +0 -33
- package/storybook-static/sb-preview/runtime.js +0 -7174
- package/test-runner-jest.config.js +0 -15
- /package/storybook-static/sb-addons/{essentials-actions-3 → essentials-actions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{essentials-controls-2 → essentials-controls-1}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{links-1 → essentials-docs-3}/manager-bundle.js.LEGAL.txt +0 -0
|
@@ -34,8 +34,12 @@
|
|
|
34
34
|
</head>
|
|
35
35
|
|
|
36
36
|
<body>
|
|
37
|
+
<custom-element tag="cem-icon" hidden src="./components/icon.html#cem-icon" ></custom-element>
|
|
38
|
+
<custom-element tag="cem-input" hidden src="./components/input.html#cem-input" ></custom-element>
|
|
37
39
|
<custom-element tag="cem-icon-link" hidden src="./components/icon-link.html#cem-icon-link" ></custom-element>
|
|
38
|
-
<custom-element tag="cem-menu"
|
|
40
|
+
<custom-element tag="cem-menu" hidden src="./components/menu.html#cem-menu"></custom-element>
|
|
41
|
+
<custom-element tag="cem-badge" hidden src="./components/badge.html#cem-badge" ></custom-element>
|
|
42
|
+
<custom-element tag="cem-dropdown" hidden src="./components/dropdown.html#cem-dropdown" ></custom-element>
|
|
39
43
|
|
|
40
44
|
<header class="cem-theme-teal">
|
|
41
45
|
<custom-element src="./index.html#nav-head" ></custom-element>
|
|
@@ -49,8 +53,10 @@
|
|
|
49
53
|
<attribute name="head"></attribute>
|
|
50
54
|
<attribute name="description"></attribute>
|
|
51
55
|
<style>
|
|
56
|
+
&{ display: flex;}
|
|
52
57
|
&>dce-root
|
|
53
|
-
{ display: inline-flex; flex-direction: column;
|
|
58
|
+
{ display: inline-flex; flex-direction: column; justify-content: space-between;
|
|
59
|
+
flex: 1;
|
|
54
60
|
transition: background .3s ease;
|
|
55
61
|
border: 1px solid #c4c6d0;
|
|
56
62
|
border-radius: 12px;
|
|
@@ -59,6 +65,7 @@
|
|
|
59
65
|
&>a
|
|
60
66
|
{ color: var(--cem-action-secondary-color, black);
|
|
61
67
|
background-color:var(--cem-action-secondary-background, silver);
|
|
68
|
+
min-height: 6rem;
|
|
62
69
|
transition: background .3s ease;
|
|
63
70
|
transform: translateZ(0);
|
|
64
71
|
&:hover { background-color: var(--cem-action-secondary-background-hover); }
|
|
@@ -79,7 +86,19 @@
|
|
|
79
86
|
</template>
|
|
80
87
|
</custom-element>
|
|
81
88
|
|
|
82
|
-
<demo-list-card head="icon
|
|
89
|
+
<demo-list-card head="icon" description="Icons from popular collections">
|
|
90
|
+
<cem-icon image="https://www.gstatic.com/images/icons/material/apps/fonts/1x/catalog/v5/favicon.svg"
|
|
91
|
+
>Material Icon </cem-icon>
|
|
92
|
+
<cem-icon image="recycling"
|
|
93
|
+
> Recycling </cem-icon>
|
|
94
|
+
|
|
95
|
+
</demo-list-card>
|
|
96
|
+
|
|
97
|
+
<demo-list-card head="input" description="Text input field">
|
|
98
|
+
<cem-input leading="search" label="Text input" supporting="required field"></cem-input>
|
|
99
|
+
</demo-list-card>
|
|
100
|
+
|
|
101
|
+
<demo-list-card head="icon-link" description="Button like link">
|
|
83
102
|
<cem-icon-link icon="format_color_fill"
|
|
84
103
|
title="Select a theme for the documentation"
|
|
85
104
|
href="./components/icon-link.html"
|
|
@@ -95,6 +114,16 @@
|
|
|
95
114
|
</cem-menu>
|
|
96
115
|
</demo-list-card>
|
|
97
116
|
|
|
117
|
+
<demo-list-card head="badge" description="A small value indicator that can be overlaid on another object.">
|
|
118
|
+
<template>
|
|
119
|
+
<div style="display: inline-flex; gap:2rem;">
|
|
120
|
+
<cem-badge text="0" color="secondary"><template> <cem-icon image="far fa-envelope" ></cem-icon> </template></cem-badge>
|
|
121
|
+
<cem-badge text="999+" ><template> <cem-icon image="🛒" vertical="middle" ></cem-icon> </template></cem-badge>
|
|
122
|
+
<cem-badge text="999+" dot ><template> <cem-icon image="notifications" vertical="middle" ></cem-icon> </template></cem-badge>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
</demo-list-card>
|
|
126
|
+
|
|
98
127
|
<demo-list-card head="autocomplete" description="Suggests relevant options as the user types.">
|
|
99
128
|
<cem-autocomplete placeholder="Greetings" >
|
|
100
129
|
<p>hello</p>
|
|
@@ -102,15 +131,23 @@
|
|
|
102
131
|
</cem-autocomplete>
|
|
103
132
|
</demo-list-card>
|
|
104
133
|
<demo-list-card head="dropdown" description="dropdown overlay which hangs above the background html">
|
|
105
|
-
<
|
|
106
|
-
|
|
134
|
+
<div>
|
|
135
|
+
<cem-dropdown label="drop base" >
|
|
136
|
+
<template>
|
|
137
|
+
<style>aside{background-color: silver; padding: 1rem; }</style>
|
|
138
|
+
dropped content
|
|
139
|
+
</template>
|
|
140
|
+
|
|
107
141
|
</cem-dropdown>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
<hr/>
|
|
143
|
+
<hr/>
|
|
144
|
+
<hr/>
|
|
145
|
+
<hr/>
|
|
146
|
+
<hr/>
|
|
147
|
+
<hr/>
|
|
148
|
+
<hr/>
|
|
149
|
+
<hr/>
|
|
150
|
+
</div>
|
|
114
151
|
</demo-list-card>
|
|
115
152
|
</main>
|
|
116
153
|
<footer>
|
|
@@ -51,9 +51,16 @@
|
|
|
51
51
|
/*#region semantic colors */
|
|
52
52
|
:root, .cem-theme-default, .cem-theme-azure{
|
|
53
53
|
|
|
54
|
+
--cem-icon-size: 2rem;
|
|
55
|
+
--cem-icon-size-small: 1rem;
|
|
56
|
+
--cem-icon-size-large: 3rem;
|
|
57
|
+
|
|
58
|
+
--cem-sys-body-small-size: .75rem;
|
|
59
|
+
--cem-form-field-subscript-text-size: var(--cem-sys-body-small-size);
|
|
60
|
+
|
|
54
61
|
--primary-background-color: var(--ng-azure-90);
|
|
55
62
|
--secondary-background-color: var(--ng-azure-80);
|
|
56
|
-
--alert-color: var(--ng-
|
|
63
|
+
--alert-color: var(--ng-error-40);
|
|
57
64
|
--text-color: var(--ng-azure-10);
|
|
58
65
|
|
|
59
66
|
--cem-action-primary-color: var(--text-color);
|
|
@@ -75,12 +82,17 @@
|
|
|
75
82
|
--cem-app-surface-variant: var(--ng-azure-variant-90);
|
|
76
83
|
--cem-app-on-surface: var(--ng-azure-variant-70);
|
|
77
84
|
--cem-app-primary: var(--ng-azure-variant-60);
|
|
85
|
+
--cem-on-surface-variant: var(--cem-action-secondary-color);
|
|
78
86
|
|
|
79
87
|
--cem-filled-text-field-container-color: var(--ng-azure-variant-90);
|
|
88
|
+
--cem-filled-text-field-container-color-hover: var(--ng-azure-variant-80);
|
|
80
89
|
--cem-filled-text-field-label-text-color: var(--ng-azure-variant-30);
|
|
81
90
|
--cem-filled-text-field-input-text-color: var(--ng-azure-variant-0);
|
|
82
91
|
--cem-filled-text-field-caret-color: var(--ng-azure-variant-10);
|
|
83
92
|
--cem-outline-color-focus: var(--ng-azure-40);
|
|
93
|
+
--cem-focus-outline-height: 3px;
|
|
94
|
+
--cem-input-outline-color: black;
|
|
95
|
+
--cem-input-outline: inset 0 -1px 0 var(--cem-input-outline-color,black);
|
|
84
96
|
|
|
85
97
|
--cem-list-background-color: var(--ng-azure-neutral-94);
|
|
86
98
|
--cem-list-background-color-hover: var(--ng-azure-variant-90);
|
|
@@ -93,6 +105,13 @@
|
|
|
93
105
|
--cem-menu-item-hover-color: black;
|
|
94
106
|
--cem-menu-item-padding: 0.5rem;
|
|
95
107
|
--cem-menu-item-font-weight: bold;
|
|
108
|
+
|
|
109
|
+
--cem-badge-color-primary: var(--ng-azure-50);
|
|
110
|
+
--cem-badge-color-secondary: var(--ng-magenta-50);
|
|
111
|
+
--cem-badge-color-success: var(--ng-cyan-60);
|
|
112
|
+
--cem-badge-color-alert: var(--ng-error-50);
|
|
113
|
+
--cem-badge-color: var(--cem-badge-color-primary);
|
|
114
|
+
|
|
96
115
|
}
|
|
97
116
|
|
|
98
117
|
.cem-theme-teal{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
Binary file
|
package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// noinspection DuplicatedCode
|
|
2
2
|
|
|
3
3
|
import type { StoryObj } from '@storybook/web-components';
|
|
4
|
-
import {expect, within} from '@storybook/test';
|
|
4
|
+
import {expect, userEvent, within} from '@storybook/test';
|
|
5
5
|
|
|
6
|
-
import '../custom-element/custom-element.js';
|
|
6
|
+
import {cloneAs, mix, mergeAttr} from'../custom-element/custom-element.js';
|
|
7
7
|
|
|
8
8
|
type TProps = { title: string; body:string};
|
|
9
9
|
|
|
@@ -29,14 +29,116 @@ const meta =
|
|
|
29
29
|
|
|
30
30
|
export default meta;
|
|
31
31
|
|
|
32
|
+
function html2Element( htmlStr: string)
|
|
33
|
+
{ const n = document.createElement('div');
|
|
34
|
+
n.innerHTML = htmlStr;
|
|
35
|
+
return n.firstElementChild as HTMLElement;
|
|
36
|
+
}
|
|
37
|
+
export const CloneAs:Story =
|
|
38
|
+
{ args : {title: 'cloneAs(el,newTag)', body:`
|
|
39
|
+
<p><code>cloneAs()</code> used for conversion of <code>attribute</code> to <code>xsl:param</code></p>
|
|
40
|
+
<attribute data-testid="t1" >default_P1 </attribute>
|
|
41
|
+
<attribute data-testid="t2" select="'always_p2'" ></attribute>
|
|
42
|
+
<attribute data-testid="t3" ></attribute>
|
|
43
|
+
`}
|
|
44
|
+
, play: async ({canvasElement}) =>
|
|
45
|
+
{
|
|
46
|
+
const canvas = within(canvasElement);
|
|
47
|
+
|
|
48
|
+
const cmp = async ( tid:string ) =>
|
|
49
|
+
{ const t1 = await canvas.findByTestId(tid);
|
|
50
|
+
const c1 = cloneAs(t1, 'xsl:param');
|
|
51
|
+
for( let a of t1.attributes )
|
|
52
|
+
{ await expect(a.value).toEqual(c1.getAttribute(a.name)); }
|
|
53
|
+
|
|
54
|
+
await expect( c1.textContent ).toEqual(t1.textContent);
|
|
55
|
+
}
|
|
56
|
+
await cmp('t1');
|
|
57
|
+
await cmp('t2');
|
|
58
|
+
await cmp('t3');
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const Mix:Story =
|
|
62
|
+
{ args : {title: 'mix(to,from)', body:`
|
|
63
|
+
<p><code>mix(to,from)</code> used for <code>attribute</code> collections</p>
|
|
64
|
+
`}
|
|
65
|
+
, play: async () =>
|
|
66
|
+
{
|
|
67
|
+
await expect( mix({},{a:1,b:'2'})).toEqual({a:1,b:'2'});
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const MergeAttr:Story =
|
|
71
|
+
{ args : {title: 'mergeAttr( from, to )', body:`
|
|
72
|
+
<p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
|
|
73
|
+
`}
|
|
74
|
+
, play: async () =>
|
|
75
|
+
{
|
|
76
|
+
const from = html2Element('<br title="a" id="b" readonly />');
|
|
77
|
+
const to = html2Element('<br removed/>');
|
|
78
|
+
|
|
79
|
+
await expect( to).toHaveAttribute('removed');
|
|
80
|
+
|
|
81
|
+
mergeAttr(from!,to);
|
|
82
|
+
|
|
83
|
+
await expect( to).toHaveAttribute('title','a');
|
|
84
|
+
await expect( to).toHaveAttribute('id','b');
|
|
85
|
+
await expect( to).toHaveAttribute('readonly');
|
|
86
|
+
await expect( to.getAttributeNames().length).toEqual(3);
|
|
87
|
+
await expect( to).not.toHaveAttribute('removed');
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export const dceExportedAttributes:Story =
|
|
91
|
+
{ args : {title: 'mergeAttr( from, to )', body:`
|
|
92
|
+
<p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
|
|
93
|
+
<p><code>dceExportedAttributes</code> property on target element defines the set of attributes which
|
|
94
|
+
would not be removed from target element</p>
|
|
95
|
+
`}
|
|
96
|
+
, play: async () =>
|
|
97
|
+
{
|
|
98
|
+
const from = html2Element('<br id="b" readonly />');
|
|
99
|
+
const to = html2Element('<br removed/>') as (HTMLElement & {dceExportedAttributes:Set<string>});
|
|
100
|
+
to.dceExportedAttributes = new Set(['enforced']);
|
|
101
|
+
to.setAttribute('enforced',"defined by inner component");
|
|
102
|
+
await expect( to).toHaveAttribute('enforced');
|
|
103
|
+
|
|
104
|
+
mergeAttr(from,to);
|
|
105
|
+
|
|
106
|
+
await expect( to).toHaveAttribute('id','b');
|
|
107
|
+
await expect( to).toHaveAttribute('readonly');
|
|
108
|
+
await expect( to).not.toHaveAttribute('removed');
|
|
109
|
+
await expect( to).toHaveAttribute('enforced',"defined by inner component");
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
export const dceExportedAttributes_attr:Story =
|
|
113
|
+
{ args : {title: 'mergeAttr( from, to )', body:`
|
|
114
|
+
<p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
|
|
115
|
+
<p><code>dce-exported-attributes</code> attribute on target element defines the space separated list of attributes which
|
|
116
|
+
would not be removed from target element</p>
|
|
117
|
+
`}
|
|
118
|
+
, play: async () =>
|
|
119
|
+
{
|
|
120
|
+
const from = html2Element('<br id="b" readonly />');
|
|
121
|
+
const to = html2Element('<br removed dce-exported-attributes="enforced"/>') as (HTMLElement & {dceExportedAttributes:Set<string>});
|
|
122
|
+
to.setAttribute('enforced',"defined by inner component");
|
|
123
|
+
await expect( to).toHaveAttribute('enforced');
|
|
124
|
+
|
|
125
|
+
mergeAttr(from,to);
|
|
126
|
+
|
|
127
|
+
await expect( to).toHaveAttribute('id','b');
|
|
128
|
+
await expect( to).toHaveAttribute('readonly');
|
|
129
|
+
await expect( to).not.toHaveAttribute('removed');
|
|
130
|
+
await expect( to).toHaveAttribute('enforced',"defined by inner component");
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
32
134
|
export const AttributeDefaults:Story =
|
|
33
135
|
{ args : {title: 'Attributes definition', body:`
|
|
34
136
|
<p>Params needed to declare DCE attributes and track the attributes changes. It also is used by IDE and validation.</p>
|
|
35
137
|
<custom-element tag="dce-link" >
|
|
36
138
|
<template>
|
|
37
|
-
<attribute name="p1">default_P1
|
|
139
|
+
<attribute name="p1">default_P1</attribute>
|
|
38
140
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
39
|
-
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
141
|
+
<attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
|
|
40
142
|
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
41
143
|
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
42
144
|
p3: <code data-testid="p3">{$p3}</code>
|
|
@@ -46,9 +148,7 @@ export const AttributeDefaults:Story =
|
|
|
46
148
|
`}
|
|
47
149
|
, play: async ({canvasElement}) =>
|
|
48
150
|
{
|
|
49
|
-
const
|
|
50
|
-
const canvas = within(canvasElement)
|
|
51
|
-
, code = async (id) => (await canvas.findByTestId(id)).textContent.trim();
|
|
151
|
+
const canvas = within(canvasElement);
|
|
52
152
|
|
|
53
153
|
expect( await await canvas.findByTestId('p1') ).toHaveTextContent('default_P1' );
|
|
54
154
|
expect( await await canvas.findByTestId('p2') ).toHaveTextContent('always_p2' );
|
|
@@ -63,14 +163,14 @@ export const AttributesRuntimeChange:Story =
|
|
|
63
163
|
<template>
|
|
64
164
|
<attribute name="p1">default_P1 </attribute>
|
|
65
165
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
66
|
-
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
166
|
+
<attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
|
|
67
167
|
p1: <code data-testid="t1">{$p1}</code> <br/>
|
|
68
168
|
p2: <code data-testid="t2">{$p2}</code> <br/>
|
|
69
169
|
p3: <code data-testid="t3">{$p3}</code>
|
|
70
170
|
</template>
|
|
71
171
|
</custom-element>
|
|
72
172
|
<section>
|
|
73
|
-
<dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br
|
|
173
|
+
<dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br/>
|
|
74
174
|
<div><input id="i1" value="P1"> <button onclick="dce2.setAttribute('p1',i1.value)"> set p1</button> </div>
|
|
75
175
|
<div><input id="i2" value="P2"> <button onclick="dce2.setAttribute('p2',i2.value)"> set p2</button> </div>
|
|
76
176
|
<div><input id="i3" value="P3"> <button onclick="dce2.setAttribute('p3',i3.value)"> set p3</button> </div>
|
|
@@ -109,7 +209,7 @@ export const InstanceAttributes:Story =
|
|
|
109
209
|
<template>
|
|
110
210
|
<attribute name="p1">default_P1 </attribute>
|
|
111
211
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
112
|
-
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
212
|
+
<attribute name="p3" select="//attributes/p3 ?? 'def_P3' "></attribute>
|
|
113
213
|
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
114
214
|
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
115
215
|
p3: <code data-testid="p3">{$p3}</code>
|
|
@@ -122,7 +222,7 @@ export const InstanceAttributes:Story =
|
|
|
122
222
|
const titleText = AttributeDefaults.args!.title as string;
|
|
123
223
|
const canvas = within(canvasElement)
|
|
124
224
|
, code = async (id) => (await canvas.findByTestId(id)).textContent.trim();
|
|
125
|
-
await sleep(
|
|
225
|
+
await sleep(200)
|
|
126
226
|
expect( await code('p1') ).toEqual('123' );
|
|
127
227
|
expect( await code('p2') ).toEqual('always_p2' );
|
|
128
228
|
expect( await code('p3') ).toEqual('qwe' );
|
|
@@ -130,6 +230,72 @@ export const InstanceAttributes:Story =
|
|
|
130
230
|
};
|
|
131
231
|
|
|
132
232
|
|
|
233
|
+
export const AttributesPropagationUp:Story =
|
|
234
|
+
{ args : {title: 'Instance Attributes', body:`
|
|
235
|
+
<p>Attributes with value(p2) or <code>select</code>(p3) should be propagated to DCE</p>
|
|
236
|
+
<p>p1 attribute is not propagated as does not have the value.</p>
|
|
237
|
+
<custom-element tag="sample-el">
|
|
238
|
+
<template>
|
|
239
|
+
<attribute name="data-testid"></attribute>
|
|
240
|
+
<attribute name="p1"></attribute>
|
|
241
|
+
<attribute name="p2">DEFAULT VALUE</attribute>
|
|
242
|
+
<attribute name="p3" select=" //from-input "></attribute>
|
|
243
|
+
<input slice="from-input" slice-event="input"/><br/>
|
|
244
|
+
p1:<code data-testid="{$data-testid}-p1" >{ $p1 }</code><br/>
|
|
245
|
+
p2:<code data-testid="{$data-testid}-p2" >{ $p2 }</code><br/>
|
|
246
|
+
p3:<code data-testid="{$data-testid}-p3" >{ $p3 }</code><br/>
|
|
247
|
+
//from-input: {//from-input} <hr/>
|
|
248
|
+
</template>
|
|
249
|
+
</custom-element>
|
|
250
|
+
|
|
251
|
+
<sample-el data-testid="t1" value="123" ></sample-el>
|
|
252
|
+
<sample-el data-testid="t2" p1="P1" p2="123" p3="P3" ></sample-el>
|
|
253
|
+
<sample-el data-testid="t3" ></sample-el>
|
|
254
|
+
`}
|
|
255
|
+
, play: async ({canvasElement}) =>
|
|
256
|
+
{
|
|
257
|
+
const canvas = within(canvasElement)
|
|
258
|
+
, code = async (id:string) => (await canvas.findByTestId(id)).textContent?.trim();
|
|
259
|
+
|
|
260
|
+
await sleep(20)
|
|
261
|
+
|
|
262
|
+
await expect( await code('t1-p1') ).toEqual('' );
|
|
263
|
+
await expect( await code('t1-p2') ).toEqual('DEFAULT VALUE' );
|
|
264
|
+
await expect( await code('t1-p3') ).toEqual('' );
|
|
265
|
+
|
|
266
|
+
const t1 = await canvas.findByTestId('t1');
|
|
267
|
+
await expect( t1 ).toHaveAttribute('value','123');
|
|
268
|
+
await expect( t1 ).toHaveAttribute('p2','DEFAULT VALUE');
|
|
269
|
+
await expect( t1 ).toHaveAttribute('p3','');
|
|
270
|
+
await expect( t1 ).not.toHaveAttribute('p1');
|
|
271
|
+
|
|
272
|
+
await expect( await code('t2-p1') ).toEqual('P1' );
|
|
273
|
+
await expect( await code('t2-p2') ).toEqual('123' );
|
|
274
|
+
await expect( await code('t2-p3') ).toEqual('' );
|
|
275
|
+
|
|
276
|
+
const t2 = await canvas.findByTestId('t2');
|
|
277
|
+
await expect( t2 ).toHaveAttribute('p1','P1');
|
|
278
|
+
await expect( t2 ).toHaveAttribute('p2','123');
|
|
279
|
+
await expect( t2 ).toHaveAttribute('p3','');
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
await expect( await code('t3-p1') ).toEqual('' );
|
|
283
|
+
await expect( await code('t3-p2') ).toEqual('DEFAULT VALUE' );
|
|
284
|
+
await expect( await code('t3-p3') ).toEqual('' );
|
|
285
|
+
|
|
286
|
+
const t3 = await canvas.findByTestId('t3');
|
|
287
|
+
await expect( t1 ).not.toHaveAttribute('p1');
|
|
288
|
+
await expect( t3 ).toHaveAttribute('p2','DEFAULT VALUE');
|
|
289
|
+
await expect( t3 ).toHaveAttribute('p3','');
|
|
290
|
+
|
|
291
|
+
t3.querySelector('input')?.focus();
|
|
292
|
+
await userEvent.keyboard('DCE');
|
|
293
|
+
await expect( t3 ).toHaveAttribute('p3','DCE');
|
|
294
|
+
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
|
|
133
299
|
//#region unit tests
|
|
134
300
|
/* istanbul ignore else -- @preserve */
|
|
135
301
|
if( 'test' === import.meta.env.MODE &&
|
|
@@ -4,7 +4,7 @@ import type { StoryObj } from '@storybook/web-components';
|
|
|
4
4
|
import {expect, getByTestId, within} from '@storybook/test';
|
|
5
5
|
|
|
6
6
|
import '../custom-element/custom-element.js';
|
|
7
|
-
import {
|
|
7
|
+
import {frameCanvas} from "./frame.canvas";
|
|
8
8
|
|
|
9
9
|
type TProps = { title: string; body:string};
|
|
10
10
|
|
|
@@ -44,7 +44,7 @@ export const TemplateInPage:Story =
|
|
|
44
44
|
{
|
|
45
45
|
const canvas = within(canvasElement);
|
|
46
46
|
await canvas.findByText(TemplateInPage.args!.title as string);
|
|
47
|
-
const
|
|
47
|
+
const val = (prop:string)=> canvas.getByTestId(prop).textContent?.trim();
|
|
48
48
|
|
|
49
49
|
expect(val('slot-override')).toEqual('👋 World!');
|
|
50
50
|
expect(val('slot-default' )).toEqual('Hello World!');
|
|
@@ -75,7 +75,7 @@ export const ExternalSvg:Story =
|
|
|
75
75
|
<template><i>loading from SVG ...</i></template>
|
|
76
76
|
</custom-element>
|
|
77
77
|
<dce-external></dce-external>
|
|
78
|
-
<custom-element src="confused.svg">
|
|
78
|
+
<custom-element src="/confused.svg">
|
|
79
79
|
<i>inline DCE loading from SVG ...</i>
|
|
80
80
|
</custom-element>
|
|
81
81
|
<custom-element src="no.svg">
|
|
@@ -92,7 +92,7 @@ export const ExternalSvg:Story =
|
|
|
92
92
|
// needs separate test
|
|
93
93
|
// await expect( await canvas.findByText('loading from SVG ...')).toBeInTheDocument();
|
|
94
94
|
|
|
95
|
-
expect(canvasElement.querySelector('[src="confused.svg"]').innerHTML).to.include('loading from SVG ...');
|
|
95
|
+
expect(canvasElement.querySelector('[src="/confused.svg"]').innerHTML).to.include('loading from SVG ...');
|
|
96
96
|
await expect(await canvas.findByText('fallback for missing image')).toBeInTheDocument();
|
|
97
97
|
await expect(await canvas.findByTitle('Confused')).toBeInTheDocument();
|
|
98
98
|
},
|
|
@@ -188,32 +188,34 @@ export const SvgWithinHtmlFile:Story =
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
export const MathMLWithinHtmlFile:Story =
|
|
191
|
-
{ args : {title: 'external HTML template - MathML by id', body:`
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
</custom-element>
|
|
191
|
+
{ args : {title: '6. external HTML template - MathML by id', body:`
|
|
192
|
+
<iframe src="/demo/external-templates-sb-6.html" data-testid="fr"></iframe>
|
|
193
|
+
|
|
195
194
|
`}
|
|
196
195
|
, play: async ({canvasElement}) =>
|
|
197
196
|
{
|
|
198
197
|
const canvas = within(canvasElement);
|
|
199
198
|
await canvas.findByText(MathMLWithinHtmlFile.args!.title as string);
|
|
200
|
-
const
|
|
199
|
+
const frCanvas = await frameCanvas('fr',canvas);
|
|
200
|
+
|
|
201
|
+
const ml = await frCanvas.findByTestId('ml-test');
|
|
201
202
|
expect(ml.firstElementChild.localName).toEqual('mrow');
|
|
202
203
|
},
|
|
203
204
|
};
|
|
204
205
|
|
|
205
206
|
export const ByIdWithinXsltFile:Story =
|
|
206
|
-
{ args : {title: 'external XHTML template - xsl by id', body:`
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
</custom-element>
|
|
207
|
+
{ args : {title: '7. external XHTML template - xsl by id', body:`
|
|
208
|
+
<iframe src="/demo/external-templates-sb-7.html" data-testid="fr"></iframe>
|
|
209
|
+
|
|
210
210
|
`}
|
|
211
211
|
, play: async ({canvasElement}) =>
|
|
212
212
|
{
|
|
213
213
|
const canvas = within(canvasElement);
|
|
214
214
|
await canvas.findByText(ByIdWithinXsltFile.args!.title as string);
|
|
215
|
-
const
|
|
216
|
-
|
|
215
|
+
const frCanvas = await frameCanvas('fr',canvas);
|
|
216
|
+
|
|
217
|
+
await expect( await frCanvas.findByText('whole XSLT is embedded into HTML body') ).toBeInTheDocument();
|
|
218
|
+
await expect( await frCanvas.findByText('./html-template.xhtml#embedded-xsl') ).toBeInTheDocument();
|
|
217
219
|
},
|
|
218
220
|
};
|
|
219
221
|
export const MissingIdWithinXsltFile:Story =
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {within} from "@storybook/test";
|
|
2
|
+
/*
|
|
3
|
+
example of use
|
|
4
|
+
|
|
5
|
+
import {frameCanvas} from "./frame.canvas";
|
|
6
|
+
|
|
7
|
+
export const ModuleByName:Story =
|
|
8
|
+
{ args : {title: '4. module path by symbolic name', body:`
|
|
9
|
+
<iframe src="../demo/module-url-sb-4.html" name="sb" data-testid="fr"></iframe>
|
|
10
|
+
|
|
11
|
+
`}
|
|
12
|
+
, play: async ({canvasElement}) =>
|
|
13
|
+
{
|
|
14
|
+
const canvas = within(canvasElement);
|
|
15
|
+
await canvas.findByText(ModuleByName.args!.title as string);
|
|
16
|
+
const frCanvas = await frameCanvas('fr',canvas);
|
|
17
|
+
|
|
18
|
+
await expect(await frCanvas.findByText('👌 from embed-relative-hash invoking')).toBeInTheDocument();
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
*/
|
|
22
|
+
export async function
|
|
23
|
+
frameCanvas(frameTestId: string, canvas: ReturnType<typeof within>)
|
|
24
|
+
: Promise<ReturnType<typeof within>>
|
|
25
|
+
{
|
|
26
|
+
const frEl: HTMLIFrameElement = await canvas.findByTestId(frameTestId);
|
|
27
|
+
return new Promise(resolve => frEl.addEventListener('load', () =>
|
|
28
|
+
{
|
|
29
|
+
resolve(within(frEl.contentWindow?.document.documentElement!));
|
|
30
|
+
}));
|
|
31
|
+
}
|