@epa-wg/custom-element-dist 0.0.25 → 0.0.27

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.
Files changed (332) hide show
  1. package/.idea/custom-element-dist.iml +1 -5
  2. package/.storybook/main.ts +1 -3
  3. package/.storybook/preview-head.html +8 -0
  4. package/.storybook/preview.ts +13 -5
  5. package/README.md +4 -4
  6. package/bin/postinstall.sh +3 -2
  7. package/bin/vitest/vitest-browser-importmaps.mjs +20 -0
  8. package/coverage/coverage-final.json +14 -11
  9. package/coverage/index.html +51 -36
  10. package/coverage/src/custom-element/coverage.svg +1 -1
  11. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  12. package/coverage/src/custom-element/custom-element.js.html +596 -386
  13. package/coverage/src/custom-element/demo/coverage.svg +10 -0
  14. package/coverage/src/custom-element/demo/index.html +116 -0
  15. package/coverage/src/custom-element/demo/z.js/coverage.svg +10 -0
  16. package/coverage/src/custom-element/demo/z.js.html +112 -0
  17. package/coverage/src/custom-element/http-request.js.html +12 -12
  18. package/coverage/src/custom-element/index.html +33 -18
  19. package/coverage/src/custom-element/local-storage.js.html +56 -41
  20. package/coverage/src/custom-element/location-element.js.html +4 -4
  21. package/coverage/src/custom-element/module-url.js/coverage.svg +10 -0
  22. package/coverage/src/custom-element/module-url.js.html +187 -0
  23. package/coverage/src/index.html +1 -1
  24. package/coverage/src/mocks/coverage.svg +1 -1
  25. package/coverage/src/mocks/handlers.ts/coverage.svg +1 -1
  26. package/coverage/src/mocks/handlers.ts.html +36 -12
  27. package/coverage/src/mocks/index.html +19 -19
  28. package/coverage/src/stories/attributes.test.stories.ts.html +9 -15
  29. package/coverage/src/stories/coverage.svg +1 -1
  30. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  31. package/coverage/src/stories/dom-merge.test.stories.ts.html +15 -9
  32. package/coverage/src/stories/external-template.test.stories.ts.html +27 -18
  33. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  34. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  35. package/coverage/src/stories/index.html +48 -33
  36. package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
  37. package/coverage/src/stories/local-storage.test.stories.ts.html +87 -63
  38. package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
  39. package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +10 -0
  40. package/coverage/src/stories/module-url.test.stories.ts.html +634 -0
  41. package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
  42. package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
  43. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  44. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  45. package/coverage/src/stories/version-select.test.stories.ts.html +98 -20
  46. package/coverage/src/sum.ts.html +1 -1
  47. package/dist/confused.svg +1 -0
  48. package/dist/custom-element-BMMsP1Dy.js +533 -0
  49. package/dist/custom-element-CPSk7s0j.cjs +87 -0
  50. package/dist/custom-element-bundle.cjs +1 -1
  51. package/dist/custom-element-bundle.js +28 -25
  52. package/dist/demo/a.html +60 -0
  53. package/dist/demo/a.svg +27 -0
  54. package/dist/demo/b.html +13 -0
  55. package/dist/demo/confused.svg +38 -0
  56. package/dist/demo/data-slices.html +216 -0
  57. package/dist/demo/dce-social-preview.png +0 -0
  58. package/dist/demo/demo.css +25 -0
  59. package/dist/demo/dom-merge.html +123 -0
  60. package/dist/demo/embed-1.html +2 -0
  61. package/dist/demo/external-template.html +239 -0
  62. package/dist/demo/form.html +239 -0
  63. package/dist/demo/hex-grid-dce.html +183 -0
  64. package/dist/demo/hex-grid-transform.png +0 -0
  65. package/dist/demo/hex-grid.html +66 -0
  66. package/dist/demo/html-template.html +126 -0
  67. package/dist/demo/html-template.xhtml +45 -0
  68. package/dist/demo/html-template.xml +45 -0
  69. package/dist/demo/http-request.html +143 -0
  70. package/dist/demo/lib-dir/Smiley.svg +24 -0
  71. package/dist/demo/lib-dir/embed-lib.html +34 -0
  72. package/dist/demo/local-storage.html +218 -0
  73. package/dist/demo/location-element.html +168 -0
  74. package/dist/demo/logo.png +0 -0
  75. package/dist/demo/module-url.html +215 -0
  76. package/dist/demo/npm-versions-demo.html +118 -0
  77. package/dist/demo/npm-versions.html +94 -0
  78. package/dist/demo/parameters.html +70 -0
  79. package/dist/demo/s.xml +3 -0
  80. package/dist/demo/s.xslt +56 -0
  81. package/dist/demo/s1.xslt +60 -0
  82. package/dist/demo/scoped-css.html +169 -0
  83. package/dist/demo/set-url.html +141 -0
  84. package/dist/demo/ss.html +57 -0
  85. package/dist/demo/table.xml +25 -0
  86. package/dist/demo/table.xsl +293 -0
  87. package/dist/demo/template.xsl +46 -0
  88. package/dist/demo/tree.xml +25 -0
  89. package/dist/demo/tree.xsl +33 -0
  90. package/dist/demo/wc-square.svg +1 -0
  91. package/dist/demo/xhtml-template.xhtml +45 -0
  92. package/dist/demo/z.html +33 -0
  93. package/dist/demo/z.js +9 -0
  94. package/dist/demo/z.xml +60 -0
  95. package/dist/demo/z1.html +34 -0
  96. package/dist/embed-1.html +1 -2
  97. package/dist/local-storage-78EivJ_B.cjs +1 -0
  98. package/dist/local-storage-DzmNKzgN.js +66 -0
  99. package/dist/mockServiceWorker.js +1 -1
  100. package/package.json +95 -93
  101. package/public/confused.svg +1 -0
  102. package/public/demo/a.html +60 -0
  103. package/public/demo/a.svg +27 -0
  104. package/public/demo/b.html +13 -0
  105. package/public/demo/confused.svg +38 -0
  106. package/public/demo/data-slices.html +216 -0
  107. package/public/demo/dce-social-preview.png +0 -0
  108. package/public/demo/demo.css +25 -0
  109. package/public/demo/dom-merge.html +123 -0
  110. package/public/demo/embed-1.html +2 -0
  111. package/public/demo/external-template.html +239 -0
  112. package/public/demo/form.html +239 -0
  113. package/public/demo/hex-grid-dce.html +183 -0
  114. package/public/demo/hex-grid-transform.png +0 -0
  115. package/public/demo/hex-grid.html +66 -0
  116. package/public/demo/html-template.html +126 -0
  117. package/public/demo/html-template.xhtml +45 -0
  118. package/public/demo/html-template.xml +45 -0
  119. package/public/demo/http-request.html +143 -0
  120. package/public/demo/lib-dir/Smiley.svg +24 -0
  121. package/public/demo/lib-dir/embed-lib.html +34 -0
  122. package/public/demo/local-storage.html +218 -0
  123. package/public/demo/location-element.html +168 -0
  124. package/public/demo/logo.png +0 -0
  125. package/public/demo/module-url.html +215 -0
  126. package/public/demo/npm-versions-demo.html +118 -0
  127. package/public/demo/npm-versions.html +94 -0
  128. package/public/demo/parameters.html +70 -0
  129. package/public/demo/s.xml +3 -0
  130. package/public/demo/s.xslt +56 -0
  131. package/public/demo/s1.xslt +60 -0
  132. package/public/demo/scoped-css.html +169 -0
  133. package/public/demo/set-url.html +141 -0
  134. package/public/demo/ss.html +57 -0
  135. package/public/demo/table.xml +25 -0
  136. package/public/demo/table.xsl +293 -0
  137. package/public/demo/template.xsl +46 -0
  138. package/public/demo/tree.xml +25 -0
  139. package/public/demo/tree.xsl +33 -0
  140. package/public/demo/wc-square.svg +1 -0
  141. package/public/demo/xhtml-template.xhtml +45 -0
  142. package/public/demo/z.html +33 -0
  143. package/public/demo/z.js +9 -0
  144. package/public/demo/z.xml +60 -0
  145. package/public/demo/z1.html +34 -0
  146. package/public/embed-1.html +1 -2
  147. package/public/mockServiceWorker.js +1 -1
  148. package/src/custom-element/custom-element.js +103 -33
  149. package/src/custom-element/demo/a.svg +27 -0
  150. package/src/custom-element/demo/confused.svg +1 -0
  151. package/src/custom-element/demo/demo.css +11 -8
  152. package/src/custom-element/demo/embed-1.html +1 -2
  153. package/src/custom-element/demo/external-template.html +122 -62
  154. package/src/custom-element/demo/lib-dir/Smiley.svg +24 -0
  155. package/src/custom-element/demo/lib-dir/embed-lib.html +34 -0
  156. package/src/custom-element/demo/module-url.html +215 -0
  157. package/src/custom-element/demo/npm-versions-demo.html +118 -0
  158. package/src/custom-element/demo/npm-versions.html +94 -0
  159. package/src/custom-element/demo/s.xml +3 -36
  160. package/src/custom-element/demo/s.xslt +55 -96
  161. package/src/custom-element/demo/set-url.html +1 -1
  162. package/src/custom-element/demo/z.html +32 -61
  163. package/src/custom-element/demo/z.js +9 -0
  164. package/src/custom-element/demo/z1.html +34 -0
  165. package/src/custom-element/ide/customData-dce.json +215 -181
  166. package/src/custom-element/ide/web-types-dce.json +184 -159
  167. package/src/custom-element/ide/web-types-xsl.json +1 -1
  168. package/src/custom-element/index.html +21 -3
  169. package/src/custom-element/local-storage.js +19 -14
  170. package/src/custom-element/module-url.js +34 -0
  171. package/src/mocks/handlers.ts +10 -1
  172. package/src/mocks/versions.mock.ts +786 -0
  173. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  174. package/src/stories/attributes.test.stories.ts +3 -5
  175. package/src/stories/dom-merge.test.stories.ts +9 -7
  176. package/src/stories/external-template.test.stories.ts +13 -10
  177. package/src/stories/local-storage.test.stories.ts +61 -53
  178. package/src/stories/module-url.test.stories.ts +183 -0
  179. package/src/stories/version-select.test.stories.ts +38 -12
  180. package/src/sum.test.ts +5 -5
  181. package/src/sum.ts +3 -3
  182. package/storybook-static/assets/Color-KGDBMAHA-CJo5gHY3.js +1 -0
  183. package/storybook-static/assets/{Configure-D0qG3gR9.js → Configure-DdXbGKhY.js} +2 -2
  184. package/storybook-static/assets/DocsRenderer-PKQXORMH-DLnpL5hE.js +2 -0
  185. package/storybook-static/assets/{attributes.test.stories-W34tZdUt.js → attributes.test.stories-Bt5V18qO.js} +10 -12
  186. package/storybook-static/assets/{css.test.stories-BZFYx1TQ.js → css.test.stories-CGYy2daE.js} +1 -1
  187. package/storybook-static/assets/custom-element-D8hcDZHh.js +265 -0
  188. package/storybook-static/assets/{dom-merge.test.stories-S-7U5N3h.js → dom-merge.test.stories-XlsZ0UvX.js} +22 -20
  189. package/storybook-static/assets/{entry-preview-DrgzXgwT.js → entry-preview-BKQ8UCxI.js} +1 -1
  190. package/storybook-static/assets/{entry-preview-docs-Bxv0qQWs.js → entry-preview-docs-BMKNVQXA.js} +2 -2
  191. package/storybook-static/assets/{external-template.test.stories-QIO3lAFz.js → external-template.test.stories-Bt_Pflu8.js} +23 -21
  192. package/storybook-static/assets/{form.test.stories-ClYhj9F1.js → form.test.stories-B0NoI8wm.js} +1 -1
  193. package/storybook-static/assets/handlers-B5969HUu.js +467 -0
  194. package/storybook-static/assets/http-request.stories-B2skuTFV.js +281 -0
  195. package/storybook-static/assets/iframe-Dfrt81rk.js +2 -0
  196. package/storybook-static/assets/index-Ay195x2L.js +605 -0
  197. package/storybook-static/assets/index-C3ChPTMh.js +1 -0
  198. package/storybook-static/assets/index-C7lvoJNv.js +1 -0
  199. package/storybook-static/assets/index-C8k3Z-3Y.js +28 -0
  200. package/storybook-static/assets/{index-DXimoRZY.js → index-D-8MO0q_.js} +1 -1
  201. package/storybook-static/assets/index-DGdNYaqV.js +8 -0
  202. package/storybook-static/assets/index-Gpdhz4ab.js +1 -0
  203. package/storybook-static/assets/lit-element-DzhCn-8W.js +19 -0
  204. package/storybook-static/assets/local-storage.test.stories-DfY6feqG.js +420 -0
  205. package/storybook-static/assets/{location-element.test.stories-DvH1TWK4.js → location-element.test.stories-944AotIJ.js} +1 -1
  206. package/storybook-static/assets/module-url.test.stories-DSKcwApl.js +208 -0
  207. package/storybook-static/assets/{preview-BKCN0mOr.js → preview-0Jj89qip.js} +1 -1
  208. package/storybook-static/assets/preview-AJR7rVPD.js +52 -0
  209. package/storybook-static/assets/{preview-TCN6m6T-.js → preview-BJPLiuSt.js} +1 -1
  210. package/storybook-static/assets/{preview-BDY5ThwJ.js → preview-BMWqy4Bi.js} +1 -1
  211. package/storybook-static/assets/preview-BnWGZYux.js +1 -0
  212. package/storybook-static/assets/preview-CadgX-4y.js +2 -0
  213. package/storybook-static/assets/{preview-BAz7FMXc.js → preview-DB9FwMii.js} +1 -1
  214. package/storybook-static/assets/preview-Djh1_Tal.js +20 -0
  215. package/storybook-static/assets/{set-url.test.stories-GlJOh31I.js → set-url.test.stories-DjLHKkEh.js} +1 -1
  216. package/storybook-static/assets/{slice-events.test.stories-VoNjuPCX.js → slice-events.test.stories-8I_BrHd6.js} +1 -1
  217. package/storybook-static/assets/{slots.test.stories-Da2j9YuO.js → slots.test.stories-CvZz4jyP.js} +1 -1
  218. package/storybook-static/assets/version-select.test.stories-DSxmJylI.js +109 -0
  219. package/storybook-static/confused.svg +1 -0
  220. package/storybook-static/demo/a.html +60 -0
  221. package/storybook-static/demo/a.svg +27 -0
  222. package/storybook-static/demo/b.html +13 -0
  223. package/storybook-static/demo/confused.svg +38 -0
  224. package/storybook-static/demo/data-slices.html +216 -0
  225. package/storybook-static/demo/dce-social-preview.png +0 -0
  226. package/storybook-static/demo/demo.css +25 -0
  227. package/storybook-static/demo/dom-merge.html +123 -0
  228. package/storybook-static/demo/embed-1.html +2 -0
  229. package/storybook-static/demo/external-template.html +239 -0
  230. package/storybook-static/demo/form.html +239 -0
  231. package/storybook-static/demo/hex-grid-dce.html +183 -0
  232. package/storybook-static/demo/hex-grid-transform.png +0 -0
  233. package/storybook-static/demo/hex-grid.html +66 -0
  234. package/storybook-static/demo/html-template.html +126 -0
  235. package/storybook-static/demo/html-template.xhtml +45 -0
  236. package/storybook-static/demo/html-template.xml +45 -0
  237. package/storybook-static/demo/http-request.html +143 -0
  238. package/storybook-static/demo/lib-dir/Smiley.svg +24 -0
  239. package/storybook-static/demo/lib-dir/embed-lib.html +34 -0
  240. package/storybook-static/demo/local-storage.html +218 -0
  241. package/storybook-static/demo/location-element.html +168 -0
  242. package/storybook-static/demo/logo.png +0 -0
  243. package/storybook-static/demo/module-url.html +215 -0
  244. package/storybook-static/demo/npm-versions-demo.html +118 -0
  245. package/storybook-static/demo/npm-versions.html +94 -0
  246. package/storybook-static/demo/parameters.html +70 -0
  247. package/storybook-static/demo/s.xml +3 -0
  248. package/storybook-static/demo/s.xslt +56 -0
  249. package/storybook-static/demo/s1.xslt +60 -0
  250. package/storybook-static/demo/scoped-css.html +169 -0
  251. package/storybook-static/demo/set-url.html +141 -0
  252. package/storybook-static/demo/ss.html +57 -0
  253. package/storybook-static/demo/table.xml +25 -0
  254. package/storybook-static/demo/table.xsl +293 -0
  255. package/storybook-static/demo/template.xsl +46 -0
  256. package/storybook-static/demo/tree.xml +25 -0
  257. package/storybook-static/demo/tree.xsl +33 -0
  258. package/storybook-static/demo/wc-square.svg +1 -0
  259. package/storybook-static/demo/xhtml-template.xhtml +45 -0
  260. package/storybook-static/demo/z.html +33 -0
  261. package/storybook-static/demo/z.js +9 -0
  262. package/storybook-static/demo/z.xml +60 -0
  263. package/storybook-static/demo/z1.html +34 -0
  264. package/storybook-static/embed-1.html +1 -2
  265. package/storybook-static/favicon.svg +1 -7
  266. package/storybook-static/iframe.html +42 -30
  267. package/storybook-static/index.html +36 -18
  268. package/storybook-static/index.json +1 -1
  269. package/storybook-static/mockServiceWorker.js +1 -1
  270. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  271. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  272. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  273. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  274. package/storybook-static/project.json +1 -1
  275. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +39 -36
  276. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +38 -1
  277. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  278. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +395 -43
  279. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -18
  280. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  281. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +221 -22
  282. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
  283. package/storybook-static/sb-common-assets/favicon.svg +1 -0
  284. package/storybook-static/sb-manager/globals-module-info.js +995 -1
  285. package/storybook-static/sb-manager/globals-runtime.js +53525 -1
  286. package/storybook-static/sb-manager/globals.js +48 -1
  287. package/storybook-static/sb-manager/runtime.js +11884 -1
  288. package/storybook-static/sb-preview/globals.js +33 -1
  289. package/storybook-static/sb-preview/runtime.js +9437 -108
  290. package/vite.config.js +2 -1
  291. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  292. package/.idea/compiler.xml +0 -6
  293. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  294. package/.vscode/settings.json +0 -24
  295. package/dist/custom-element-DAe7uvIt.js +0 -477
  296. package/dist/custom-element-DZvvhscI.cjs +0 -53
  297. package/dist/local-storage-Boafngui.cjs +0 -1
  298. package/dist/local-storage-BqDEu2kF.js +0 -59
  299. package/storybook-static/assets/Color-PRSJMWNM-CRSv4C7i.js +0 -1
  300. package/storybook-static/assets/DocsRenderer-K4EAMTCU-CG_P5zRZ.js +0 -2
  301. package/storybook-static/assets/WithTooltip-KJL26V4Q-CUqUi5E8.js +0 -1
  302. package/storybook-static/assets/custom-element-DpIq8E2p.js +0 -219
  303. package/storybook-static/assets/formatter-2WMMO6ZP-C-UiBIma.js +0 -58
  304. package/storybook-static/assets/http-request.stories-DCqY5s2i.js +0 -300
  305. package/storybook-static/assets/iframe-CURpvmVV.js +0 -2
  306. package/storybook-static/assets/index-CKw1EbdP.js +0 -1
  307. package/storybook-static/assets/index-CVRyq5ci.js +0 -27
  308. package/storybook-static/assets/index-Cc7K62zD.js +0 -3
  309. package/storybook-static/assets/index-DYpTqTNu.js +0 -1
  310. package/storybook-static/assets/index-DsWii_Ep.js +0 -548
  311. package/storybook-static/assets/index-DuIEV_9C.js +0 -13
  312. package/storybook-static/assets/lit-element-CenEXOuS.js +0 -19
  313. package/storybook-static/assets/local-storage.test.stories-BqgYwqr-.js +0 -419
  314. package/storybook-static/assets/preview-B4GcaC1c.js +0 -1
  315. package/storybook-static/assets/preview-B63p-W8V.js +0 -20
  316. package/storybook-static/assets/preview-DRnyIGXK.js +0 -48
  317. package/storybook-static/assets/preview-DjDbQHPa.js +0 -2
  318. package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-CDpEe51g.js +0 -1
  319. package/storybook-static/assets/version-select.test.stories-DLwf-TPB.js +0 -60
  320. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
  321. package/storybook-static/sb-common-assets/fonts.css +0 -31
  322. package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +0 -1
  323. package/storybook-static/sb-manager/chunk-B3YDJJJH.js +0 -347
  324. package/storybook-static/sb-manager/chunk-BLWCBWKL.js +0 -9
  325. package/storybook-static/sb-manager/chunk-GUVK2GTO.js +0 -6
  326. package/storybook-static/sb-manager/chunk-LFRML3ZV.js +0 -186
  327. package/storybook-static/sb-manager/chunk-MC7RAF2B.js +0 -274
  328. package/storybook-static/sb-manager/chunk-ZR5JZWHI.js +0 -1
  329. package/storybook-static/sb-manager/formatter-2WMMO6ZP-JI7RHVTW.js +0 -58
  330. package/storybook-static/sb-manager/index.js +0 -1
  331. package/storybook-static/sb-manager/syntaxhighlighter-BP7B2CQK-WOJYHKQR.js +0 -1
  332. /package/storybook-static/sb-addons/{storybook-core-server-presets-0 → storybook-core-core-server-presets-0}/common-manager-bundle.js.LEGAL.txt +0 -0
