@epa-wg/custom-element-dist 0.0.33 → 0.0.34
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/.claude/settings.local.json +18 -0
- package/.github/workflows/deploy.yml +59 -0
- package/.idea/copilot.data.migration.agent.xml +6 -0
- package/.idea/copilot.data.migration.ask.xml +6 -0
- package/.idea/copilot.data.migration.edit.xml +6 -0
- package/.idea/custom-element-dist.iml +2 -0
- package/.storybook/main.ts +20 -17
- package/.storybook/preview.ts +23 -23
- package/README.md +6 -4
- package/coverage/block-navigation.js +1 -1
- package/coverage/coverage-final.json +4 -3
- package/coverage/index.html +34 -19
- package/coverage/sorter.js +21 -7
- 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 +435 -378
- package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
- package/coverage/src/custom-element/http-request.js.html +38 -17
- package/coverage/src/custom-element/index.html +26 -26
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js.html +1 -1
- package/coverage/src/custom-element/module-url.js.html +1 -1
- package/coverage/src/index.html +1 -1
- package/coverage/src/material/theme/colors.js/coverage.svg +10 -0
- package/coverage/src/material/theme/colors.js.html +217 -0
- package/coverage/src/material/theme/coverage.svg +10 -0
- package/coverage/src/material/theme/index.html +116 -0
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/frame.canvas.ts.html +1 -1
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +1 -1
- package/coverage/src/stories/testStoryBook.ts.html +12 -12
- package/coverage/src/sum.ts.html +1 -1
- package/dist/{custom-element-WnOqmEOe.js → custom-element-BoYMoUtP.js} +193 -183
- package/dist/custom-element-BqtjrCRF.cjs +97 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +3 -3
- package/dist/demo/a.html +10 -3
- package/dist/demo/a.svg +26 -26
- package/dist/demo/html-template.html +4 -3
- package/dist/demo/s.xml +3856 -67
- package/dist/demo/s.xslt +13 -72
- package/dist/demo/s1.xml +3706 -0
- package/dist/http-request-DSaowcG1.cjs +1 -0
- package/dist/{http-request-BOvP4KTl.js → http-request-DTCzZ1gc.js} +15 -9
- package/package.json +2 -2
- package/public/demo/a.html +10 -3
- package/public/demo/a.svg +26 -26
- package/public/demo/html-template.html +4 -3
- package/public/demo/s.xml +3856 -67
- package/public/demo/s.xslt +13 -72
- package/public/demo/s1.xml +3706 -0
- package/src/custom-element/custom-element.js +28 -9
- package/src/custom-element/demo/a.html +10 -3
- package/src/custom-element/demo/a.svg +26 -26
- package/src/custom-element/demo/html-template.html +4 -3
- package/src/custom-element/demo/s.xml +3856 -67
- package/src/custom-element/demo/s.xslt +13 -72
- package/src/custom-element/demo/s1.xml +3706 -0
- package/src/custom-element/http-request.js +7 -0
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/material/angular.css +987 -987
- package/src/material/components/action.html +262 -0
- package/src/material/components/autocomplete.html +167 -239
- package/src/material/components/badge.html +238 -239
- package/src/material/components/dropdown.html +0 -1
- package/src/material/components/icon-link.html +160 -161
- package/src/material/components/icon.html +251 -252
- package/src/material/components/input.html +569 -570
- package/src/material/components/menu.html +235 -236
- package/src/material/components.html +157 -158
- package/src/material/demo.css +36 -36
- package/src/material/index.html +109 -110
- package/src/material/material.css +356 -356
- package/src/material/theme/Base-Principles.md +339 -0
- package/src/material/theme/README.md +298 -18
- package/src/material/theme/UI Domain Model in web applications.svg +1 -0
- package/src/material/theme/User Semantic Theme tokens.svg +1 -0
- package/src/material/theme/action-pending-poc.html +62 -0
- package/src/material/theme/actions-color.html +141 -0
- package/src/material/theme/colors-light.html +631 -0
- package/src/material/theme/colors-native.html +51 -0
- package/src/material/theme/colors-poc.html +66 -0
- package/src/material/theme/colors.html +297 -0
- package/src/material/theme/colors.js +44 -0
- package/src/material/theme/consumer-theme.css +745 -0
- package/src/material/theme/semantic.css +132 -132
- package/src/material/theme/style-bug.html +123 -0
- package/src/material/theme/theme-data.css +43 -0
- package/src/material/theme/theme-data.xhtml +2926 -0
- package/src/material/theme/todo.md +274 -0
- package/src/material/theme/tokens/action-colors.png +0 -0
- package/src/material/theme/tokens/cem-article-illustration-4x1-letterbox-2000x500.png +0 -0
- package/src/material/theme/tokens/cem-breakpoints.md +519 -0
- package/src/material/theme/tokens/cem-colors.md +715 -0
- package/src/material/theme/tokens/cem-consumerflow-typography-matrix.svg +198 -0
- package/src/material/theme/tokens/cem-coupling.md +372 -0
- package/src/material/theme/tokens/cem-data-vs-reading-numerals.svg +164 -0
- package/src/material/theme/tokens/cem-dimension.md +625 -0
- package/src/material/theme/tokens/cem-layering.md +562 -0
- package/src/material/theme/tokens/cem-m3-parity.md +343 -0
- package/src/material/theme/tokens/cem-responsive.md +238 -0
- package/src/material/theme/tokens/cem-shape.md +691 -0
- package/src/material/theme/tokens/cem-stroke-density-illustration-4to1-v3.svg +102 -0
- package/src/material/theme/tokens/cem-stroke.md +480 -0
- package/src/material/theme/tokens/cem-timing.md +198 -0
- package/src/material/theme/tokens/cem-typography-model-stack.svg +64 -0
- package/src/material/theme/tokens/cem-voice-fonts-typography.md +718 -0
- package/src/material/theme/tokens/cem-voice-ladder.svg +91 -0
- package/src/material/theme/tokens/chips.png +0 -0
- package/src/material/theme/tokens/columns-page.png +0 -0
- package/src/material/theme/tokens/initials.png +0 -0
- package/src/material/theme/tokens/nav-buttons.png +0 -0
- package/src/material/theme/tokens/script.png +0 -0
- package/src/material/theme/tokens/sufler.png +0 -0
- package/src/material/theme/tokens/typography-icons.png +0 -0
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/dom-merge.test.stories.ts/dom-merge-dom-merge-OrderPreservingOn2ndTransform-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleIfOrderingWorkaround-1.png +0 -0
- package/src/stories/dom-merge.test.stories.ts +25 -1
- package/src/stories/xslt-conditionals.test.stories.ts +492 -0
- package/src/stories/xslt-if.test.stories.ts +89 -0
- package/storybook-static/assets/{Color-F6OSRLHC-Cbp293x2.js → Color-F6OSRLHC-CzTOSlqB.js} +1 -1
- package/storybook-static/assets/{Configure-BrFr4SLE.js → Configure-7GqRsAoJ.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-CFRXHY34-DhHzJiIO.js → DocsRenderer-CFRXHY34-Duc5rSIm.js} +2 -2
- package/storybook-static/assets/{attributes.test.stories-Gg9LQTEK.js → attributes.test.stories-DYuxF8h1.js} +1 -1
- package/storybook-static/assets/{css.test.stories-B_3ltOrx.js → css.test.stories-LOmvINyb.js} +1 -1
- package/storybook-static/assets/{custom-element-CPnvJnn8.js → custom-element-Bwx7otrT.js} +6 -6
- package/storybook-static/assets/{dom-merge.test.stories-nQxcgLoM.js → dom-merge.test.stories-CEKhWjaS.js} +47 -6
- package/storybook-static/assets/entry-preview-BNCt9WBs.js +26 -0
- package/storybook-static/assets/{entry-preview-docs-Dwczwtsc.js → entry-preview-docs-CbF8-81D.js} +2 -2
- package/storybook-static/assets/{external-template.test.stories-DZ-rjnfd.js → external-template.test.stories-jHu0wsJ-.js} +1 -1
- package/storybook-static/assets/{form.test.stories-DQhPYtMj.js → form.test.stories-CUyUnmwP.js} +1 -1
- package/storybook-static/assets/{frame.canvas-ClTqYyMN.js → frame.canvas-E5n9h6j1.js} +1 -1
- package/storybook-static/assets/{handlers-CLkps6Nz.js → handlers-F7GUfMqr.js} +1 -1
- package/storybook-static/assets/http-request-BWeEEBkP.js +1 -0
- package/storybook-static/assets/{http-request.stories-jo0f73nw.js → http-request.stories-wyX5-QOv.js} +1 -1
- package/storybook-static/assets/{iframe-CZwRpnn9.js → iframe-BS_DPWl0.js} +11 -11
- package/storybook-static/assets/{index-Dr4PwNfd.js → index-CGuyH0k-.js} +87 -87
- package/storybook-static/assets/{index-CJQtnF9V.js → index-DB7LLObI.js} +1 -1
- package/storybook-static/assets/index-DO1nmyvI.js +11 -0
- package/storybook-static/assets/{index-B68YUdzy.js → index-V1EGs-wm.js} +3 -3
- package/storybook-static/assets/{local-storage.test.stories-uA5EKRPf.js → local-storage.test.stories-BxOhsf1k.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-Cu-6Elcg.js → location-element.test.stories-DqhvvUoa.js} +1 -1
- package/storybook-static/assets/{module-url.test.stories-CD_wusXQ.js → module-url.test.stories-C1gG9G7Y.js} +1 -1
- package/storybook-static/assets/{preview-BFlNN3Wj.js → preview-Bn8igYMp.js} +1 -1
- package/storybook-static/assets/{preview-CuCH40jj.js → preview-Cwy1XFu2.js} +2 -2
- package/storybook-static/assets/{preview-Cm4PPhHS.js → preview-D6sehqkw.js} +1 -1
- package/storybook-static/assets/{set-url.test.stories-CY7B9BVZ.js → set-url.test.stories-BKQNdknJ.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-BVnPXm6e.js → slice-events.test.stories-ChqULCeA.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-Dxsa9KdA.js → slots.test.stories-BlyLoCRe.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-Buga1PAa.js → version-select.test.stories-CPGSh1tR.js} +1 -1
- package/storybook-static/assets/xslt-conditionals.test.stories-YC6QPqWZ.js +633 -0
- package/storybook-static/assets/xslt-if.test.stories-BRSWy2-x.js +71 -0
- package/storybook-static/demo/a.html +10 -3
- package/storybook-static/demo/a.svg +26 -26
- package/storybook-static/demo/html-template.html +4 -3
- package/storybook-static/demo/s.xml +3856 -67
- package/storybook-static/demo/s.xslt +13 -72
- package/storybook-static/demo/s1.xml +3706 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +69 -66
- package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +62 -59
- package/dist/custom-element-6slVaFEs.cjs +0 -97
- package/dist/http-request-DPrY7mGh.cjs +0 -1
- package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +0 -1
- package/storybook-static/assets/entry-preview-DHVXbf3x.js +0 -26
- package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +0 -1
- package/storybook-static/assets/http-request-DNq59pnj.js +0 -1
- package/storybook-static/assets/index-BwkS7JH_.js +0 -8
- package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +0 -1
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import{w as n,e,u as I}from"./index-CGuyH0k-.js";import"./custom-element-Bwx7otrT.js";function o(a){return new Promise(s=>setTimeout(s,a))}function B(a){const{title:s,tag:t,template:i,payload:r}=a;return`
|
|
2
|
+
<fieldset>
|
|
3
|
+
<legend>${s}</legend>
|
|
4
|
+
<custom-element tag="${t}" hidden>
|
|
5
|
+
<template>
|
|
6
|
+
${i}
|
|
7
|
+
</template>
|
|
8
|
+
</custom-element>
|
|
9
|
+
${r}
|
|
10
|
+
</fieldset>
|
|
11
|
+
`}const H={title:"xslt-conditionals",render:B},c={args:{title:"xsl:if - condition is true",tag:"if-true-test",template:`
|
|
12
|
+
<attribute name="show-message"></attribute>
|
|
13
|
+
<if test="//@show-message">
|
|
14
|
+
<span data-testid="result">Message is visible</span>
|
|
15
|
+
</if>
|
|
16
|
+
`,payload:'<if-true-test show-message="yes"></if-true-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Message is visible")}},u={args:{title:"xsl:if - condition is false",tag:"if-false-test",template:`
|
|
17
|
+
<attribute name="show-message"></attribute>
|
|
18
|
+
<if test="//@show-message = 'yes'">
|
|
19
|
+
<span data-testid="hidden-result">Should not appear</span>
|
|
20
|
+
</if>
|
|
21
|
+
<span data-testid="fallback">Fallback content</span>
|
|
22
|
+
`,payload:'<if-false-test show-message="no"></if-false-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("fallback");e(t).toBeInTheDocument(),e(a.querySelector('[data-testid="hidden-result"]')).toBeNull()}},l={args:{title:"xsl:if - attribute not exists",tag:"if-not-exists-test",template:`
|
|
23
|
+
<attribute name="optional"></attribute>
|
|
24
|
+
<if test="not(//attributes/@optional)">
|
|
25
|
+
<span data-testid="result">No attribute provided</span>
|
|
26
|
+
</if>
|
|
27
|
+
<if test="//attributes/@optional">
|
|
28
|
+
<span data-testid="has-attr">Attribute exists</span>
|
|
29
|
+
</if>
|
|
30
|
+
`,payload:"<if-not-exists-test></if-not-exists-test>"},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("No attribute provided"),e(a.querySelector('[data-testid="has-attr"]')).toBeNull()}},d={args:{title:"xsl:choose/when/otherwise - basic switch",tag:"choose-basic-test",template:`
|
|
31
|
+
<attribute name="status"></attribute>
|
|
32
|
+
<choose>
|
|
33
|
+
<when test="//attributes/@status = 'success'">
|
|
34
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
35
|
+
</when>
|
|
36
|
+
<when test="//attributes/@status = 'error'">
|
|
37
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
38
|
+
</when>
|
|
39
|
+
<otherwise>
|
|
40
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
41
|
+
</otherwise>
|
|
42
|
+
</choose>
|
|
43
|
+
`,payload:'<choose-basic-test status="success"></choose-basic-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Operation succeeded"),e(t).toHaveClass("success")}},p={args:{title:"xsl:choose - second when branch",tag:"choose-second-test",template:`
|
|
44
|
+
<attribute name="status"></attribute>
|
|
45
|
+
<choose>
|
|
46
|
+
<when test="//attributes/@status = 'success'">
|
|
47
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
48
|
+
</when>
|
|
49
|
+
<when test="//attributes/@status = 'error'">
|
|
50
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
51
|
+
</when>
|
|
52
|
+
<otherwise>
|
|
53
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
54
|
+
</otherwise>
|
|
55
|
+
</choose>
|
|
56
|
+
`,payload:'<choose-second-test status="error"></choose-second-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Operation failed"),e(t).toHaveClass("error")}},m={args:{title:"xsl:choose - otherwise fallback",tag:"choose-otherwise-test",template:`
|
|
57
|
+
<attribute name="status"></attribute>
|
|
58
|
+
<choose>
|
|
59
|
+
<when test="//attributes/@status = 'success'">
|
|
60
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
61
|
+
</when>
|
|
62
|
+
<when test="//attributes/@status = 'error'">
|
|
63
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
64
|
+
</when>
|
|
65
|
+
<otherwise>
|
|
66
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
67
|
+
</otherwise>
|
|
68
|
+
</choose>
|
|
69
|
+
`,payload:'<choose-otherwise-test status="pending"></choose-otherwise-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Unknown status"),e(t).toHaveClass("unknown")}},h={args:{title:"xsl:choose - no attribute provided",tag:"choose-no-attr-test",template:`
|
|
70
|
+
<attribute name="level"></attribute>
|
|
71
|
+
<choose>
|
|
72
|
+
<when test="//attributes/@level = 'high'">
|
|
73
|
+
<span data-testid="result">High priority</span>
|
|
74
|
+
</when>
|
|
75
|
+
<when test="//attributes/@level = 'low'">
|
|
76
|
+
<span data-testid="result">Low priority</span>
|
|
77
|
+
</when>
|
|
78
|
+
<otherwise>
|
|
79
|
+
<span data-testid="result">Default priority</span>
|
|
80
|
+
</otherwise>
|
|
81
|
+
</choose>
|
|
82
|
+
`,payload:"<choose-no-attr-test></choose-no-attr-test>"},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Default priority")}},w={args:{title:"Nested conditionals",tag:"nested-cond-test",template:`
|
|
83
|
+
<attribute name="type"></attribute>
|
|
84
|
+
<attribute name="active"></attribute>
|
|
85
|
+
<choose>
|
|
86
|
+
<when test="//attributes/@type = 'user'">
|
|
87
|
+
<if test="//attributes/@active = 'true'">
|
|
88
|
+
<span data-testid="result">Active user</span>
|
|
89
|
+
</if>
|
|
90
|
+
<if test="//attributes/@active != 'true'">
|
|
91
|
+
<span data-testid="result">Inactive user</span>
|
|
92
|
+
</if>
|
|
93
|
+
</when>
|
|
94
|
+
<otherwise>
|
|
95
|
+
<span data-testid="result">Not a user</span>
|
|
96
|
+
</otherwise>
|
|
97
|
+
</choose>
|
|
98
|
+
`,payload:'<nested-cond-test type="user" active="true"></nested-cond-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Active user")}},b={args:{title:"Nested conditionals - inactive user",tag:"nested-cond-inactive-test",template:`
|
|
99
|
+
<attribute name="type"></attribute>
|
|
100
|
+
<attribute name="active"></attribute>
|
|
101
|
+
<choose>
|
|
102
|
+
<when test="//attributes/@type = 'user'">
|
|
103
|
+
<if test="//attributes/@active = 'true'">
|
|
104
|
+
<span data-testid="result">Active user</span>
|
|
105
|
+
</if>
|
|
106
|
+
<if test="//attributes/@active != 'true'">
|
|
107
|
+
<span data-testid="result">Inactive user</span>
|
|
108
|
+
</if>
|
|
109
|
+
</when>
|
|
110
|
+
<otherwise>
|
|
111
|
+
<span data-testid="result">Not a user</span>
|
|
112
|
+
</otherwise>
|
|
113
|
+
</choose>
|
|
114
|
+
`,payload:'<nested-cond-inactive-test type="user" active="false"></nested-cond-inactive-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Inactive user")}},v={args:{title:"Numeric comparison in conditions",tag:"numeric-cond-test",template:`
|
|
115
|
+
<attribute name="count"></attribute>
|
|
116
|
+
<choose>
|
|
117
|
+
<when test="//attributes/@count > 10">
|
|
118
|
+
<span data-testid="result">Many items</span>
|
|
119
|
+
</when>
|
|
120
|
+
<when test="//attributes/@count > 0">
|
|
121
|
+
<span data-testid="result">Some items</span>
|
|
122
|
+
</when>
|
|
123
|
+
<otherwise>
|
|
124
|
+
<span data-testid="result">No items</span>
|
|
125
|
+
</otherwise>
|
|
126
|
+
</choose>
|
|
127
|
+
`,payload:'<numeric-cond-test count="15"></numeric-cond-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Many items")}},y={args:{title:"Numeric comparison - low value",tag:"numeric-cond-low-test",template:`
|
|
128
|
+
<attribute name="count"></attribute>
|
|
129
|
+
<choose>
|
|
130
|
+
<when test="//attributes/@count > 10">
|
|
131
|
+
<span data-testid="result">Many items</span>
|
|
132
|
+
</when>
|
|
133
|
+
<when test="//attributes/@count > 0">
|
|
134
|
+
<span data-testid="result">Some items</span>
|
|
135
|
+
</when>
|
|
136
|
+
<otherwise>
|
|
137
|
+
<span data-testid="result">No items</span>
|
|
138
|
+
</otherwise>
|
|
139
|
+
</choose>
|
|
140
|
+
`,payload:'<numeric-cond-low-test count="5"></numeric-cond-low-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Some items")}},f={args:{title:"Boolean AND condition",tag:"and-cond-test",template:`
|
|
141
|
+
<attribute name="logged-in"></attribute>
|
|
142
|
+
<attribute name="admin"></attribute>
|
|
143
|
+
<if test="//attributes/@logged-in = 'true' and //attributes/@admin = 'true'">
|
|
144
|
+
<span data-testid="result">Admin panel access granted</span>
|
|
145
|
+
</if>
|
|
146
|
+
<if test="not(//attributes/@logged-in = 'true' and //attributes/@admin = 'true')">
|
|
147
|
+
<span data-testid="result">Access denied</span>
|
|
148
|
+
</if>
|
|
149
|
+
`,payload:'<and-cond-test logged-in="true" admin="true"></and-cond-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Admin panel access granted")}},g={args:{title:"Boolean OR condition",tag:"or-cond-test",template:`
|
|
150
|
+
<attribute name="role"></attribute>
|
|
151
|
+
<if test="//attributes/@role = 'admin' or //attributes/@role = 'moderator'">
|
|
152
|
+
<span data-testid="result">Elevated privileges</span>
|
|
153
|
+
</if>
|
|
154
|
+
<if test="not(//attributes/@role = 'admin' or //attributes/@role = 'moderator')">
|
|
155
|
+
<span data-testid="result">Standard user</span>
|
|
156
|
+
</if>
|
|
157
|
+
`,payload:'<or-cond-test role="moderator"></or-cond-test>'},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("result");e(t).toBeInTheDocument(),e(t).toHaveTextContent("Elevated privileges")}},x={args:{title:"Multiple instances with different conditions",tag:"multi-instance-test",template:`
|
|
158
|
+
<attribute name="data-testid"></attribute>
|
|
159
|
+
<attribute name="variant"></attribute>
|
|
160
|
+
<choose>
|
|
161
|
+
<when test="//attributes/@variant = 'primary'">
|
|
162
|
+
<button data-testid="{$data-testid}-primary" class="primary">Primary Button</button>
|
|
163
|
+
</when>
|
|
164
|
+
<when test="//attributes/@variant = 'secondary'">
|
|
165
|
+
<button data-testid="{$data-testid}-secondary" class="secondary">Secondary Button</button>
|
|
166
|
+
</when>
|
|
167
|
+
<otherwise>
|
|
168
|
+
<button data-testid="{$data-testid}-otherwise" class="default">Default Button</button>
|
|
169
|
+
</otherwise>
|
|
170
|
+
</choose>
|
|
171
|
+
`,payload:`
|
|
172
|
+
<multi-instance-test data-testid="btn1" variant="primary"></multi-instance-test>
|
|
173
|
+
<multi-instance-test data-testid="btn2" variant="secondary"></multi-instance-test>
|
|
174
|
+
<multi-instance-test data-testid="btn3" variant="unknown"></multi-instance-test>
|
|
175
|
+
`},play:async({canvasElement:a})=>{const s=n(a);await o(50);const t=await s.findByTestId("btn1-primary");e(t).toHaveTextContent("Primary Button"),e(t).toHaveClass("primary");const i=await s.findByTestId("btn2-secondary");e(i).toHaveTextContent("Secondary Button"),e(i).toHaveClass("secondary");const r=await s.findByTestId("btn3-otherwise");e(r).toHaveTextContent("Default Button"),e(r).toHaveClass("default")}},T={args:{title:"KNOWN ISSUE: Multiple IF blocks - out of order",tag:"multi-if-order-issue",template:`
|
|
176
|
+
<div data-testid="whole-text">
|
|
177
|
+
<label><input type="checkbox" data-testid="toggle-a" slice="show-a" value="AA" /> A</label>
|
|
178
|
+
|
|
179
|
+
<hr/>
|
|
180
|
+
▶
|
|
181
|
+
<if test="//show-a = 'AA'">
|
|
182
|
+
!A
|
|
183
|
+
</if>
|
|
184
|
+
◀
|
|
185
|
+
</div>
|
|
186
|
+
<if test="//show-a = 'AA'">
|
|
187
|
+
<div data-testid="t-1">T1</div>
|
|
188
|
+
</if>
|
|
189
|
+
`,payload:`
|
|
190
|
+
<multi-if-order-issue></multi-if-order-issue>
|
|
191
|
+
`},play:async({canvasElement:a})=>{const s=n(a),t=await s.findByTestId("whole-text");e(t.textContent).to.toMatch(/▶\s+◀/);const i=await s.findByTestId("toggle-a");debugger;await I.click(i),e(await await s.findByTestId("t-1")).toBeInTheDocument(),e(t.textContent).to.toMatch(/\!A/),e(t.textContent).to.toMatch(/▶\s+\!A/),e(t.textContent).to.toMatch(/\!A\s+◀/)}};c.parameters={...c.parameters,docs:{...c.parameters?.docs,source:{originalSource:`{
|
|
192
|
+
args: {
|
|
193
|
+
title: 'xsl:if - condition is true',
|
|
194
|
+
tag: 'if-true-test',
|
|
195
|
+
template: \`
|
|
196
|
+
<attribute name="show-message"></attribute>
|
|
197
|
+
<if test="//@show-message">
|
|
198
|
+
<span data-testid="result">Message is visible</span>
|
|
199
|
+
</if>
|
|
200
|
+
\`,
|
|
201
|
+
payload: \`<if-true-test show-message="yes"></if-true-test>\`
|
|
202
|
+
},
|
|
203
|
+
play: async ({
|
|
204
|
+
canvasElement
|
|
205
|
+
}) => {
|
|
206
|
+
const canvas = within(canvasElement);
|
|
207
|
+
await sleep(50);
|
|
208
|
+
const result = await canvas.findByTestId('result');
|
|
209
|
+
expect(result).toBeInTheDocument();
|
|
210
|
+
expect(result).toHaveTextContent('Message is visible');
|
|
211
|
+
}
|
|
212
|
+
}`,...c.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
213
|
+
args: {
|
|
214
|
+
title: 'xsl:if - condition is false',
|
|
215
|
+
tag: 'if-false-test',
|
|
216
|
+
template: \`
|
|
217
|
+
<attribute name="show-message"></attribute>
|
|
218
|
+
<if test="//@show-message = 'yes'">
|
|
219
|
+
<span data-testid="hidden-result">Should not appear</span>
|
|
220
|
+
</if>
|
|
221
|
+
<span data-testid="fallback">Fallback content</span>
|
|
222
|
+
\`,
|
|
223
|
+
payload: \`<if-false-test show-message="no"></if-false-test>\`
|
|
224
|
+
},
|
|
225
|
+
play: async ({
|
|
226
|
+
canvasElement
|
|
227
|
+
}) => {
|
|
228
|
+
const canvas = within(canvasElement);
|
|
229
|
+
await sleep(50);
|
|
230
|
+
const fallback = await canvas.findByTestId('fallback');
|
|
231
|
+
expect(fallback).toBeInTheDocument();
|
|
232
|
+
expect(canvasElement.querySelector('[data-testid="hidden-result"]')).toBeNull();
|
|
233
|
+
}
|
|
234
|
+
}`,...u.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
|
|
235
|
+
args: {
|
|
236
|
+
title: 'xsl:if - attribute not exists',
|
|
237
|
+
tag: 'if-not-exists-test',
|
|
238
|
+
template: \`
|
|
239
|
+
<attribute name="optional"></attribute>
|
|
240
|
+
<if test="not(//attributes/@optional)">
|
|
241
|
+
<span data-testid="result">No attribute provided</span>
|
|
242
|
+
</if>
|
|
243
|
+
<if test="//attributes/@optional">
|
|
244
|
+
<span data-testid="has-attr">Attribute exists</span>
|
|
245
|
+
</if>
|
|
246
|
+
\`,
|
|
247
|
+
payload: \`<if-not-exists-test></if-not-exists-test>\`
|
|
248
|
+
},
|
|
249
|
+
play: async ({
|
|
250
|
+
canvasElement
|
|
251
|
+
}) => {
|
|
252
|
+
const canvas = within(canvasElement);
|
|
253
|
+
await sleep(50);
|
|
254
|
+
const result = await canvas.findByTestId('result');
|
|
255
|
+
expect(result).toBeInTheDocument();
|
|
256
|
+
expect(result).toHaveTextContent('No attribute provided');
|
|
257
|
+
expect(canvasElement.querySelector('[data-testid="has-attr"]')).toBeNull();
|
|
258
|
+
}
|
|
259
|
+
}`,...l.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
260
|
+
args: {
|
|
261
|
+
title: 'xsl:choose/when/otherwise - basic switch',
|
|
262
|
+
tag: 'choose-basic-test',
|
|
263
|
+
template: \`
|
|
264
|
+
<attribute name="status"></attribute>
|
|
265
|
+
<choose>
|
|
266
|
+
<when test="//attributes/@status = 'success'">
|
|
267
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
268
|
+
</when>
|
|
269
|
+
<when test="//attributes/@status = 'error'">
|
|
270
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
271
|
+
</when>
|
|
272
|
+
<otherwise>
|
|
273
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
274
|
+
</otherwise>
|
|
275
|
+
</choose>
|
|
276
|
+
\`,
|
|
277
|
+
payload: \`<choose-basic-test status="success"></choose-basic-test>\`
|
|
278
|
+
},
|
|
279
|
+
play: async ({
|
|
280
|
+
canvasElement
|
|
281
|
+
}) => {
|
|
282
|
+
const canvas = within(canvasElement);
|
|
283
|
+
await sleep(50);
|
|
284
|
+
const result = await canvas.findByTestId('result');
|
|
285
|
+
expect(result).toBeInTheDocument();
|
|
286
|
+
expect(result).toHaveTextContent('Operation succeeded');
|
|
287
|
+
expect(result).toHaveClass('success');
|
|
288
|
+
}
|
|
289
|
+
}`,...d.parameters?.docs?.source}}};p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
|
|
290
|
+
args: {
|
|
291
|
+
title: 'xsl:choose - second when branch',
|
|
292
|
+
tag: 'choose-second-test',
|
|
293
|
+
template: \`
|
|
294
|
+
<attribute name="status"></attribute>
|
|
295
|
+
<choose>
|
|
296
|
+
<when test="//attributes/@status = 'success'">
|
|
297
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
298
|
+
</when>
|
|
299
|
+
<when test="//attributes/@status = 'error'">
|
|
300
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
301
|
+
</when>
|
|
302
|
+
<otherwise>
|
|
303
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
304
|
+
</otherwise>
|
|
305
|
+
</choose>
|
|
306
|
+
\`,
|
|
307
|
+
payload: \`<choose-second-test status="error"></choose-second-test>\`
|
|
308
|
+
},
|
|
309
|
+
play: async ({
|
|
310
|
+
canvasElement
|
|
311
|
+
}) => {
|
|
312
|
+
const canvas = within(canvasElement);
|
|
313
|
+
await sleep(50);
|
|
314
|
+
const result = await canvas.findByTestId('result');
|
|
315
|
+
expect(result).toBeInTheDocument();
|
|
316
|
+
expect(result).toHaveTextContent('Operation failed');
|
|
317
|
+
expect(result).toHaveClass('error');
|
|
318
|
+
}
|
|
319
|
+
}`,...p.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
320
|
+
args: {
|
|
321
|
+
title: 'xsl:choose - otherwise fallback',
|
|
322
|
+
tag: 'choose-otherwise-test',
|
|
323
|
+
template: \`
|
|
324
|
+
<attribute name="status"></attribute>
|
|
325
|
+
<choose>
|
|
326
|
+
<when test="//attributes/@status = 'success'">
|
|
327
|
+
<span data-testid="result" class="success">Operation succeeded</span>
|
|
328
|
+
</when>
|
|
329
|
+
<when test="//attributes/@status = 'error'">
|
|
330
|
+
<span data-testid="result" class="error">Operation failed</span>
|
|
331
|
+
</when>
|
|
332
|
+
<otherwise>
|
|
333
|
+
<span data-testid="result" class="unknown">Unknown status</span>
|
|
334
|
+
</otherwise>
|
|
335
|
+
</choose>
|
|
336
|
+
\`,
|
|
337
|
+
payload: \`<choose-otherwise-test status="pending"></choose-otherwise-test>\`
|
|
338
|
+
},
|
|
339
|
+
play: async ({
|
|
340
|
+
canvasElement
|
|
341
|
+
}) => {
|
|
342
|
+
const canvas = within(canvasElement);
|
|
343
|
+
await sleep(50);
|
|
344
|
+
const result = await canvas.findByTestId('result');
|
|
345
|
+
expect(result).toBeInTheDocument();
|
|
346
|
+
expect(result).toHaveTextContent('Unknown status');
|
|
347
|
+
expect(result).toHaveClass('unknown');
|
|
348
|
+
}
|
|
349
|
+
}`,...m.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
350
|
+
args: {
|
|
351
|
+
title: 'xsl:choose - no attribute provided',
|
|
352
|
+
tag: 'choose-no-attr-test',
|
|
353
|
+
template: \`
|
|
354
|
+
<attribute name="level"></attribute>
|
|
355
|
+
<choose>
|
|
356
|
+
<when test="//attributes/@level = 'high'">
|
|
357
|
+
<span data-testid="result">High priority</span>
|
|
358
|
+
</when>
|
|
359
|
+
<when test="//attributes/@level = 'low'">
|
|
360
|
+
<span data-testid="result">Low priority</span>
|
|
361
|
+
</when>
|
|
362
|
+
<otherwise>
|
|
363
|
+
<span data-testid="result">Default priority</span>
|
|
364
|
+
</otherwise>
|
|
365
|
+
</choose>
|
|
366
|
+
\`,
|
|
367
|
+
payload: \`<choose-no-attr-test></choose-no-attr-test>\`
|
|
368
|
+
},
|
|
369
|
+
play: async ({
|
|
370
|
+
canvasElement
|
|
371
|
+
}) => {
|
|
372
|
+
const canvas = within(canvasElement);
|
|
373
|
+
await sleep(50);
|
|
374
|
+
const result = await canvas.findByTestId('result');
|
|
375
|
+
expect(result).toBeInTheDocument();
|
|
376
|
+
expect(result).toHaveTextContent('Default priority');
|
|
377
|
+
}
|
|
378
|
+
}`,...h.parameters?.docs?.source}}};w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
|
|
379
|
+
args: {
|
|
380
|
+
title: 'Nested conditionals',
|
|
381
|
+
tag: 'nested-cond-test',
|
|
382
|
+
template: \`
|
|
383
|
+
<attribute name="type"></attribute>
|
|
384
|
+
<attribute name="active"></attribute>
|
|
385
|
+
<choose>
|
|
386
|
+
<when test="//attributes/@type = 'user'">
|
|
387
|
+
<if test="//attributes/@active = 'true'">
|
|
388
|
+
<span data-testid="result">Active user</span>
|
|
389
|
+
</if>
|
|
390
|
+
<if test="//attributes/@active != 'true'">
|
|
391
|
+
<span data-testid="result">Inactive user</span>
|
|
392
|
+
</if>
|
|
393
|
+
</when>
|
|
394
|
+
<otherwise>
|
|
395
|
+
<span data-testid="result">Not a user</span>
|
|
396
|
+
</otherwise>
|
|
397
|
+
</choose>
|
|
398
|
+
\`,
|
|
399
|
+
payload: \`<nested-cond-test type="user" active="true"></nested-cond-test>\`
|
|
400
|
+
},
|
|
401
|
+
play: async ({
|
|
402
|
+
canvasElement
|
|
403
|
+
}) => {
|
|
404
|
+
const canvas = within(canvasElement);
|
|
405
|
+
await sleep(50);
|
|
406
|
+
const result = await canvas.findByTestId('result');
|
|
407
|
+
expect(result).toBeInTheDocument();
|
|
408
|
+
expect(result).toHaveTextContent('Active user');
|
|
409
|
+
}
|
|
410
|
+
}`,...w.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
|
|
411
|
+
args: {
|
|
412
|
+
title: 'Nested conditionals - inactive user',
|
|
413
|
+
tag: 'nested-cond-inactive-test',
|
|
414
|
+
template: \`
|
|
415
|
+
<attribute name="type"></attribute>
|
|
416
|
+
<attribute name="active"></attribute>
|
|
417
|
+
<choose>
|
|
418
|
+
<when test="//attributes/@type = 'user'">
|
|
419
|
+
<if test="//attributes/@active = 'true'">
|
|
420
|
+
<span data-testid="result">Active user</span>
|
|
421
|
+
</if>
|
|
422
|
+
<if test="//attributes/@active != 'true'">
|
|
423
|
+
<span data-testid="result">Inactive user</span>
|
|
424
|
+
</if>
|
|
425
|
+
</when>
|
|
426
|
+
<otherwise>
|
|
427
|
+
<span data-testid="result">Not a user</span>
|
|
428
|
+
</otherwise>
|
|
429
|
+
</choose>
|
|
430
|
+
\`,
|
|
431
|
+
payload: \`<nested-cond-inactive-test type="user" active="false"></nested-cond-inactive-test>\`
|
|
432
|
+
},
|
|
433
|
+
play: async ({
|
|
434
|
+
canvasElement
|
|
435
|
+
}) => {
|
|
436
|
+
const canvas = within(canvasElement);
|
|
437
|
+
await sleep(50);
|
|
438
|
+
const result = await canvas.findByTestId('result');
|
|
439
|
+
expect(result).toBeInTheDocument();
|
|
440
|
+
expect(result).toHaveTextContent('Inactive user');
|
|
441
|
+
}
|
|
442
|
+
}`,...b.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
|
|
443
|
+
args: {
|
|
444
|
+
title: 'Numeric comparison in conditions',
|
|
445
|
+
tag: 'numeric-cond-test',
|
|
446
|
+
template: \`
|
|
447
|
+
<attribute name="count"></attribute>
|
|
448
|
+
<choose>
|
|
449
|
+
<when test="//attributes/@count > 10">
|
|
450
|
+
<span data-testid="result">Many items</span>
|
|
451
|
+
</when>
|
|
452
|
+
<when test="//attributes/@count > 0">
|
|
453
|
+
<span data-testid="result">Some items</span>
|
|
454
|
+
</when>
|
|
455
|
+
<otherwise>
|
|
456
|
+
<span data-testid="result">No items</span>
|
|
457
|
+
</otherwise>
|
|
458
|
+
</choose>
|
|
459
|
+
\`,
|
|
460
|
+
payload: \`<numeric-cond-test count="15"></numeric-cond-test>\`
|
|
461
|
+
},
|
|
462
|
+
play: async ({
|
|
463
|
+
canvasElement
|
|
464
|
+
}) => {
|
|
465
|
+
const canvas = within(canvasElement);
|
|
466
|
+
await sleep(50);
|
|
467
|
+
const result = await canvas.findByTestId('result');
|
|
468
|
+
expect(result).toBeInTheDocument();
|
|
469
|
+
expect(result).toHaveTextContent('Many items');
|
|
470
|
+
}
|
|
471
|
+
}`,...v.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
472
|
+
args: {
|
|
473
|
+
title: 'Numeric comparison - low value',
|
|
474
|
+
tag: 'numeric-cond-low-test',
|
|
475
|
+
template: \`
|
|
476
|
+
<attribute name="count"></attribute>
|
|
477
|
+
<choose>
|
|
478
|
+
<when test="//attributes/@count > 10">
|
|
479
|
+
<span data-testid="result">Many items</span>
|
|
480
|
+
</when>
|
|
481
|
+
<when test="//attributes/@count > 0">
|
|
482
|
+
<span data-testid="result">Some items</span>
|
|
483
|
+
</when>
|
|
484
|
+
<otherwise>
|
|
485
|
+
<span data-testid="result">No items</span>
|
|
486
|
+
</otherwise>
|
|
487
|
+
</choose>
|
|
488
|
+
\`,
|
|
489
|
+
payload: \`<numeric-cond-low-test count="5"></numeric-cond-low-test>\`
|
|
490
|
+
},
|
|
491
|
+
play: async ({
|
|
492
|
+
canvasElement
|
|
493
|
+
}) => {
|
|
494
|
+
const canvas = within(canvasElement);
|
|
495
|
+
await sleep(50);
|
|
496
|
+
const result = await canvas.findByTestId('result');
|
|
497
|
+
expect(result).toBeInTheDocument();
|
|
498
|
+
expect(result).toHaveTextContent('Some items');
|
|
499
|
+
}
|
|
500
|
+
}`,...y.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
|
|
501
|
+
args: {
|
|
502
|
+
title: 'Boolean AND condition',
|
|
503
|
+
tag: 'and-cond-test',
|
|
504
|
+
template: \`
|
|
505
|
+
<attribute name="logged-in"></attribute>
|
|
506
|
+
<attribute name="admin"></attribute>
|
|
507
|
+
<if test="//attributes/@logged-in = 'true' and //attributes/@admin = 'true'">
|
|
508
|
+
<span data-testid="result">Admin panel access granted</span>
|
|
509
|
+
</if>
|
|
510
|
+
<if test="not(//attributes/@logged-in = 'true' and //attributes/@admin = 'true')">
|
|
511
|
+
<span data-testid="result">Access denied</span>
|
|
512
|
+
</if>
|
|
513
|
+
\`,
|
|
514
|
+
payload: \`<and-cond-test logged-in="true" admin="true"></and-cond-test>\`
|
|
515
|
+
},
|
|
516
|
+
play: async ({
|
|
517
|
+
canvasElement
|
|
518
|
+
}) => {
|
|
519
|
+
const canvas = within(canvasElement);
|
|
520
|
+
await sleep(50);
|
|
521
|
+
const result = await canvas.findByTestId('result');
|
|
522
|
+
expect(result).toBeInTheDocument();
|
|
523
|
+
expect(result).toHaveTextContent('Admin panel access granted');
|
|
524
|
+
}
|
|
525
|
+
}`,...f.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
|
|
526
|
+
args: {
|
|
527
|
+
title: 'Boolean OR condition',
|
|
528
|
+
tag: 'or-cond-test',
|
|
529
|
+
template: \`
|
|
530
|
+
<attribute name="role"></attribute>
|
|
531
|
+
<if test="//attributes/@role = 'admin' or //attributes/@role = 'moderator'">
|
|
532
|
+
<span data-testid="result">Elevated privileges</span>
|
|
533
|
+
</if>
|
|
534
|
+
<if test="not(//attributes/@role = 'admin' or //attributes/@role = 'moderator')">
|
|
535
|
+
<span data-testid="result">Standard user</span>
|
|
536
|
+
</if>
|
|
537
|
+
\`,
|
|
538
|
+
payload: \`<or-cond-test role="moderator"></or-cond-test>\`
|
|
539
|
+
},
|
|
540
|
+
play: async ({
|
|
541
|
+
canvasElement
|
|
542
|
+
}) => {
|
|
543
|
+
const canvas = within(canvasElement);
|
|
544
|
+
await sleep(50);
|
|
545
|
+
const result = await canvas.findByTestId('result');
|
|
546
|
+
expect(result).toBeInTheDocument();
|
|
547
|
+
expect(result).toHaveTextContent('Elevated privileges');
|
|
548
|
+
}
|
|
549
|
+
}`,...g.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
|
|
550
|
+
args: {
|
|
551
|
+
title: 'Multiple instances with different conditions',
|
|
552
|
+
tag: 'multi-instance-test',
|
|
553
|
+
template: \`
|
|
554
|
+
<attribute name="data-testid"></attribute>
|
|
555
|
+
<attribute name="variant"></attribute>
|
|
556
|
+
<choose>
|
|
557
|
+
<when test="//attributes/@variant = 'primary'">
|
|
558
|
+
<button data-testid="{$data-testid}-primary" class="primary">Primary Button</button>
|
|
559
|
+
</when>
|
|
560
|
+
<when test="//attributes/@variant = 'secondary'">
|
|
561
|
+
<button data-testid="{$data-testid}-secondary" class="secondary">Secondary Button</button>
|
|
562
|
+
</when>
|
|
563
|
+
<otherwise>
|
|
564
|
+
<button data-testid="{$data-testid}-otherwise" class="default">Default Button</button>
|
|
565
|
+
</otherwise>
|
|
566
|
+
</choose>
|
|
567
|
+
\`,
|
|
568
|
+
payload: \`
|
|
569
|
+
<multi-instance-test data-testid="btn1" variant="primary"></multi-instance-test>
|
|
570
|
+
<multi-instance-test data-testid="btn2" variant="secondary"></multi-instance-test>
|
|
571
|
+
<multi-instance-test data-testid="btn3" variant="unknown"></multi-instance-test>
|
|
572
|
+
\`
|
|
573
|
+
},
|
|
574
|
+
play: async ({
|
|
575
|
+
canvasElement
|
|
576
|
+
}) => {
|
|
577
|
+
const canvas = within(canvasElement);
|
|
578
|
+
await sleep(50);
|
|
579
|
+
const btn1 = await canvas.findByTestId('btn1-primary');
|
|
580
|
+
expect(btn1).toHaveTextContent('Primary Button');
|
|
581
|
+
expect(btn1).toHaveClass('primary');
|
|
582
|
+
const btn2 = await canvas.findByTestId('btn2-secondary');
|
|
583
|
+
expect(btn2).toHaveTextContent('Secondary Button');
|
|
584
|
+
expect(btn2).toHaveClass('secondary');
|
|
585
|
+
const btn3 = await canvas.findByTestId('btn3-otherwise');
|
|
586
|
+
expect(btn3).toHaveTextContent('Default Button');
|
|
587
|
+
expect(btn3).toHaveClass('default');
|
|
588
|
+
}
|
|
589
|
+
}`,...x.parameters?.docs?.source}}};T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
|
|
590
|
+
args: {
|
|
591
|
+
title: 'KNOWN ISSUE: Multiple IF blocks - out of order',
|
|
592
|
+
tag: 'multi-if-order-issue',
|
|
593
|
+
template: \`
|
|
594
|
+
<div data-testid="whole-text">
|
|
595
|
+
<label><input type="checkbox" data-testid="toggle-a" slice="show-a" value="AA" /> A</label>
|
|
596
|
+
|
|
597
|
+
<hr/>
|
|
598
|
+
▶
|
|
599
|
+
<if test="//show-a = 'AA'">
|
|
600
|
+
!A
|
|
601
|
+
</if>
|
|
602
|
+
◀
|
|
603
|
+
</div>
|
|
604
|
+
<if test="//show-a = 'AA'">
|
|
605
|
+
<div data-testid="t-1">T1</div>
|
|
606
|
+
</if>
|
|
607
|
+
\`,
|
|
608
|
+
payload: \`
|
|
609
|
+
<multi-if-order-issue></multi-if-order-issue>
|
|
610
|
+
\`
|
|
611
|
+
},
|
|
612
|
+
play: async ({
|
|
613
|
+
canvasElement
|
|
614
|
+
}) => {
|
|
615
|
+
const canvas = within(canvasElement);
|
|
616
|
+
|
|
617
|
+
// Initially ▶\\s+◀ should be visible, !A should not
|
|
618
|
+
const container = await canvas.findByTestId('whole-text');
|
|
619
|
+
expect(container.textContent).to.toMatch(/▶\\s+◀/);
|
|
620
|
+
|
|
621
|
+
// check A - show !A
|
|
622
|
+
const toggleA = await canvas.findByTestId('toggle-a');
|
|
623
|
+
debugger;
|
|
624
|
+
await userEvent.click(toggleA);
|
|
625
|
+
expect(await await canvas.findByTestId('t-1')).toBeInTheDocument();
|
|
626
|
+
// !A is rendered
|
|
627
|
+
expect(container.textContent).to.toMatch(/\\!A/);
|
|
628
|
+
// !A afer ▶
|
|
629
|
+
expect(container.textContent).to.toMatch(/▶\\s+\\!A/);
|
|
630
|
+
// !A before ◀
|
|
631
|
+
expect(container.textContent).to.toMatch(/\\!A\\s+◀/);
|
|
632
|
+
}
|
|
633
|
+
}`,...T.parameters?.docs?.source}}};const N=["IfTrue","IfFalse","IfNotExists","ChooseWhenOtherwise","ChooseSecondWhen","ChooseOtherwise","ChooseNoAttribute","NestedConditions","NestedConditionsInactive","NumericComparison","NumericComparisonLow","BooleanAndCondition","BooleanOrCondition","MultipleInstances","MultipleIfOrderingIssue"];export{f as BooleanAndCondition,g as BooleanOrCondition,h as ChooseNoAttribute,m as ChooseOtherwise,p as ChooseSecondWhen,d as ChooseWhenOtherwise,u as IfFalse,l as IfNotExists,c as IfTrue,T as MultipleIfOrderingIssue,x as MultipleInstances,w as NestedConditions,b as NestedConditionsInactive,v as NumericComparison,y as NumericComparisonLow,N as __namedExportsOrder,H as default};
|