@epa-wg/custom-element-dist 0.0.21 → 0.0.22
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/README.md +4 -4
- package/coverage/coverage-final.json +15 -11
- package/coverage/index.html +25 -25
- 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 +604 -421
- package/coverage/src/custom-element/custom-element1-1.js/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element1-1.js.html +2374 -0
- package/coverage/src/custom-element/custom-element1.js/coverage.svg +10 -0
- package/coverage/src/custom-element/custom-element1.js.html +2374 -0
- package/coverage/src/custom-element/http-request.js.html +10 -10
- package/coverage/src/custom-element/index.html +49 -19
- package/coverage/src/custom-element/local-storage.js.html +6 -6
- package/coverage/src/custom-element/location-element.js.html +1 -1
- 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/{attributes.stories.ts.html → attributes.test.stories.ts.html} +51 -15
- package/coverage/src/stories/{css.stories.ts.html → css.test.stories.ts.html} +77 -17
- package/coverage/src/stories/{dom-merge.stories.ts.html → dom-merge.test.stories.ts.html} +60 -12
- package/coverage/src/stories/{external-template.stories.ts.html → external-template.test.stories.ts.html} +42 -12
- package/coverage/src/stories/form.test.stories.ts.html +658 -0
- package/coverage/src/stories/http-request.stories.ts.html +7 -7
- package/coverage/src/stories/index.html +71 -41
- package/coverage/src/stories/{local-storage.stories.ts.html → local-storage.test.stories.ts.html} +56 -20
- package/coverage/src/stories/{location-element.stories.ts.html → location-element.test.stories.ts.html} +53 -17
- package/coverage/src/stories/renderPlay.ts.html +12 -15
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/{slice-events.stories.ts.html → slice-events.test.stories.ts.html} +264 -15
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/slots.test.stories.ts.html +739 -0
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-BISbI4SU.js +463 -0
- package/dist/custom-element-N-sWiqGK.cjs +53 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +2 -2
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +4 -4
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +103 -42
- package/src/custom-element/custom-element1-1.js +763 -0
- package/src/custom-element/custom-element1.js +763 -0
- package/src/custom-element/custom-element1.js0 +750 -0
- package/src/custom-element/custom-element2.js0 +759 -0
- package/src/custom-element/custom-element3.js0 +763 -0
- package/src/custom-element/demo/a.html +38 -41
- package/src/custom-element/demo/b.html +13 -0
- package/src/custom-element/demo/data-slices.html +32 -0
- package/src/custom-element/demo/form.html +193 -0
- package/src/custom-element/demo/s.xml +19 -14
- package/src/custom-element/demo/s.xslt +22 -38
- package/src/custom-element/demo/s1.xslt +60 -0
- package/src/custom-element/ide/customData-dce.json +14 -1
- package/src/custom-element/ide/web-types-dce.json +6 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +1 -0
- package/src/custom-element.test.ts +24 -8
- package/src/stories/{attributes.stories.ts → attributes.test.stories.ts} +19 -7
- package/src/stories/{css.stories.ts → css.test.stories.ts} +29 -9
- package/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts} +19 -3
- package/src/stories/{external-template.stories.ts → external-template.test.stories.ts} +13 -3
- package/src/stories/form.test.stories.ts +191 -0
- package/src/stories/http-request.stories.ts +6 -6
- package/src/stories/http-request.test.ts +0 -9
- package/src/stories/{local-storage.stories.ts → local-storage.test.stories.ts} +24 -12
- package/src/stories/{location-element.stories.ts → location-element.test.stories.ts} +21 -9
- package/src/stories/renderPlay.ts +1 -2
- package/src/stories/{slice-events.stories.ts → slice-events.test.stories.ts} +88 -5
- package/src/stories/slots.test.stories.ts +218 -0
- package/storybook-static/assets/{Color-RQJUDNI5-C4yZhNbM.js → Color-PRSJMWNM-e4s261EJ.js} +1 -1
- package/storybook-static/assets/{Configure-C7d36rng.js → Configure-DWut7txe.js} +1 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-CaXVGjCl.js +2 -0
- package/storybook-static/assets/WithTooltip-KJL26V4Q--B8vdnMi.js +1 -0
- package/storybook-static/assets/{attributes.stories-ZB0RTY1d.js → attributes.test.stories-IuwazrdL.js} +21 -21
- package/storybook-static/assets/css.test.stories-D9WaxrEv.js +96 -0
- package/storybook-static/assets/custom-element-BV8-hRQS.js +219 -0
- package/storybook-static/assets/{dom-merge.stories-CgHZUABU.js → dom-merge.test.stories-BhbNeum_.js} +5 -6
- package/storybook-static/assets/{entry-preview-CQqNFx4W.js → entry-preview-DrgzXgwT.js} +1 -1
- package/storybook-static/assets/{entry-preview-docs-CWgqLfd3.js → entry-preview-docs-Bxv0qQWs.js} +1 -1
- package/storybook-static/assets/{external-template.stories-DtSLMxvg.js → external-template.test.stories-Bpr_wxBo.js} +23 -24
- package/storybook-static/assets/form.test.stories-3tURbEdv.js +250 -0
- package/storybook-static/assets/{formatter-B5HCVTEV-tKeEfJA9.js → formatter-2WMMO6ZP-SJtgH3vM.js} +5 -5
- package/storybook-static/assets/http-request.stories-8K_qSs8C.js +300 -0
- package/storybook-static/assets/iframe-CM82WlGY.js +2 -0
- package/storybook-static/assets/index-CEZitmnt.js +548 -0
- package/storybook-static/assets/index-CVRyq5ci.js +27 -0
- package/storybook-static/assets/{index-DnEJ_bKa.js → index-D1MP-Zis.js} +1 -1
- package/storybook-static/assets/index-DNL-IEpS.js +1 -0
- package/storybook-static/assets/index-DXimoRZY.js +1 -0
- package/storybook-static/assets/index-DuIEV_9C.js +13 -0
- package/storybook-static/assets/{lit-element-B4_0akdT.js → lit-element-CenEXOuS.js} +2 -2
- package/storybook-static/assets/{local-storage.stories-BkO6djDz.js → local-storage.test.stories-CtisAQBB.js} +28 -24
- package/storybook-static/assets/{location-element.stories-DCIOUd0D.js → location-element.test.stories-5O_t_m4Y.js} +11 -11
- package/storybook-static/assets/preview-4Up_z4Em.js +7 -0
- package/storybook-static/assets/{preview-CkgAD_DE.js → preview-5Y0XiZgz.js} +2 -2
- package/storybook-static/assets/preview-BKCN0mOr.js +1 -0
- package/storybook-static/assets/preview-DRnyIGXK.js +48 -0
- package/storybook-static/assets/preview-FpHGYA1q.js +1 -0
- package/storybook-static/assets/{preview-PxUn-cIn.js → preview-TCN6m6T-.js} +1 -1
- package/storybook-static/assets/slice-events.test.stories-BSXCLIA5.js +231 -0
- package/storybook-static/assets/slots.test.stories-B1vqfHmN.js +214 -0
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-BWFH_0wQ.js +1 -0
- package/storybook-static/iframe.html +153 -10
- package/storybook-static/index.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +35 -29
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +5 -5
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +35 -35
- 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-10/manager-bundle.js +18 -16
- package/storybook-static/sb-addons/links-1/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +1 -1
- package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +1 -0
- package/storybook-static/sb-manager/{chunk-S4VOIVUE.js → chunk-B3YDJJJH.js} +9 -9
- package/storybook-static/sb-manager/{chunk-FEE35O7J.js → chunk-BLWCBWKL.js} +3 -3
- package/storybook-static/sb-manager/{chunk-XCO5HRLK.js → chunk-GUVK2GTO.js} +3 -3
- package/storybook-static/sb-manager/chunk-LFRML3ZV.js +186 -0
- package/storybook-static/sb-manager/chunk-MC7RAF2B.js +274 -0
- package/storybook-static/sb-manager/{chunk-XP3HGWTR.js → chunk-ZR5JZWHI.js} +1 -1
- package/storybook-static/sb-manager/{formatter-B5HCVTEV-7DCBOGO6.js → formatter-2WMMO6ZP-JI7RHVTW.js} +1 -1
- package/storybook-static/sb-manager/globals-module-info.js +1 -1
- package/storybook-static/sb-manager/globals-runtime.js +1 -1
- package/storybook-static/sb-manager/index.js +1 -1
- package/storybook-static/sb-manager/runtime.js +1 -1
- package/storybook-static/sb-manager/{syntaxhighlighter-JOJW2KGS-VF6EEVPI.js → syntaxhighlighter-BP7B2CQK-WOJYHKQR.js} +1 -1
- package/storybook-static/sb-preview/runtime.js +28 -11
- package/vite.config.js +5 -5
- package/dist/custom-element-B4v-KaIh.cjs +0 -53
- package/dist/custom-element-_g0GTup2.js +0 -436
- package/src/stories/attributes.test.ts +0 -14
- package/src/stories/css.test.ts +0 -12
- package/src/stories/dom-merge.test.ts +0 -12
- package/src/stories/external-template.test.ts +0 -12
- package/src/stories/local-storage.test.ts +0 -12
- package/src/stories/location-element.test.ts +0 -14
- package/src/stories/slice-events.test.ts +0 -12
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +0 -2
- package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +0 -1
- package/storybook-static/assets/css.stories-CLSX-Xxd.js +0 -86
- package/storybook-static/assets/custom-element-BLZZ00dz.js +0 -53
- package/storybook-static/assets/http-request.stories-CUzlXO89.js +0 -300
- package/storybook-static/assets/iframe-gCvlWuoC.js +0 -2
- package/storybook-static/assets/index-CBQwM6ST.js +0 -508
- package/storybook-static/assets/index-CDavW7r9.js +0 -193
- package/storybook-static/assets/index-CQA5dlr6.js +0 -13
- package/storybook-static/assets/index-DgaNIR0t.js +0 -1
- package/storybook-static/assets/index-Dkj0J1ds.js +0 -1
- package/storybook-static/assets/preview-C6t8KBFr.js +0 -1
- package/storybook-static/assets/preview-CYD85dwb.js +0 -7
- package/storybook-static/assets/preview-D8LadFCz.js +0 -48
- package/storybook-static/assets/preview-DNpCpRPf.js +0 -1
- package/storybook-static/assets/slice-events.stories-DXKjXI37.js +0 -115
- package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +0 -1
- package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +0 -1
- package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +0 -234
- package/storybook-static/sb-manager/chunk-E6ABNH5R.js +0 -183
- /package/coverage/src/stories/{attributes.stories.ts → attributes.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{css.stories.ts → css.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{external-template.stories.ts → external-template.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{local-storage.stories.ts → form.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{location-element.stories.ts → local-storage.test.stories.ts}/coverage.svg +0 -0
- /package/coverage/src/stories/{slice-events.stories.ts → location-element.test.stories.ts}/coverage.svg +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// noinspection DuplicatedCode
|
|
2
2
|
|
|
3
|
-
import type { StoryObj }
|
|
3
|
+
import type { StoryObj } from '@storybook/web-components';
|
|
4
4
|
import {expect, getByTestId, within, userEvent} from '@storybook/test';
|
|
5
5
|
|
|
6
6
|
import '../custom-element/custom-element.js';
|
|
7
|
+
import {OverrideInPayload, StyleDoesNotLeak, StyleIn2Instances} from './css.test.stories';
|
|
7
8
|
|
|
8
9
|
type TProps = { title: string; body:string};
|
|
9
10
|
|
|
@@ -36,8 +37,8 @@ export const AttributeDefaults:Story =
|
|
|
36
37
|
<attribute name="p1">default_P1 </attribute>
|
|
37
38
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
38
39
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
39
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
40
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
40
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
41
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
41
42
|
p3: <code data-testid="p3">{$p3}</code>
|
|
42
43
|
</template>
|
|
43
44
|
</custom-element>
|
|
@@ -64,8 +65,8 @@ export const AttributesRuntimeChange:Story =
|
|
|
64
65
|
<attribute name="p1">default_P1 </attribute>
|
|
65
66
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
66
67
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
67
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
68
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
68
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
69
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
69
70
|
p3: <code data-testid="p3">{$p3}</code>
|
|
70
71
|
</template>
|
|
71
72
|
</custom-element>
|
|
@@ -110,8 +111,8 @@ export const InstanceAttributes:Story =
|
|
|
110
111
|
<attribute name="p1">default_P1 </attribute>
|
|
111
112
|
<attribute name="p2" select="'always_p2'" ></attribute>
|
|
112
113
|
<attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
|
|
113
|
-
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
114
|
-
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
114
|
+
p1: <code data-testid="p1">{$p1}</code> <br/>
|
|
115
|
+
p2: <code data-testid="p2">{$p2}</code> <br/>
|
|
115
116
|
p3: <code data-testid="p3">{$p3}</code>
|
|
116
117
|
</template>
|
|
117
118
|
</custom-element>
|
|
@@ -130,3 +131,14 @@ export const InstanceAttributes:Story =
|
|
|
130
131
|
},
|
|
131
132
|
};
|
|
132
133
|
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
const TestStories = { AttributeDefaults, AttributesRuntimeChange, InstanceAttributes };
|
|
137
|
+
|
|
138
|
+
/* istanbul ignore else -- @preserve */
|
|
139
|
+
if( 'test' === import.meta.env.MODE )
|
|
140
|
+
{
|
|
141
|
+
const {playStories} = await import('./renderPlay');
|
|
142
|
+
const {describe} = await import('vitest')
|
|
143
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
144
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {StoryObj}
|
|
2
|
-
import {within, expect}
|
|
1
|
+
import type {StoryObj} from "@storybook/web-components";
|
|
2
|
+
import {within, expect} from "@storybook/test";
|
|
3
3
|
|
|
4
4
|
import '../custom-element/custom-element.js';
|
|
5
|
+
import {CharsCountInTextarea, WordCountOnType} from './dom-merge.test.stories';
|
|
5
6
|
|
|
6
7
|
type CssProps = { title: string; tag: string; style: string; slot: string; payload: string };
|
|
7
8
|
const defs = {title: '', tag: '', style: '', slot: '', payload: ''};
|
|
@@ -47,6 +48,12 @@ export const StyleDoesNotLeak: Story =
|
|
|
47
48
|
const color = st.getPropertyValue('color');
|
|
48
49
|
// @ts-ignore
|
|
49
50
|
expect(color).to.equal('rgb(0, 128, 0)')
|
|
51
|
+
await expect( el.closest('custom-element')).toBeInTheDocument();
|
|
52
|
+
const dce = el.closest('custom-element');
|
|
53
|
+
await expect( dce.xsltString).toContain('<xsl:stylesheet');
|
|
54
|
+
await expect( dce.dce.localName).toEqual('custom-element');
|
|
55
|
+
await expect( dce.dce.xsltString).toEqual(dce.xsltString);
|
|
56
|
+
await expect( dce.dce.xslt.documentElement.tagName ).toEqual('xsl:stylesheet');
|
|
50
57
|
},
|
|
51
58
|
};
|
|
52
59
|
|
|
@@ -80,13 +87,15 @@ export const OverrideInPayload: Story =
|
|
|
80
87
|
, style: `color:green`
|
|
81
88
|
, slot: 'is green'
|
|
82
89
|
, tag: 'dce-3'
|
|
83
|
-
, payload:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</
|
|
88
|
-
</
|
|
89
|
-
|
|
90
|
+
, payload: `<u>should be</u> ${RED}:
|
|
91
|
+
<dce-3 id="dce32">
|
|
92
|
+
<template>
|
|
93
|
+
<style> color:red; </style>
|
|
94
|
+
<u>red</u>
|
|
95
|
+
</template>
|
|
96
|
+
</dce-3> <br/>
|
|
97
|
+
should be ${GREEN}:
|
|
98
|
+
<dce-3 id="dce31">green</dce-3> `
|
|
90
99
|
}
|
|
91
100
|
, play: async ({canvasElement}) =>
|
|
92
101
|
{
|
|
@@ -102,3 +111,14 @@ export const OverrideInPayload: Story =
|
|
|
102
111
|
expect( color('#dce32 u') ).to .equal(color('i'));
|
|
103
112
|
},
|
|
104
113
|
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
const TestStories = { StyleDoesNotLeak, StyleIn2Instances, OverrideInPayload };
|
|
117
|
+
|
|
118
|
+
/* istanbul ignore else -- @preserve */
|
|
119
|
+
if( 'test' === import.meta.env.MODE )
|
|
120
|
+
{
|
|
121
|
+
const {playStories} = await import('./renderPlay');
|
|
122
|
+
const {describe} = await import('vitest')
|
|
123
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
124
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
// noinspection DuplicatedCode
|
|
2
2
|
|
|
3
|
-
import type { StoryObj }
|
|
3
|
+
import type { StoryObj } from '@storybook/web-components';
|
|
4
4
|
import {expect, getByTestId, within, userEvent} from '@storybook/test';
|
|
5
5
|
|
|
6
6
|
import '../custom-element/custom-element.js';
|
|
7
|
+
import {
|
|
8
|
+
ByIdWithinXsltFile, EmbeddingInAnotherFile,
|
|
9
|
+
ExternalHtmlFile, ExternalHtmlFileInline, ExternalSvg, ExternalXsltFile, HtmlWithinHtmlFile, MathMLWithinHtmlFile,
|
|
10
|
+
MissingIdWithinXsltFile,
|
|
11
|
+
NoTag,
|
|
12
|
+
SvgWithinHtmlFile, TemplateInPage
|
|
13
|
+
} from './external-template.test.stories';
|
|
7
14
|
|
|
8
15
|
type TProps = { title: string; body:string};
|
|
9
16
|
|
|
@@ -55,7 +62,6 @@ export const CharsCountInTextarea:Story =
|
|
|
55
62
|
await userEvent.keyboard(titleText);
|
|
56
63
|
expect(textarea.value).toEqual(titleText);
|
|
57
64
|
expect(textarea.value.length).toEqual(titleText.length);
|
|
58
|
-
debugger;
|
|
59
65
|
canvas.getByTestId('refocus-id').focus();
|
|
60
66
|
await sleep(10);
|
|
61
67
|
expect(canvas.getByTestId('counter-id').textContent).toEqual(''+titleText?.length,'counter of symbols');
|
|
@@ -80,7 +86,7 @@ export const WordCountOnType:Story =
|
|
|
80
86
|
<code data-testid="words-id"
|
|
81
87
|
>{
|
|
82
88
|
string-length(normalize-space(//slice/txt)) -
|
|
83
|
-
string-length(translate(normalize-space(//slice/txt), ' ', '')) + 1
|
|
89
|
+
string-length(translate(normalize-space(//slice/txt), ' ', '')) + 1
|
|
84
90
|
}</code>
|
|
85
91
|
<!-- The expression first normalizes the string by removing leading and trailing whitespace and
|
|
86
92
|
collapsing internal whitespace into a single space. It then subtracts the length of the string
|
|
@@ -111,3 +117,13 @@ export const WordCountOnType:Story =
|
|
|
111
117
|
expect(canvas.getByTestId('words-id').textContent.trim()).toEqual('6', 'counter of words in render');
|
|
112
118
|
},
|
|
113
119
|
};
|
|
120
|
+
|
|
121
|
+
const TestStories = { CharsCountInTextarea, WordCountOnType };
|
|
122
|
+
|
|
123
|
+
/* istanbul ignore else -- @preserve */
|
|
124
|
+
if( 'test' === import.meta.env.MODE )
|
|
125
|
+
{
|
|
126
|
+
const {playStories} = await import('./renderPlay');
|
|
127
|
+
const {describe} = await import('vitest')
|
|
128
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
129
|
+
}
|
|
@@ -4,6 +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 {Demo, SrcAttribute} from './location-element.test.stories';
|
|
7
8
|
|
|
8
9
|
type TProps = { title: string; body:string};
|
|
9
10
|
|
|
@@ -32,10 +33,10 @@ export const TemplateInPage:Story =
|
|
|
32
33
|
<template id="template1">
|
|
33
34
|
<slot>Hello</slot> World!
|
|
34
35
|
</template>
|
|
35
|
-
|
|
36
|
+
|
|
36
37
|
<custom-element tag="dce-internal" src="#template1"></custom-element>
|
|
37
38
|
<!-- no need for loading fallback as the template exists -->
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
<dce-internal data-testid="slot-override">👋</dce-internal>
|
|
40
41
|
<dce-internal data-testid="slot-default"></dce-internal>
|
|
41
42
|
`}
|
|
@@ -194,7 +195,6 @@ export const MathMLWithinHtmlFile:Story =
|
|
|
194
195
|
const canvas = within(canvasElement);
|
|
195
196
|
await canvas.findByText(MathMLWithinHtmlFile.args!.title as string);
|
|
196
197
|
const ml = await canvas.findByTestId('ml-test');
|
|
197
|
-
debugger;
|
|
198
198
|
expect(ml.firstElementChild.localName).toEqual('mrow');
|
|
199
199
|
},
|
|
200
200
|
};
|
|
@@ -243,3 +243,13 @@ export const EmbeddingInAnotherFile:Story =
|
|
|
243
243
|
expect(canvas.getByTestId('wave').innerHTML).toEqual('🖖');
|
|
244
244
|
},
|
|
245
245
|
};
|
|
246
|
+
|
|
247
|
+
const TestStories = { TemplateInPage, NoTag, ExternalSvg, ExternalXsltFile, ExternalHtmlFile, ExternalHtmlFileInline, HtmlWithinHtmlFile, SvgWithinHtmlFile, MathMLWithinHtmlFile, ByIdWithinXsltFile, MissingIdWithinXsltFile, EmbeddingInAnotherFile };
|
|
248
|
+
|
|
249
|
+
/* istanbul ignore else -- @preserve */
|
|
250
|
+
if( 'test' === import.meta.env.MODE )
|
|
251
|
+
{
|
|
252
|
+
const {playStories} = await import('./renderPlay');
|
|
253
|
+
const {describe} = await import('vitest')
|
|
254
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
255
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// noinspection DuplicatedCode
|
|
2
|
+
|
|
3
|
+
import type { StoryObj } from '@storybook/web-components';
|
|
4
|
+
import {expect, within, userEvent} from '@storybook/test';
|
|
5
|
+
|
|
6
|
+
import '../custom-element/custom-element.js';
|
|
7
|
+
|
|
8
|
+
type TProps = { title: string; body:string};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<TProps>;
|
|
11
|
+
|
|
12
|
+
function render(args: TProps)
|
|
13
|
+
{
|
|
14
|
+
const {title, body} = args;
|
|
15
|
+
return `
|
|
16
|
+
<fieldset>
|
|
17
|
+
<legend>${ title }</legend>
|
|
18
|
+
${ body }
|
|
19
|
+
</fieldset>
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
const meta =
|
|
23
|
+
{ title: 'form'
|
|
24
|
+
, render
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
export const SystemMessage:Story =
|
|
30
|
+
{ args : {title: 'custom-validity boolean', body:`
|
|
31
|
+
<p>type and then clear test in input should lead to system validation message shown next to input field.
|
|
32
|
+
Something like <q>Please fill out this field</q>.</p>
|
|
33
|
+
<custom-element>
|
|
34
|
+
<template>
|
|
35
|
+
<form>
|
|
36
|
+
<label> Email
|
|
37
|
+
<input slice="username" slice-event="input" placeholder="non-empty" required data-testid="input-1">
|
|
38
|
+
</label>
|
|
39
|
+
<if test="//username/@validation-message">
|
|
40
|
+
<var data-testid="validation-msg">{//username/@validation-message}</var>
|
|
41
|
+
</if>
|
|
42
|
+
<button>Next</button>
|
|
43
|
+
</form>
|
|
44
|
+
</template>
|
|
45
|
+
</custom-element>
|
|
46
|
+
`}
|
|
47
|
+
, play: async ({canvasElement}) =>
|
|
48
|
+
{
|
|
49
|
+
const titleText = SystemMessage.args!.title as string;
|
|
50
|
+
const canvas = within(canvasElement);
|
|
51
|
+
|
|
52
|
+
await expect( canvas.queryByTestId('validation-msg')).toBeNull();
|
|
53
|
+
const input = await canvas.findByTestId('input-1');
|
|
54
|
+
input.focus();
|
|
55
|
+
await userEvent.keyboard('abc');
|
|
56
|
+
|
|
57
|
+
await userEvent.clear(input);
|
|
58
|
+
await expect( canvas.queryByTestId('validation-msg')).toBeInTheDocument();
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const FormData:Story =
|
|
63
|
+
{ args : {title: 'form-data populated', body:`
|
|
64
|
+
<p>type and then clear test in input should lead to system validation message shown next to input field.
|
|
65
|
+
Something like <q>Please fill out this field</q>.</p>
|
|
66
|
+
<custom-element>
|
|
67
|
+
<template>
|
|
68
|
+
<form slice="signin-form" >
|
|
69
|
+
<input name="f1" placeholder="non-empty" required data-testid="input-1"/>
|
|
70
|
+
<input name="f2" placeholder="non-empty" required data-testid="input-2"/>
|
|
71
|
+
<input name="f3" placeholder="non-empty" required data-testid="input-3"/>
|
|
72
|
+
|
|
73
|
+
<button data-testid="next-button">Next</button><br/>
|
|
74
|
+
f1: <code data-testid="c1">{ /datadom/slice/signin-form/form-data/f1 }</code><br/>
|
|
75
|
+
f2: <code data-testid="c2">{ //form-data/f2 }</code><br/>
|
|
76
|
+
f3: <code data-testid="c3">{/datadom/slice/signin-form/form-data/f3}</code><br/>
|
|
77
|
+
</form>
|
|
78
|
+
</template>
|
|
79
|
+
</custom-element>
|
|
80
|
+
`}
|
|
81
|
+
, play: async ({canvasElement}) =>
|
|
82
|
+
{
|
|
83
|
+
const canvas = within(canvasElement);
|
|
84
|
+
await userEvent.type(canvas.getByTestId('input-1'), 'ABC');
|
|
85
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
86
|
+
await expect( await canvas.findByText('ABC')).toBeInTheDocument();
|
|
87
|
+
await userEvent.type(canvas.getByTestId('input-2'), 'DCE');
|
|
88
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
89
|
+
await expect( await canvas.findByText('DCE')).toBeInTheDocument();
|
|
90
|
+
await userEvent.type(canvas.getByTestId('input-3'), 'XYZ');
|
|
91
|
+
canvas.getByTestId('input-1').focus();
|
|
92
|
+
await expect( await canvas.findByText('XYZ')).toBeInTheDocument();
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
export const SetValidityMessage:Story =
|
|
96
|
+
{ args : {title: 'setCustomValidity', body:`
|
|
97
|
+
<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity">setCustomValidity()</a>
|
|
98
|
+
invoked by <code>custom-validity</code> attribute. Type in the input fiels to observe the chars count in
|
|
99
|
+
text, click "next" and observe same message in dropdown.
|
|
100
|
+
</p>
|
|
101
|
+
<custom-element>
|
|
102
|
+
<template>
|
|
103
|
+
<form>
|
|
104
|
+
<input slice="s1" slice-event="input keyup" placeholder="type to see the custom error"
|
|
105
|
+
custom-validity=" concat( 'char count ', string-length(//s1) ) "
|
|
106
|
+
data-testid="input-1"/><br/>
|
|
107
|
+
s1: <code data-testid="c1">{ //s1 }</code><br/>
|
|
108
|
+
@validation-message: <var data-testid="validation-msg">{//s1/@validation-message}</var>
|
|
109
|
+
<button>next</button>
|
|
110
|
+
</form>
|
|
111
|
+
</template>
|
|
112
|
+
</custom-element>
|
|
113
|
+
`}
|
|
114
|
+
, play: async ({canvasElement}) =>
|
|
115
|
+
{
|
|
116
|
+
const canvas = within(canvasElement);
|
|
117
|
+
await userEvent.type(canvas.getByTestId('input-1'), 'ABC');
|
|
118
|
+
await expect( canvas.getByText('ABC')).toBeInTheDocument();
|
|
119
|
+
await expect( canvas.getByText('char count 3')).toBeInTheDocument();
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const FormCustomValidityBoolean:Story =
|
|
124
|
+
{ args : {title: 'form custom-validity, boolean', body:`
|
|
125
|
+
<p> Form is valid only when input text length longer of 3 characters. </p>
|
|
126
|
+
<custom-element>
|
|
127
|
+
<template>
|
|
128
|
+
<form slice="form-1" custom-validity=" string-length(//form-1//f1) > 3 "
|
|
129
|
+
data-testid="form-1"
|
|
130
|
+
>
|
|
131
|
+
<input name="f1" data-testid="input-1"/><br/>
|
|
132
|
+
|
|
133
|
+
<input type="hidden" name="id" value="form--form-custom-validity-boolean"/>
|
|
134
|
+
<input type="hidden" name="viewMode" value="story"/>
|
|
135
|
+
//form-1//f1: <code data-testid="c1">{ //form-1//f1 }</code><br/>
|
|
136
|
+
<button>next</button>
|
|
137
|
+
</form>
|
|
138
|
+
</template>
|
|
139
|
+
</custom-element>
|
|
140
|
+
`}
|
|
141
|
+
, play: async ({canvasElement}) =>
|
|
142
|
+
{
|
|
143
|
+
const canvas = within(canvasElement);
|
|
144
|
+
await userEvent.type(canvas.getByTestId('input-1'), 'AB');
|
|
145
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
146
|
+
|
|
147
|
+
await expect( canvas.getByText('AB')).toBeInTheDocument(); // i.e. not reloaded by form submit
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
export const FormCustomValidityString:Story =
|
|
151
|
+
{ args : {title: 'form custom-validity, string', body:`
|
|
152
|
+
<p> Form is valid only when input text is longer of 3 characters, @validation-message propagated in form slot </p>
|
|
153
|
+
<custom-element>
|
|
154
|
+
<template>
|
|
155
|
+
<form slice="form-1"
|
|
156
|
+
custom-validity=" string-length(//form-1//f1) > 3 ?? concat('should be more than 3 characters, now is ',string-length(//form-1//f1) ) "
|
|
157
|
+
data-testid="form-1"
|
|
158
|
+
>
|
|
159
|
+
<input name="f1" data-testid="input-1"/><br/>
|
|
160
|
+
|
|
161
|
+
<input type="hidden" name="id" value="form--form-custom-validity-string"/>
|
|
162
|
+
<input type="hidden" name="viewMode" value="story"/>
|
|
163
|
+
//form-1//f1: <code data-testid="c1">{ //form-1//f1 }</code><br/>
|
|
164
|
+
//form-1/@validation-message: <code data-testid="c1">{ //@validation-message }</code><br/>
|
|
165
|
+
<button>next</button>
|
|
166
|
+
</form>
|
|
167
|
+
</template>
|
|
168
|
+
</custom-element>
|
|
169
|
+
`}
|
|
170
|
+
, play: async ({canvasElement}) =>
|
|
171
|
+
{
|
|
172
|
+
const canvas = within(canvasElement);
|
|
173
|
+
await userEvent.type(canvas.getByTestId('input-1'), 'AB');
|
|
174
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
175
|
+
|
|
176
|
+
await expect( canvas.getByText('AB')).toBeInTheDocument(); // i.e. not reloaded by form submit
|
|
177
|
+
await expect( canvas.getByText('should be more than 3 characters, now is 2')).toBeInTheDocument();
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
// custom validity rules on form : boolean and string values
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
const TestStories = { SystemMessage, FormData, SetValidityMessage, FormCustomValidityBoolean, FormCustomValidityString};
|
|
184
|
+
|
|
185
|
+
/* istanbul ignore else -- @preserve */
|
|
186
|
+
if( 'test' === import.meta.env.MODE )
|
|
187
|
+
{
|
|
188
|
+
const {playStories} = await import('./renderPlay');
|
|
189
|
+
const {describe} = await import('vitest')
|
|
190
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
191
|
+
}
|
|
@@ -28,12 +28,12 @@ function Template({title, slice, url}: TProps)
|
|
|
28
28
|
slice="${slice}"
|
|
29
29
|
></http-request>
|
|
30
30
|
<input placeholder="URL for fetch" slice="url" value="{ //url ?? '${ url }' }"/>
|
|
31
|
-
<button>set</button>
|
|
32
|
-
<button slice="url" slice-value="''" slice-event="click">set blank</button>
|
|
33
|
-
<button slice="url" slice-value="'/reflect'" slice-event="click">/reflect</button>
|
|
34
|
-
<button slice="url" slice-value="'/pokemon'" slice-event="click">/pokemon</button>
|
|
35
|
-
<button slice="url" slice-value="'/pokemon?limit=6'" slice-event="click">/pokemon?limit=6</button>
|
|
36
|
-
<button slice="url" slice-value="'/pokemon?limit=3'" slice-event="click">/pokemon?limit=3</button>
|
|
31
|
+
<button>set</button>
|
|
32
|
+
<button slice="url" slice-value="''" slice-event="click">set blank</button>
|
|
33
|
+
<button slice="url" slice-value="'/reflect'" slice-event="click">/reflect</button>
|
|
34
|
+
<button slice="url" slice-value="'/pokemon'" slice-event="click">/pokemon</button>
|
|
35
|
+
<button slice="url" slice-value="'/pokemon?limit=6'" slice-event="click">/pokemon?limit=6</button>
|
|
36
|
+
<button slice="url" slice-value="'/pokemon?limit=3'" slice-event="click">/pokemon?limit=3</button>
|
|
37
37
|
|
|
38
38
|
<p>Pokemon Count: {count(/datadom/slice/${slice}//results)}</p>
|
|
39
39
|
<if test="count(/datadom/slice/${slice}//results) < 0">
|
|
@@ -12,15 +12,6 @@ import {handlers} from '../mocks/handlers.ts';
|
|
|
12
12
|
export const worker = setupWorker(...handlers);
|
|
13
13
|
await worker.start();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
// worker.start({serviceWorker: { url: '/public/mockServiceWorker.js' } });
|
|
17
|
-
// worker.use(...handlers);
|
|
18
|
-
|
|
19
|
-
// beforeAll( () => {worker.start()});//{ onUnhandledRequest: 'error' }));
|
|
20
|
-
//
|
|
21
|
-
// afterAll(() => worker.stop());
|
|
22
|
-
|
|
23
|
-
|
|
24
15
|
const {renderPlay} = meta;
|
|
25
16
|
describe('http-request', () => {
|
|
26
17
|
for (let story of Object.values(Stories) as StoryObj[] )
|
|
@@ -27,13 +27,13 @@ function render(args: TProps)
|
|
|
27
27
|
|
|
28
28
|
<custom-element>
|
|
29
29
|
<template><!-- wrapping into template to prevent images loading within DCE declaration -->
|
|
30
|
-
<local-storage
|
|
31
|
-
key="${ key }"
|
|
32
|
-
slice="${ slice }"
|
|
33
|
-
${ live ? `live="${live }"`:''}
|
|
34
|
-
${ value ? `value="${value }"`:''}
|
|
30
|
+
<local-storage
|
|
31
|
+
key="${ key }"
|
|
32
|
+
slice="${ slice }"
|
|
33
|
+
${ live ? `live="${live }"`:''}
|
|
34
|
+
${ value ? `value="${value }"`:''}
|
|
35
35
|
></local-storage>
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
<br/>
|
|
38
38
|
<var>${key}</var>:<code data-testid="slice-value">{ //slice/${slice} }</code>
|
|
39
39
|
<br/>
|
|
@@ -53,12 +53,12 @@ export default meta;
|
|
|
53
53
|
export const Demo:Story =
|
|
54
54
|
{ args : {title: 'live value', live:'live', body:`
|
|
55
55
|
<input placeholder="value for localStorage" id="textinput"
|
|
56
|
-
slice="${defs.slice}"
|
|
56
|
+
slice="${defs.slice}"
|
|
57
57
|
value="{ //${defs.slice} ?? '${ defs.value }' }"/>
|
|
58
58
|
<button onclick="localStorage.setItem('${defs.key}',textinput.value )">set</button>
|
|
59
59
|
<button onclick="localStorage.setItem('${defs.key}','text value' )">text value</button>
|
|
60
|
-
<button onclick="localStorage.setItem('${defs.key}','another text')">another text</button>
|
|
61
|
-
<button onclick="localStorage.removeItem('${defs.key}' )">set blank</button>
|
|
60
|
+
<button onclick="localStorage.setItem('${defs.key}','another text')">another text</button>
|
|
61
|
+
<button onclick="localStorage.removeItem('${defs.key}' )">set blank</button>
|
|
62
62
|
`}
|
|
63
63
|
, play: async ({canvasElement}) =>
|
|
64
64
|
{
|
|
@@ -94,8 +94,8 @@ export const Demo:Story =
|
|
|
94
94
|
export const AlwaysOverride:Story =
|
|
95
95
|
{ args : {title: 'AlwaysOverride', live:'', value:'ABC', body:`
|
|
96
96
|
buttons are changing the localStorage value, but without 'live' attribute slice ^^ from <i>local-storage</i> is not updated<br/>
|
|
97
|
-
<button onclick="localStorage.setItem('${defs.key}','text value' )">text value</button>
|
|
98
|
-
<button onclick="localStorage.removeItem('${defs.key}' )">set blank</button>
|
|
97
|
+
<button onclick="localStorage.setItem('${defs.key}','text value' )">text value</button>
|
|
98
|
+
<button onclick="localStorage.removeItem('${defs.key}' )">set blank</button>
|
|
99
99
|
`}
|
|
100
100
|
, play: async ({canvasElement}) =>
|
|
101
101
|
{
|
|
@@ -168,7 +168,7 @@ export const FromStorageWithDefault:Story =
|
|
|
168
168
|
|
|
169
169
|
export const TypeAttribute:Story =
|
|
170
170
|
{ args : {title: 'local-storage type attribute variations', body:`
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
<local-storage key="textKey" slice="text-key" type="text" live="live"></local-storage>
|
|
173
173
|
<local-storage key="dateKey" slice="date-key" type="date" live="live"></local-storage>
|
|
174
174
|
<local-storage key="timeKey" slice="time-key" type="time" live="live"></local-storage>
|
|
@@ -218,6 +218,8 @@ export const TypeAttribute:Story =
|
|
|
218
218
|
`}
|
|
219
219
|
, play: async ({canvasElement}) =>
|
|
220
220
|
{
|
|
221
|
+
window['JsonSample'] = {a:1,b:'B'};
|
|
222
|
+
|
|
221
223
|
const canvas = within(canvasElement);
|
|
222
224
|
await canvas.findByText(TypeAttribute.args!.title as string);
|
|
223
225
|
const byText = txt => canvas.getByText(txt)
|
|
@@ -386,3 +388,13 @@ export const TypeAttribute:Story =
|
|
|
386
388
|
expectVal('json-key' ,'\na : 1b : B' );
|
|
387
389
|
},
|
|
388
390
|
};
|
|
391
|
+
|
|
392
|
+
const TestStories = { Demo, AlwaysOverride, FromStorageWithDefault, TypeAttribute };
|
|
393
|
+
|
|
394
|
+
/* istanbul ignore else -- @preserve */
|
|
395
|
+
if( 'test' === import.meta.env.MODE )
|
|
396
|
+
{ localStorage.clear();
|
|
397
|
+
const {playStories} = await import('./renderPlay');
|
|
398
|
+
const {describe} = await import('vitest')
|
|
399
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
400
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// noinspection DuplicatedCode
|
|
2
2
|
|
|
3
|
-
import type { StoryObj }
|
|
4
|
-
import {expect, getByTestId, within}
|
|
3
|
+
import type { StoryObj } from '@storybook/web-components';
|
|
4
|
+
import {expect, getByTestId, within} from '@storybook/test';
|
|
5
5
|
|
|
6
6
|
import '../custom-element/custom-element.js';
|
|
7
7
|
import '../custom-element/location-element.js';
|
|
8
|
+
import {RealtimeEventInSlice, SliceInitChangeEvent} from './slice-events.test.stories';
|
|
8
9
|
|
|
9
10
|
type TProps = { title: string; slice: string; href: string; live:string; body:string};
|
|
10
11
|
const defs: TProps =
|
|
@@ -26,13 +27,13 @@ function render(args: TProps)
|
|
|
26
27
|
|
|
27
28
|
<custom-element>
|
|
28
29
|
<template><!-- wrapping into template to prevent images loading within DCE declaration -->
|
|
29
|
-
<location-element
|
|
30
|
-
slice="${ slice }"
|
|
31
|
-
${ href ? `href="${ href }"`:''}
|
|
30
|
+
<location-element
|
|
31
|
+
slice="${ slice }"
|
|
32
|
+
${ href ? `href="${ href }"`:''}
|
|
32
33
|
live="${ live }"
|
|
33
34
|
></location-element>
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
|
|
36
37
|
${ body }
|
|
37
38
|
<xhtml:table>
|
|
38
39
|
<xhtml:tbody>
|
|
@@ -40,12 +41,12 @@ function render(args: TProps)
|
|
|
40
41
|
<xhtml:th><h3> URL properties </h3></xhtml:th>
|
|
41
42
|
<xhtml:td>{count(//value/@*)}</xhtml:td>
|
|
42
43
|
</xhtml:tr>
|
|
43
|
-
<apply-templates mode="attrs" select="
|
|
44
|
+
<apply-templates mode="attrs" select="//${ slice }/value/@*"></apply-templates>
|
|
44
45
|
</xhtml:tbody>
|
|
45
46
|
</xhtml:table>
|
|
46
47
|
<xhtml:table>
|
|
47
48
|
<h3> URL parameters </h3>
|
|
48
|
-
<apply-templates mode="attrs" select="
|
|
49
|
+
<apply-templates mode="attrs" select="//${ slice }/value/params/*/*"></apply-templates>
|
|
49
50
|
</xhtml:table>
|
|
50
51
|
<xsl:template mode="attrs" match="*|@*">
|
|
51
52
|
<xhtml:tr>
|
|
@@ -131,3 +132,14 @@ export const SrcAttribute:Story =
|
|
|
131
132
|
|
|
132
133
|
},
|
|
133
134
|
};
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const TestStories = { Demo, SrcAttribute };
|
|
138
|
+
|
|
139
|
+
/* istanbul ignore else -- @preserve */
|
|
140
|
+
if( 'test' === import.meta.env.MODE )
|
|
141
|
+
{
|
|
142
|
+
const {playStories} = await import('./renderPlay');
|
|
143
|
+
const {describe} = await import('vitest')
|
|
144
|
+
describe('slots', () => playStories( TestStories, meta ) );
|
|
145
|
+
}
|
|
@@ -17,6 +17,5 @@ export async function renderPlay<TProps>(story: StoryObj, meta:{render: (args: T
|
|
|
17
17
|
export function playStories<TProps>( Stories: any, meta:{ render: (args: TProps)=>string } )
|
|
18
18
|
{
|
|
19
19
|
for ( let story of Object.values(Stories) as StoryObj[] )
|
|
20
|
-
|
|
21
|
-
it( story.args!.title, async () => renderPlay(story, meta) );
|
|
20
|
+
it( story.args!.title, async () => renderPlay(story, meta) );
|
|
22
21
|
}
|