@@ -50,10 +50,9 @@ export const AttributeDefaults:Story =
50
50
  const canvas = within(canvasElement)
51
51
  , code = async (id) => (await canvas.findByTestId(id)).textContent.trim();
52
52
 
53
- await sleep(20)
54
- expect( await code('p1') ).toEqual('default_P1' );
55
- expect( await code('p2') ).toEqual('always_p2' );
56
- expect( await code('p3') ).toEqual('def_P3' );
53
+ expect( await await canvas.findByTestId('p1') ).toHaveTextContent('default_P1' );
54
+ expect( await await canvas.findByTestId('p2') ).toHaveTextContent('always_p2' );
55
+ expect( await await canvas.findByTestId('p3') ).toHaveTextContent('def_P3' );
57
56
  },
58
57
  };
59
58
 
@@ -123,7 +122,6 @@ export const InstanceAttributes:Story =
123
122
  const titleText = AttributeDefaults.args!.title as string;
124
123
  const canvas = within(canvasElement)
125
124
  , code = async (id) => (await canvas.findByTestId(id)).textContent.trim();
126
- debugger;
127
125
  await sleep(20)
128
126
  expect( await code('p1') ).toEqual('123' );
129
127
  expect( await code('p2') ).toEqual('always_p2' );
@@ -1,7 +1,7 @@
1
1
  // noinspection DuplicatedCode
2
2
 
3
3
  import type { StoryObj } from '@storybook/web-components';
4
- import {expect, getByTestId, within, userEvent} from '@storybook/test';
4
+ import {expect, within, userEvent, fireEvent} from '@storybook/test';
5
5
 
6
6
  import '../custom-element/custom-element.js';
7
7
  import {
@@ -123,16 +123,16 @@ export const OrderPreservingOn2ndTransform:Story =
123
123
  <p>IF condition content should be displayed in place where it is defined (not shifted down on the parent children)</p>
124
124
  <custom-element>
125
125
  <form slice="f1">
126
- <label>
127
- <input type="checkbox" name="c1" data-testid="cb1"/>
126
+ <label data-testid="cb1">
127
+ <input type="checkbox" name="c1" />
128
128
  click to display #1 bellow
129
129
  </label>
130
130
  <br data-testid="beforeC1"/>
131
131
  <if test="//c1">
132
132
  <p data-testid="isC1">#1</p>
133
133
  </if>
134
- <label>
135
- <input type="checkbox" name="c2" data-testid="cb2"/>
134
+ <label data-testid="cb2">
135
+ <input type="checkbox" name="c2" />
136
136
  click to display #2 bellow
137
137
  </label>
138
138
  <br data-testid="beforeC2"/>
@@ -148,9 +148,11 @@ export const OrderPreservingOn2ndTransform:Story =
148
148
  const canvas = within(canvasElement);
149
149
  await canvas.findByText(titleText);
150
150
 
151
- await userEvent.click(canvas.getByTestId('cb1'));
151
+ // userEvent breaks under FF in vitest, fireEvent works
152
+ await fireEvent.click(await canvas.findByTestId('cb1'));
152
153
  await expect(await canvas.findByText('#1')).toBeInTheDocument();
153
- await userEvent.click(canvas.getByTestId('cb2'));
154
+
155
+ await fireEvent.click(canvas.getByTestId('cb2'));
154
156
  await expect(await canvas.findByText('#2')).toBeInTheDocument();
155
157
  await expect(canvas.getByTestId("beforeC1").nextElementSibling).toEqual(canvas.getByTestId("isC1"))
156
158
  },
@@ -86,11 +86,15 @@ export const ExternalSvg:Story =
86
86
  {
87
87
  const canvas = within(canvasElement);
88
88
  await canvas.findByText(ExternalSvg.args!.title as string);
89
+
90
+ await expect(canvas.getByText('inline DCE loading from SVG ...')).toBeInTheDocument();
91
+
92
+ // needs separate test
93
+ // await expect( await canvas.findByText('loading from SVG ...')).toBeInTheDocument();
94
+
89
95
  expect(canvasElement.querySelector('[src="confused.svg"]').innerHTML).to.include('loading from SVG ...');
90
- await sleep(100);
91
- expect(canvasElement.querySelector('dce-external').innerHTML).to.include('<svg');
92
- expect(canvasElement.querySelector('[src="no.svg"]').innerHTML).to.include('Vitest Browser Tester');
93
- // "fallback for missing image" is not shown in test as test does not return 404, see test on 404 instead
96
+ await expect(await canvas.findByText('fallback for missing image')).toBeInTheDocument();
97
+ await expect(await canvas.findByTitle('Confused')).toBeInTheDocument();
94
98
  },
95
99
  };
96
100
 
@@ -111,9 +115,8 @@ export const ExternalXsltFile:Story =
111
115
  await canvas.findByText(ExternalXsltFile.args!.title as string);
112
116
  expect(canvasElement.querySelector('dce-external-4').innerHTML).to.include('Hi');
113
117
  expect(canvasElement.querySelector('[data-smile="👼"]').innerHTML).to.include('loading from XSLT ...');
114
- await sleep(100);
115
- expect(canvas.getByTestId('data-fruit').innerHTML).to.include('🍌');
116
- expect(canvas.getByTestId('data-smile').innerHTML).to.include('👼');
118
+ await expect(await canvas.findByTestId('data-fruit')).toHaveTextContent('🍌');
119
+ await expect(await canvas.findByTestId('data-smile')).toHaveTextContent('👼');
117
120
  },
118
121
  };
119
122
 
@@ -238,9 +241,9 @@ export const EmbeddingInAnotherFile:Story =
238
241
  {
239
242
  const canvas = within(canvasElement);
240
243
  await canvas.findByText(EmbeddingInAnotherFile.args!.title as string);
241
- await sleep(100);
242
- expect(await canvas.findByTestId('wave')).toBeInTheDocument();
243
- expect(canvas.getByTestId('wave').innerHTML).toEqual('🖖');
244
+ await sleep(1);
245
+ expect(await canvas.findByText('embed-1.html')).toBeInTheDocument();
246
+ expect(await canvas.findByText('🖖')).toBeInTheDocument();
244
247
  },
245
248
  };
246
249
 
@@ -1,10 +1,11 @@
1
1
  // noinspection DuplicatedCode
2
2
 
3
3
  import type { StoryObj } from '@storybook/web-components';
4
- import {expect, getByTestId, within} from '@storybook/test';
4
+ import {expect, userEvent, within} from '@storybook/test';
5
5
 
6
6
  import '../custom-element/custom-element.js';
7
7
  import '../custom-element/local-storage.js';
8
+ import {localStorage_clear, localStorage_removeItem, localStorageSetItem} from "../custom-element";
8
9
 
9
10
  type TProps = { title: string; slice: string; key: string; value:string; live:string; body:string};
10
11
  const defs: TProps =
@@ -50,41 +51,47 @@ const meta =
50
51
 
51
52
  export default meta;
52
53
 
54
+ window['localStorageSetItem'] = localStorageSetItem;
55
+ window['localStorage_clear'] = localStorage_clear;
56
+ window['localStorage_removeItem'] = localStorage_removeItem;
57
+
53
58
  export const Demo:Story =
54
59
  { args : {title: 'live value', live:'live', body:`
55
60
  <input placeholder="value for localStorage" id="textinput"
56
61
  slice="${defs.slice}"
57
62
  value="{ //${defs.slice} ?? '${ defs.value }' }"/>
58
- <button onclick="localStorage.setItem('${defs.key}',textinput.value )">set</button>
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>
63
+ <button onclick="localStorageSetItem('${defs.key}',textinput.value )">set</button>
64
+ <button onclick="localStorageSetItem('${defs.key}','text value' )">text value</button>
65
+ <button onclick="localStorageSetItem('${defs.key}','another text')">another text</button>
66
+ <button onclick="localStorage_removeItem('${defs.key}' )">set blank</button>
62
67
  `}
63
68
  , play: async ({canvasElement}) =>
64
69
  {
70
+ localStorage_clear();
65
71
  const canvas = within(canvasElement);
66
72
  await canvas.findByText(Demo.args!.title as string);
67
73
  const val = ()=> canvas.getByTestId('slice-value').textContent
68
- , byText = txt => canvas.getByText(txt);
74
+ await userEvent.click(await canvas.findByText('set blank'));
75
+ await expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
76
+ await expect( val() ).toEqual('');
69
77
 
70
- byText('set blank').click();
71
- expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
72
- expect( val() ).toEqual('');
73
- byText('text value').click();
78
+ await userEvent.click(canvas.getByText('text value'));
74
79
  await sleep(10);
75
- expect( val() ).toEqual('text value');
80
+ await expect(localStorage.getItem(defs.key)).toEqual('text value', 'from localStorage');
81
+ await expect( val() ).toEqual('text value');
76
82
 
77
83
  window['textinput'].value = 'textinput.value';
78
- byText('set').click();
84
+
85
+ await userEvent.click(canvas.getByText('set'));
79
86
  await sleep(10);
80
87
  expect( val() ).toEqual('textinput.value');
81
88
 
82
- byText('another text').click();
89
+ await userEvent.click(canvas.getByText('another text'));
83
90
  await sleep(10);
84
91
  expect( val() ).toEqual('another text');
85
92
 
93
+ await userEvent.click(canvas.getByText('set blank'));
86
94
 
87
- byText('set blank').click();
88
95
  await sleep(10);
89
96
  expect( val() ).toEqual('');
90
97
  },
@@ -94,31 +101,32 @@ export const Demo:Story =
94
101
  export const AlwaysOverride:Story =
95
102
  { args : {title: 'AlwaysOverride', live:'', value:'ABC', body:`
96
103
  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>
104
+ <button onclick="localStorageSetItem('${defs.key}','text value')">text value</button>
105
+ <button onclick="localStorage_removeItem('${defs.key}')">set blank</button>
99
106
  `}
100
107
  , play: async ({canvasElement}) =>
101
108
  {
102
109
  const canvas = within(canvasElement);
103
110
  await canvas.findByText(AlwaysOverride.args!.title as string);
104
- const val = ()=> canvas.getByTestId('slice-value').textContent
105
- , byText = txt => canvas.getByText(txt);
111
+ const val = ()=> canvas.getByTestId('slice-value').textContent;
112
+ const click = async (text)=> await userEvent.click( await canvas.findByText(text) );
113
+ await sleep(10);
106
114
 
107
- expect(localStorage.getItem(defs.key)).toEqual('ABC', 'from localStorage');
115
+ await expect( localStorage.getItem(defs.key)).toEqual('ABC');
108
116
 
109
- byText('set blank').click();
110
- expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
117
+ await click('set blank')
118
+ await expect(localStorage.getItem(defs.key)).toEqual(null, 'from localStorage');
111
119
  await sleep(10);
112
- expect( val() ).toEqual('ABC');
120
+ await expect( val() ).toEqual('ABC');
113
121
 
114
- byText('text value').click();
122
+ await click('text value');
115
123
  await sleep(10);
116
- expect(localStorage.getItem(defs.key)).toEqual('text value', 'from localStorage');
117
- expect( val() ).toEqual('ABC');
124
+ await expect(localStorage.getItem(defs.key)).toEqual('text value', 'from localStorage');
125
+ await expect( val() ).toEqual('ABC');
118
126
 
119
- byText('set blank').click();
127
+ await click('set blank');
120
128
  await sleep(10);
121
- expect( val() ).toEqual('ABC');
129
+ await expect( val() ).toEqual('ABC');
122
130
  },
123
131
  };
124
132
 
@@ -126,15 +134,15 @@ export const FromStorageWithDefault:Story =
126
134
  { args : {title: 'live value with defaults', live:'', value:'ABC', body:`
127
135
 
128
136
  <local-storage key="attr2Key" slice="attr2-key" type="text" live="live" slice-value="@value ?? 'DEF2'"></local-storage>
129
- <button onclick="localStorage.removeItem('attr2Key')">clear key</button>
130
- <button onclick="localStorage.setItem('attr2Key','attr2Key value')">update attr2-key value</button>
137
+ <button onclick="localStorage_removeItem('attr2Key')">clear key</button>
138
+ <button onclick="localStorageSetItem('attr2Key','attr2Key value')">update attr2-key value</button>
131
139
  //attr2-key: <code data-testid="key2-value">{//attr2-key}</code><br/>
132
140
 
133
141
  <local-storage key="attr3Key" slice="attr3-key" type="text" live="live" slice-value="@value ?? 'DEF3'"></local-storage>
134
- <button onclick="localStorage.removeItem('attr3Key')">clear attr3-key key</button>
135
- <button onclick="localStorage.setItem('attr3Key','attr3Key value')">update attr3-key value</button>
142
+ <button onclick="localStorage_removeItem('attr3Key')">clear attr3-key key</button>
143
+ <button onclick="localStorageSetItem('attr3Key','attr3Key value')">update attr3-key value</button>
136
144
  //attr3-key: <code data-testid="key3-value">{//attr3-key}</code><br/>
137
- <button onclick="localStorage.clear()">clear localStorage</button>
145
+ <button onclick="localStorage_clear()">clear localStorage</button>
138
146
  `}
139
147
  , play: async ({canvasElement}) =>
140
148
  {
@@ -177,39 +185,39 @@ export const TypeAttribute:Story =
177
185
  <local-storage key="jsonKey" slice="json-key" type="json" live="live"></local-storage>
178
186
  <input id="typesinput" placeholder="set value"><button onclick="
179
187
  'textKey,dateKey,timeKey,localDateTimeKey,numberKey,jsonKey'.split(',')
180
- .map( k=> localStorage.setItem(k, typesinput.value) )
188
+ .map( k=> localStorageSetItem(k, typesinput.value) )
181
189
  "> set to all</button><br>
182
190
  <hr>
183
191
  text-key:
184
- <button onclick="localStorage.setItem('textKey', 'ABC' )">ABC</button>
192
+ <button onclick="localStorageSetItem('textKey', 'ABC' )">ABC</button>
185
193
  <code data-testid="text-key">{//text-key }</code><br>
186
194
  date-key:
187
- <button onclick="localStorage.setItem('dateKey', '2024-04-20T03:58:42.131Z')">2024-04-21T03:58:42.131Z </button>
188
- <button onclick="localStorage.setItem('dateKey', new Date(Date.now()).toISOString())">now </button>
189
- <button onclick="localStorage.setItem('dateKey', 'ABC' )">date ABC - invalid </button>
195
+ <button onclick="localStorageSetItem('dateKey', '2024-04-20T03:58:42.131Z')">2024-04-21T03:58:42.131Z </button>
196
+ <button onclick="localStorageSetItem('dateKey', new Date(Date.now()).toISOString())">now </button>
197
+ <button onclick="localStorageSetItem('dateKey', 'ABC' )">date ABC - invalid </button>
190
198
  <code data-testid="date-key">{//date-key }</code><br>
191
199
  time-key:
192
- <button onclick="localStorage.setItem('timeKey', '13:30')">13:30 </button>
200
+ <button onclick="localStorageSetItem('timeKey', '13:30')">13:30 </button>
193
201
  <code data-testid="time-key">{//time-key }</code><br>
194
202
  local-date-time:
195
- <button onclick="localStorage.setItem('localDateTimeKey', '1977-04-01T14:00:30')">1977-04-01T14:00:30 - local </button>
203
+ <button onclick="localStorageSetItem('localDateTimeKey', '1977-04-01T14:00:30')">1977-04-01T14:00:30 - local </button>
196
204
  <code data-testid="local-date-time">{//local-date-time}</code><br>
197
205
  number-key:
198
- <button onclick="localStorage.setItem('numberKey', '2024' )">2024 - number </button>
199
- <button onclick="localStorage.setItem('numberKey', '24' )">24 - number </button>
200
- <button onclick="localStorage.setItem('numberKey', '1.23456e+5' )">1.23456e+5 </button>
201
- <button onclick="localStorage.setItem('numberKey', '0001' )">0001 </button>
202
- <button onclick="localStorage.setItem('numberKey', '000' )">000 </button>
203
- <button onclick="localStorage.setItem('numberKey', '0' )">0 </button>
204
- <button onclick="localStorage.setItem('numberKey', 'ABC' )">ABC - invalid, NaN </button>
206
+ <button onclick="localStorageSetItem('numberKey', '2024' )">2024 - number </button>
207
+ <button onclick="localStorageSetItem('numberKey', '24' )">24 - number </button>
208
+ <button onclick="localStorageSetItem('numberKey', '1.23456e+5' )">1.23456e+5 </button>
209
+ <button onclick="localStorageSetItem('numberKey', '0001' )">0001 </button>
210
+ <button onclick="localStorageSetItem('numberKey', '000' )">000 </button>
211
+ <button onclick="localStorageSetItem('numberKey', '0' )">0 </button>
212
+ <button onclick="localStorageSetItem('numberKey', 'ABC' )">ABC - invalid, NaN </button>
205
213
  <code data-testid="number-key">{//number-key }</code> <br>
206
214
  <fieldset>
207
215
  <legend>json-key: </legend>
208
216
 
209
- <button onclick="localStorage.setItem('jsonKey', JSON.stringify('ABC'))">'ABC' - string </button>
210
- <button onclick="localStorage.setItem('jsonKey', JSON.stringify(12.345))">12.345 - number </button>
211
- <button onclick="localStorage.setItem('jsonKey', JSON.stringify(window.JsonSample) )">a:1,b:'B' -json </button>
212
- <button onclick="localStorage.setItem('jsonKey', 'ABC' )">ABC - invalid </button><br>
217
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify('ABC'))">'ABC' - string </button>
218
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(12.345))">12.345 - number </button>
219
+ <button onclick="localStorageSetItem('jsonKey', JSON.stringify(window.JsonSample) )">a:1,b:'B' -json </button>
220
+ <button onclick="localStorageSetItem('jsonKey', 'ABC' )">ABC - invalid </button><br>
213
221
  json-key:<code data-testid="json-key"><xsl:apply-templates select="//json-key/value/@*|//json-key/text()|//json-key/value/text()" mode="json"></xsl:apply-templates></code>
214
222
  </fieldset>
215
223
  <xsl:template mode="json" match="*|@*">
@@ -224,8 +232,8 @@ export const TypeAttribute:Story =
224
232
  await canvas.findByText(TypeAttribute.args!.title as string);
225
233
  const byText = txt => canvas.getByText(txt)
226
234
  , val = testId => canvas.getByTestId(testId).textContent
227
- , expectVal = (key,value) => { expect(val( key )).toEqual( value, key ) };
228
- localStorage.clear(); // cleanup before test
235
+ , expectVal = (key,value) => { expect(val( key ).trim()).toEqual( value, key ) };
236
+ localStorage_clear(); // cleanup before test
229
237
  await sleep(10);
230
238
 
231
239
  expectVal('text-key' ,'');
@@ -385,7 +393,7 @@ export const TypeAttribute:Story =
385
393
  expectVal('time-key' ,'' );
386
394
  expectVal('local-date-time','' );
387
395
  expectVal('number-key' ,'NaN' );
388
- expectVal('json-key' ,'\na : 1b : B' );
396
+ expectVal('json-key' ,'a : 1b : B' );
389
397
  },
390
398
  };
391
399
 
@@ -0,0 +1,183 @@
1
+ // noinspection DuplicatedCode
2
+
3
+ // importmap is located at .storybook/preview-head.html
4
+ // for vitest wrap `pathe.resolve` method to capture /tester/tester.html and redirect to its clone with ^^ injected
5
+ // as in vite.config.js
6
+ // test requires bin/vitest/vitest-browser-importmaps.mjs to inject importmap into tester.html
7
+ // the relative path prefix in vitest is `../../..`
8
+
9
+ import type { StoryObj } from '@storybook/web-components';
10
+ import {expect, getByTestId, within} from '@storybook/test';
11
+
12
+ import '../custom-element/custom-element.js';
13
+ import '../custom-element/module-url.js';
14
+ import {Demo, SrcAttribute} from './location-element.test.stories';
15
+
16
+ type TProps = { title: string; body:string};
17
+
18
+ type Story = StoryObj<TProps>;
19
+ function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); }
20
+
21
+ function render(args: TProps)
22
+ {
23
+ const {title, body} = args;
24
+ return `
25
+ <fieldset>
26
+ <legend>${ title }</legend>
27
+ ${ body }
28
+ </fieldset>
29
+ `;
30
+ }
31
+ const meta =
32
+ { title: 'module-url'
33
+ , render
34
+ };
35
+
36
+ export default meta;
37
+
38
+ // for StoryBook './demo/embed-1.html' is sufficient as current page is on root level
39
+ // vitest page needs 3 levels up
40
+
41
+ export const RelativeToPagePath:Story =
42
+ { args : {title: '1. relative to page path', body:`
43
+ <custom-element>
44
+ <a href="../../../demo/embed-1.html">
45
+ <custom-element src="../../../demo/embed-1.html"></custom-element>
46
+ </a>
47
+ </custom-element>
48
+ `}
49
+ , play: async ({canvasElement}) =>
50
+ {
51
+ const canvas = within(canvasElement);
52
+ await canvas.findByText(RelativeToPagePath.args!.title as string);
53
+
54
+ await expect(await canvas.findByText('🖖')).toBeInTheDocument();
55
+ await expect(await canvas.findByText('embed-1.html')).toBeInTheDocument();
56
+ },
57
+ };
58
+
59
+
60
+ export const ModuleBySymbolicName:Story =
61
+ { args : {title: '2. module by symbolic name', body:`
62
+ <custom-element>
63
+ <template>
64
+ <module-url slice="lib-url" src="embed-lib"></module-url>
65
+ <if test="//lib-url/@error">
66
+ <p>error: <b>{//lib-url/@error}</b></p>
67
+ </if>
68
+ check the link:
69
+ <a href="{//lib-url}">
70
+ <custom-element src="embed-lib#embed-lib-component">
71
+ failed to load
72
+ </custom-element>
73
+ </a>
74
+ </template>
75
+ </custom-element>
76
+ `}
77
+ , play: async ({canvasElement}) =>
78
+ {
79
+ const p = import.meta.resolve('embed-lib');
80
+ const canvas = within(canvasElement);
81
+ await canvas.findByText(ModuleBySymbolicName.args!.title as string);
82
+
83
+ await expect(await canvas.findByText('check the link:')).toBeInTheDocument();
84
+ await expect(await canvas.findByText('👋 from embed-lib-component')).toBeInTheDocument();
85
+ },
86
+ };
87
+
88
+ export const MissingImportmapEntry:Story =
89
+ { args : {title: '3. module by symbolic name with missing importmap entry', body:`
90
+ <custom-element>
91
+ <template>
92
+ <module-url slice="lib-url" src="fakedemo-lib/embed-lib.html"></module-url>
93
+ <if test="//lib-url/@error">
94
+ <p>error: <b>{//lib-url/@error}</b></p>
95
+ </if>
96
+ the link is broken:
97
+ <a href="{//lib-url}">
98
+ <custom-element src="fakedemo-lib/embed-lib.html#embed-lib-component">
99
+ failed to load
100
+ </custom-element>
101
+ </a>
102
+ </template>
103
+ </custom-element>
104
+ `}
105
+ , play: async ({canvasElement}) =>
106
+ {
107
+ const canvas = within(canvasElement);
108
+ await canvas.findByText(MissingImportmapEntry.args!.title as string);
109
+
110
+ await expect(await canvas.findByText('error:')).toBeInTheDocument();
111
+ await expect(await canvas.findByText('failed to load')).toBeInTheDocument();
112
+ },
113
+ };
114
+
115
+
116
+ export const ModuleByName:Story =
117
+ { args : {title: '4. module path by symbolic name', body:`
118
+ <custom-element>
119
+ <template>
120
+ <module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-hash"></module-url>
121
+ <module-url slice="img-url" src="lib-root/Smiley.svg"></module-url>
122
+ <if test="//lib-url/@error">
123
+ <p>error: <b>{//lib-url/@error}</b></p>
124
+ </if>
125
+ check the link:
126
+ <a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-hash <img src="{//img-url}" alt=""/></a>
127
+ <custom-element src="lib-root/embed-lib.html#embed-relative-hash">
128
+ failed to load
129
+ </custom-element>
130
+
131
+ </template>
132
+ </custom-element>
133
+ `}
134
+ , play: async ({canvasElement}) =>
135
+ {
136
+ const canvas = within(canvasElement);
137
+ await canvas.findByText(ModuleByName.args!.title as string);
138
+ await expect(await canvas.findByText('👌 from embed-relative-hash invoking')).toBeInTheDocument();
139
+ await expect(await canvas.findByText('lib-root/embed-lib.html#embed-relative-hash')).toBeInTheDocument();
140
+ await expect(await canvas.findByText('#embed-lib-component')).toBeInTheDocument();
141
+ },
142
+ };
143
+
144
+
145
+ export const HashWithinLib:Story =
146
+ { args : {title: '5. module path by symbolic name to internal link within lib', body:`
147
+ <custom-element>
148
+ <template>
149
+ <module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-file"></module-url>
150
+ <if test="//lib-url/@error">
151
+ <p>error: <b>{//lib-url/@error}</b></p>
152
+ </if>
153
+ check the link:
154
+ <a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-file </a>
155
+ <custom-element src="lib-root/embed-lib.html#embed-relative-file">
156
+ failed to load
157
+ </custom-element>
158
+ </template>
159
+ </custom-element>
160
+ `}
161
+ , play: async ({canvasElement}) =>
162
+ {
163
+ const canvas = within(canvasElement);
164
+ await canvas.findByText(HashWithinLib.args!.title as string);
165
+
166
+ await expect(await canvas.findByText('lib-root/embed-lib.html#embed-relative-file')).toBeInTheDocument();
167
+ await expect(await canvas.findByText('👍 from embed-relative-file invoking')).toBeInTheDocument();
168
+ await expect(await canvas.findByText('../embed-1.html')).toBeInTheDocument();
169
+ await expect(await canvas.findByText('embed-1.html')).toBeInTheDocument();
170
+ await expect(await canvas.findByText('🖖')).toBeInTheDocument();
171
+ },
172
+ };
173
+
174
+
175
+ /* istanbul ignore else -- @preserve */
176
+ if( 'test' === import.meta.env.MODE &&
177
+ !import.meta.url.includes('skiptest') )
178
+ {
179
+ const mod = await import('./module-url.test.stories.ts?skiptest');
180
+ const { testStoryBook } = await import('./testStoryBook')
181
+ const { describe } = await import('vitest')
182
+ describe(meta.title, () => testStoryBook( mod, meta ) );
183
+ }
@@ -5,6 +5,7 @@ import {expect, within} from '@storybook/test';
5
5
 
6
6
  import '../custom-element/custom-element.js';
7
7
  import '../custom-element/http-request.js';
8
+ import '../custom-element/location-element.js';
8
9
 
9
10
  type TProps = { title: string; body:string};
10
11
 
@@ -23,7 +24,7 @@ function render(args: TProps)
23
24
  `;
24
25
  }
25
26
  const meta =
26
- { title: 'site/VersionSelect'
27
+ { title: 'site'
27
28
  // , tags: ['autodocs']
28
29
  , render
29
30
  };
@@ -35,18 +36,42 @@ export const VersionsSelect:Story =
35
36
  <p>Select the version of custom-element StoryBook.</p>
36
37
  <custom-element >
37
38
  <template>
39
+ <variable name="url" select="//window-location/value/@href"></variable>
40
+ <variable name="current-version" >0{
41
+ substring-before(substring-after(substring($url, string-length(substring-before($url, '/')) - string-length(substring-before(substring-before($url, '/'), '@0')) + 2), '@0'), '/')
42
+ }</variable>
43
+ <location-element slice="window-location" live>
44
+ <xsl:if test=" not(//selected-version = $current-version ) and not(//selected-version = '') ">
45
+ <attribute name="src">{ concat( substring-before($url, $current-version),
46
+ //selected-version,
47
+ substring-after($url, $current-version) ) }</attribute>
48
+ <attribute name="method">location.href</attribute>
49
+ </if>
50
+ </location-element>
38
51
  <http-request
39
52
  url="https://registry.npmjs.org/@epa-wg/custom-element-dist"
40
53
  method="GET"
41
54
  header-accept="application/json"
42
- slice="page" ></http-request>
43
- <xhtml:select>
44
- <for-each select="//versions/*">
45
- <option>
46
- {./@version}
47
- </option>
48
- </for-each>
49
- </xhtml:select>
55
+ slice="versions-ajax" ></http-request>
56
+
57
+ <label>version:
58
+ <xhtml:select slice="selected-version" autocomplete="off" name="version">
59
+ <for-each select="//versions/*">
60
+ <option value="{./@version}">
61
+ <variable name="item-version">{./@version}</variable>
62
+ { $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
63
+ </option>
64
+ </for-each>
65
+ <for-each select="//versions/*">
66
+ <if test="./@version = $current-version">
67
+ <option selected value="{./@version}">
68
+ <variable name="item-version">{./@version}</variable>
69
+ { $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
70
+ </option>
71
+ </if>
72
+ </for-each>
73
+ </xhtml:select>
74
+ </label>
50
75
  </template>
51
76
  </custom-element>
52
77
  <dce-link id="dce1"></dce-link>
@@ -57,10 +82,11 @@ export const VersionsSelect:Story =
57
82
  const canvas = within(canvasElement)
58
83
  , code = async (id) => (await canvas.findByTestId(id)).textContent.trim();
59
84
 
85
+ window.location.hash = '#@epa-wg/custom-element-dist@0.0.24/storybook-static/index.html'
60
86
  await sleep(20)
61
- expect( await code('p1') ).toEqual('default_P1' );
62
- expect( await code('p2') ).toEqual('always_p2' );
63
- expect( await code('p3') ).toEqual('def_P3' );
87
+ // expect( await code('p1') ).toEqual('default_P1' );
88
+ // expect( await code('p2') ).toEqual('always_p2' );
89
+ // expect( await code('p3') ).toEqual('def_P3' );
64
90
  },
65
91
  };
66
92
 
package/src/sum.test.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { expect, test } from 'vitest'
2
- import { sum } from './sum'
3
-
4
- test('adds 1 + 2 to equal 3', () => {
5
- expect(sum(1, 2)).toBe(3)
1
+ import { expect, test } from 'vitest'
2
+ import { sum } from './sum'
3
+
4
+ test('adds 1 + 2 to equal 3', () => {
5
+ expect(sum(1, 2)).toBe(3)
6
6
  })
package/src/sum.ts CHANGED
@@ -1,4 +1,4 @@
1
- // sum.js
2
- export function sum(a: number, b: number) {
3
- return a + b
1
+ // sum.js
2
+ export function sum(a: number, b: number) {
3
+ return a + b
4
4
  }