@magnit-ce/code-tests 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -64
- package/dist/code-tests.d.ts +172 -58
- package/dist/code-tests.js +1178 -1012
- package/dist/code-tests.min.js +1 -475
- package/dist/code-tests.umd.js +1434 -0
- package/dist/code-tests.umd.min.js +1 -0
- package/package.json +25 -24
- package/dist/code-tests.cjs +0 -1296
- package/dist/code-tests.d.cts +0 -58
package/dist/code-tests.min.js
CHANGED
|
@@ -1,475 +1 @@
|
|
|
1
|
-
var w=`:host
|
|
2
|
-
{
|
|
3
|
-
/*** gray ***/
|
|
4
|
-
--uchu-light-gray-raw: 95.57% 0.003 286.35;
|
|
5
|
-
--uchu-light-gray: oklch(var(--uchu-light-gray-raw));
|
|
6
|
-
|
|
7
|
-
--uchu-gray-raw: 84.68% 0.002 197.12;
|
|
8
|
-
--uchu-gray: oklch(var(--uchu-gray-raw));
|
|
9
|
-
|
|
10
|
-
--uchu-dark-gray-raw: 63.12% 0.004 219.55;
|
|
11
|
-
--uchu-dark-gray: oklch(var(--uchu-dark-gray-raw));
|
|
12
|
-
|
|
13
|
-
/*** red ***/
|
|
14
|
-
--uchu-light-red-raw: 88.98% 0.052 3.28;
|
|
15
|
-
--uchu-light-red: oklch(var(--uchu-light-red-raw));
|
|
16
|
-
|
|
17
|
-
--uchu-dark-red-raw: 45.8% 0.177 17.7;
|
|
18
|
-
--uchu-dark-red: oklch(var(--uchu-dark-red-raw));
|
|
19
|
-
|
|
20
|
-
/*** purple ***/
|
|
21
|
-
--uchu-light-purple-raw: 89.1% 0.046 305.24;
|
|
22
|
-
--uchu-light-purple: oklch(var(--uchu-light-purple-raw));
|
|
23
|
-
|
|
24
|
-
--uchu-dark-purple-raw: 39.46% 0.164 298.29;
|
|
25
|
-
--uchu-dark-purple: oklch(var(--uchu-dark-purple-raw));
|
|
26
|
-
|
|
27
|
-
/*** blue ***/
|
|
28
|
-
--uchu-light-blue-raw: 89.66% 0.046 260.67;
|
|
29
|
-
--uchu-light-blue: oklch(var(--uchu-light-blue-raw));
|
|
30
|
-
|
|
31
|
-
--uchu-blue-raw: 62.39% 0.181 258.33;
|
|
32
|
-
--uchu-blue: oklch(var(--uchu-blue-raw));
|
|
33
|
-
|
|
34
|
-
--uchu-dark-blue-raw: 43.48% 0.17 260.2;
|
|
35
|
-
--uchu-dark-blue: oklch(var(--uchu-dark-blue-raw));
|
|
36
|
-
|
|
37
|
-
/*** green ***/
|
|
38
|
-
--uchu-light-green-raw: 93.96% 0.05 148.74;
|
|
39
|
-
--uchu-light-green: oklch(var(--uchu-light-green-raw));
|
|
40
|
-
|
|
41
|
-
--uchu-green-raw: 79.33% 0.179 145.62;
|
|
42
|
-
--uchu-green: oklch(var(--uchu-green-raw));
|
|
43
|
-
|
|
44
|
-
--uchu-dark-green-raw: 58.83% 0.158 145.05;
|
|
45
|
-
--uchu-dark-green: oklch(var(--uchu-dark-green-raw));
|
|
46
|
-
|
|
47
|
-
/*** general ***/
|
|
48
|
-
--uchu-yang-raw: 99.4% 0 0;
|
|
49
|
-
--uchu-yang: oklch(var(--uchu-yang-raw));
|
|
50
|
-
|
|
51
|
-
--uchu-yin-raw: 14.38% 0.007 256.88;
|
|
52
|
-
--uchu-yin: oklch(var(--uchu-yin-raw));
|
|
53
|
-
|
|
54
|
-
/*** code-tests vars ***/
|
|
55
|
-
|
|
56
|
-
--spacer: calc(1em - 7px);
|
|
57
|
-
--small-spacer: calc(var(--spacer) / 2);
|
|
58
|
-
|
|
59
|
-
--color-success: var(--uchu-green);
|
|
60
|
-
--color-fail: var(--uchu-red);
|
|
61
|
-
--color-process: var(--uchu-blue);
|
|
62
|
-
|
|
63
|
-
--text-surface: var(--uchu-yin);
|
|
64
|
-
--text-result: var(--uchu-yang); /* --uchu-yang: #fdfdfd; */
|
|
65
|
-
--text-collapse-icon: var(--uchu-dark-gray); /* --uchu-dark-gray: #878a8b; */
|
|
66
|
-
--text-hook-summary: var(--uchu-dark-purple);
|
|
67
|
-
--text-success: var(--uchu-dark-green); /* --uchu-dark-green: #2e943a; */
|
|
68
|
-
--text-fail: var(--uchu-dark-red); /* --uchu-dark-red: #a30d30; */
|
|
69
|
-
--text-process: var(--uchu-dark-blue); /* --uchu-dark-blue: #0949ac; */
|
|
70
|
-
--text-button: var(--uchu-yang); /* --uchu-dark-blue: #0949ac; */
|
|
71
|
-
--text-placeholder: var(--uchu-dark-gray);
|
|
72
|
-
|
|
73
|
-
--surface-0: var(--uchu-light-gray);
|
|
74
|
-
--surface-test: var(--uchu-yang);
|
|
75
|
-
--surface-test-summary: var(--uchu-gray);
|
|
76
|
-
--surface-hook-summary: var(--uchu-light-purple);
|
|
77
|
-
--surface-success: var(--uchu-light-green);
|
|
78
|
-
--surface-fail: var(--uchu-light-red);
|
|
79
|
-
--surface-process: var(--uchu-light-blue);
|
|
80
|
-
--surface-button: var(--uchu-blue); /* --uchu-blue: #3984f2 */
|
|
81
|
-
--surface-button-hover: var(--uchu-light-blue);
|
|
82
|
-
--surface-button-active: var(--uchu-dark-blue);
|
|
83
|
-
--surface-button-cancel: var(--uchu-dark-blue);
|
|
84
|
-
|
|
85
|
-
--border-test: solid 1px var(--uchu-dark-gray);
|
|
86
|
-
--border-hook: solid 1px var(--uchu-dark-purple);
|
|
87
|
-
--border-success: solid 1px var(--uchu-dark-green);
|
|
88
|
-
--border-fail: solid 1px var(--uchu-dark-red);
|
|
89
|
-
--border-process: solid 1px var(--uchu-dark-blue);
|
|
90
|
-
--border-button: solid 1px var(--uchu-blue);
|
|
91
|
-
|
|
92
|
-
--success-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%232e943a" d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg>');
|
|
93
|
-
--info-icon: url('data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2022.812714%2022.814663%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Asvg%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20style%3D%22fill%3Atransparent%3Bstroke%3Atransparent%3Bstroke-width%3A0.999999%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A6.3%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A29.2913%3Bstroke-opacity%3A1%22%20d%3D%22M%2022.295505%2C11.407332%20A%2010.889144%2C10.889144%200%200%201%2011.406424%2C22.296479%2010.889144%2C10.889144%200%200%201%200.51720881%2C11.407332%2010.889144%2C10.889144%200%200%201%2011.406424%2C0.51818382%2010.889144%2C10.889144%200%200%201%2022.295505%2C11.407332%20Z%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22m%2013.945668%2C4.3053761%20c%200.150778%2C-0.96462%20-0.30687%2C-1.43709%20-1.36997%2C-1.43709%20-1.063%2C0%20-1.668452%2C0.47247%20-1.81923%2C1.43709%20-0.150779%2C0.96462%200.306971%2C1.43708%201.369971%2C1.43708%201.004%2C0%201.66845%2C-0.47246%201.819229%2C-1.43708%20z%20M%2011.693889%2C17.829726%2013.373994%2C7.0811161%20h%20-2.9333%20L%208.7605887%2C17.829726%20Z%22%20style%3D%22font-size%3A19.6861px%3Bfont-family%3APassageway%3B-inkscape-font-specification%3APassageway%3Bfill%3A%23a30d30%3Bstroke-width%3A2.5%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A6.3%3Bstroke-dashoffset%3A29.2913%22%20aria-label%3D%22i%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');
|
|
94
|
-
|
|
95
|
-
--font-text: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
96
|
-
|
|
97
|
-
/*** styles ***/
|
|
98
|
-
|
|
99
|
-
color-scheme: light dark;
|
|
100
|
-
display: grid;
|
|
101
|
-
gap: var(--spacer);
|
|
102
|
-
background-color: var(--surface-0);
|
|
103
|
-
color: var(--text-surface);
|
|
104
|
-
padding: var(--small-spacer);
|
|
105
|
-
font-family: var(--font-text);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
#header
|
|
109
|
-
{
|
|
110
|
-
display: grid;
|
|
111
|
-
grid-template-columns: 1fr auto;
|
|
112
|
-
align-items: center;
|
|
113
|
-
gap: var(--spacer);
|
|
114
|
-
border-bottom: solid 2px;
|
|
115
|
-
padding: var(--spacer);
|
|
116
|
-
margin-bottom: var(--spacer);
|
|
117
|
-
user-select: none;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
#title
|
|
121
|
-
{
|
|
122
|
-
font-weight: bold;
|
|
123
|
-
font-size: 16px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.hook
|
|
127
|
-
{
|
|
128
|
-
display: none;
|
|
129
|
-
}
|
|
130
|
-
:host(.has-before-hook) #before-all-details
|
|
131
|
-
,:host(.has-after-hook) #after-all-details
|
|
132
|
-
{
|
|
133
|
-
display: initial;
|
|
134
|
-
}
|
|
135
|
-
:host(.has-required-before-hook) #required-before-any-details
|
|
136
|
-
,:host(.has-required-after-hook) #required-after-any-details
|
|
137
|
-
{
|
|
138
|
-
display: initial;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#required-before-any-summary
|
|
142
|
-
,#required-after-any-summary
|
|
143
|
-
{
|
|
144
|
-
background: var(--surface-process);
|
|
145
|
-
color: var(--text-process);
|
|
146
|
-
border: solid 1px var(--text-process);
|
|
147
|
-
grid-template-columns: auto auto 1fr;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
#tests
|
|
151
|
-
{
|
|
152
|
-
margin: 0;
|
|
153
|
-
padding: 0;
|
|
154
|
-
list-style: none;
|
|
155
|
-
display: grid;
|
|
156
|
-
grid-auto-rows: max-content;
|
|
157
|
-
gap: var(--spacer);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
summary
|
|
161
|
-
{
|
|
162
|
-
display: grid;
|
|
163
|
-
gap: var(--spacer);
|
|
164
|
-
padding: var(--small-spacer) var(--spacer);
|
|
165
|
-
align-items: center;
|
|
166
|
-
}
|
|
167
|
-
summary::before
|
|
168
|
-
{
|
|
169
|
-
content: '';
|
|
170
|
-
width: 16px;
|
|
171
|
-
height: 16px;
|
|
172
|
-
background: url("data:image/svg+xml,%3Csvg%20viewBox%3D'0%200%2020%2020'%20width%3D'14px'%20height%3D'14px'%20fill%3D'none'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cg%20stroke-width%3D'0'%3E%3C%2Fg%3E%3Cg%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3C%2Fg%3E%3Cg%3E%3Cpath%20d%3D'M8.72798%2015.795L3.72798%207.795C3.10356%206.79593%203.82183%205.5%204.99998%205.5L15%205.5C16.1781%205.5%2016.8964%206.79593%2016.272%207.795L11.272%2015.795C10.6845%2016.735%209.31549%2016.735%208.72798%2015.795Z'%20fill%3D'%23878a8b'%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
|
173
|
-
transform: rotate(-90deg);
|
|
174
|
-
transition: transform ease-out 200ms;
|
|
175
|
-
}
|
|
176
|
-
[open] > summary::before
|
|
177
|
-
{
|
|
178
|
-
transform: rotate(0);
|
|
179
|
-
/* background: var(--surface-test-summary); */
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
:host(.running) .run[data-all]
|
|
183
|
-
{
|
|
184
|
-
color: var(--text-surface);
|
|
185
|
-
background-color: oklch(89.68% 0.002 197.12);
|
|
186
|
-
border-color: oklch(63.12% 0.004 219.55);
|
|
187
|
-
}
|
|
188
|
-
:host(.running) .run[data-all]:hover
|
|
189
|
-
{
|
|
190
|
-
background-color: oklch(95.57% 0.003 286.35);
|
|
191
|
-
border-color: oklch(63.12% 0.004 219.55);
|
|
192
|
-
}
|
|
193
|
-
:host(.running) .run[data-all]:active
|
|
194
|
-
{
|
|
195
|
-
background-color: oklch(63.12% 0.004 219.55);
|
|
196
|
-
border-color: oklch(53.12% 0.004 219.55);
|
|
197
|
-
}
|
|
198
|
-
:host(.running) .run[data-all]::before
|
|
199
|
-
{
|
|
200
|
-
display: none;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
#before-all-summary
|
|
204
|
-
,#after-all-summary
|
|
205
|
-
{
|
|
206
|
-
background: var(--surface-hook-summary);
|
|
207
|
-
color: var(--text-hook-summary);
|
|
208
|
-
grid-template-columns: auto auto 1fr;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.result-icon
|
|
212
|
-
{
|
|
213
|
-
--background-size: 24px;
|
|
214
|
-
width: var(--background-size);
|
|
215
|
-
height: var(--background-size);
|
|
216
|
-
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
justify-content: center;
|
|
220
|
-
|
|
221
|
-
border: solid 1px currentColor;
|
|
222
|
-
border-radius: 50%;
|
|
223
|
-
}
|
|
224
|
-
.result-icon::before
|
|
225
|
-
{
|
|
226
|
-
content: '\u22EF';
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.hook
|
|
230
|
-
{
|
|
231
|
-
border: var(--border-hook);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.test
|
|
235
|
-
,#before-all-details
|
|
236
|
-
,#after-all-details
|
|
237
|
-
{
|
|
238
|
-
border: var(--border-test);
|
|
239
|
-
border-radius: 2px;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.test summary
|
|
243
|
-
{
|
|
244
|
-
background: var(--surface-test-summary);
|
|
245
|
-
grid-template-columns: auto auto 1fr auto;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.test.running .result-icon
|
|
249
|
-
,.hook.running .result-icon
|
|
250
|
-
{
|
|
251
|
-
border: var(--border-process);
|
|
252
|
-
background: var(--surface-process);
|
|
253
|
-
}
|
|
254
|
-
.test.success .result-icon
|
|
255
|
-
,.hook.success .result-icon
|
|
256
|
-
{
|
|
257
|
-
border: var(--border-success);
|
|
258
|
-
background: var(--surface-success)
|
|
259
|
-
var(--success-icon);
|
|
260
|
-
background-repeat: no-repeat;
|
|
261
|
-
background-position: center;
|
|
262
|
-
background-size: var(--icon-size, 16px) var(--icon-size, 16px);
|
|
263
|
-
}
|
|
264
|
-
.test.fail .result-icon
|
|
265
|
-
,.hook.fail .result-icon
|
|
266
|
-
{
|
|
267
|
-
border: var(--border-fail);
|
|
268
|
-
background: var(--surface-fail)
|
|
269
|
-
var(--info-icon);
|
|
270
|
-
background-repeat: no-repeat;
|
|
271
|
-
background-position: center;
|
|
272
|
-
transform: rotate(175deg);
|
|
273
|
-
}
|
|
274
|
-
.test:is(.success,.fail) .result-icon::before
|
|
275
|
-
,.hook:is(.success,.fail) .result-icon::before
|
|
276
|
-
{
|
|
277
|
-
display: none;
|
|
278
|
-
}
|
|
279
|
-
.test:is(.running) .result-icon::before
|
|
280
|
-
,.hook:is(.running) .result-icon::before
|
|
281
|
-
{
|
|
282
|
-
content: '';
|
|
283
|
-
--color: var(--text-process);
|
|
284
|
-
--animation-timing-function: linear;
|
|
285
|
-
--animation-duration: 2s;
|
|
286
|
-
width: var(--icon-size, 18px);
|
|
287
|
-
height: var(--icon-size, 18px);
|
|
288
|
-
mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--icon-size, 18px) / 3), black calc(var(--icon-size, 18px) / 3));
|
|
289
|
-
background-image: conic-gradient(transparent, transparent 135deg, var(--color));
|
|
290
|
-
border-radius: 50%;
|
|
291
|
-
animation: var(--animation-timing-function) var(--animation-duration) infinite spin;
|
|
292
|
-
margin: 2px;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.description
|
|
296
|
-
{
|
|
297
|
-
user-select: none;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.test .result
|
|
301
|
-
,.hook .result
|
|
302
|
-
{
|
|
303
|
-
background: var(--surface-test);
|
|
304
|
-
border: var(--border-test);
|
|
305
|
-
border-radius: 2px;
|
|
306
|
-
margin: var(--small-spacer);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.test .result:empty::before
|
|
310
|
-
,.results:empty::before
|
|
311
|
-
{
|
|
312
|
-
content: "[Test has not been run]";
|
|
313
|
-
font-style: italic;
|
|
314
|
-
font-size: 11px;
|
|
315
|
-
color: var(--text-placeholder);
|
|
316
|
-
}
|
|
317
|
-
.results:empty::before
|
|
318
|
-
{
|
|
319
|
-
content: "[Tests have not been run]";
|
|
320
|
-
}
|
|
321
|
-
.before-result:empty
|
|
322
|
-
,.after-result:empty
|
|
323
|
-
{
|
|
324
|
-
display: none;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.test .result
|
|
328
|
-
,.results
|
|
329
|
-
,.before-result
|
|
330
|
-
,.after-result
|
|
331
|
-
{
|
|
332
|
-
padding: var(--small-spacer) var(--spacer);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
pre
|
|
336
|
-
{
|
|
337
|
-
margin: var(--small-spacer);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.run
|
|
341
|
-
{
|
|
342
|
-
width: auto;
|
|
343
|
-
min-width: auto;
|
|
344
|
-
max-width: auto;
|
|
345
|
-
appearance: none;
|
|
346
|
-
display: inline-flex;
|
|
347
|
-
justify-content: center;
|
|
348
|
-
align-items: center;
|
|
349
|
-
padding: 3px 10px 3px 7px;
|
|
350
|
-
font-size: 11px;
|
|
351
|
-
gap: var(--small-spacer);
|
|
352
|
-
border: var(--border-button);
|
|
353
|
-
background: var(--surface-button);
|
|
354
|
-
border-radius: 4px;
|
|
355
|
-
text-shadow: 1px 1px rgb(0 0 0 / .2);
|
|
356
|
-
color: var(--text-button);
|
|
357
|
-
}
|
|
358
|
-
.run:hover
|
|
359
|
-
{
|
|
360
|
-
background: oklch(68.39% 0.181 258.33);
|
|
361
|
-
}
|
|
362
|
-
.run:active
|
|
363
|
-
{
|
|
364
|
-
background: oklch(50.39% 0.181 258.33);
|
|
365
|
-
}
|
|
366
|
-
.run::before
|
|
367
|
-
{
|
|
368
|
-
content: '';
|
|
369
|
-
display: block;
|
|
370
|
-
width: 16px;
|
|
371
|
-
height: 16px;
|
|
372
|
-
transform: rotate(-90deg);
|
|
373
|
-
background:
|
|
374
|
-
url("data:image/svg+xml,%3Csvg%20viewBox%3D'0%200%2020%2020'%20width%3D'16px'%20height%3D'16px'%20fill%3D'none'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cg%20stroke-width%3D'0'%3E%3C%2Fg%3E%3Cg%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3C%2Fg%3E%3Cg%3E%3Cpath%20d%3D'M8.72798%2015.795L3.72798%207.795C3.10356%206.79593%203.82183%205.5%204.99998%205.5L15%205.5C16.1781%205.5%2016.8964%206.79593%2016.272%207.795L11.272%2015.795C10.6845%2016.735%209.31549%2016.735%208.72798%2015.795Z'%20fill%3D'%23fdfdfd'%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
@media (prefers-color-scheme: dark)
|
|
379
|
-
{
|
|
380
|
-
:host
|
|
381
|
-
{
|
|
382
|
-
--text-surface: var(--uchu-yang);
|
|
383
|
-
--text-result: var(--uchu-yang);
|
|
384
|
-
|
|
385
|
-
--surface-0: var(--uchu-yin);
|
|
386
|
-
--surface-test: oklch(25.11% 0.006 258.36);
|
|
387
|
-
--surface-test-summary: oklch(35.02% 0.005 236.66);
|
|
388
|
-
}
|
|
389
|
-
:host(.running) .run[data-all]
|
|
390
|
-
{
|
|
391
|
-
background-color: oklch(35.02% 0.005 236.66);
|
|
392
|
-
border-color: oklch(35.02% 0.005 236.66);
|
|
393
|
-
}
|
|
394
|
-
:host(.running) .run[data-all]:hover
|
|
395
|
-
{
|
|
396
|
-
background-color: oklch(63.12% 0.004 219.55);
|
|
397
|
-
border-color:oklch(63.12% 0.004 219.55);
|
|
398
|
-
}
|
|
399
|
-
:host(.running) .run[data-all]:active
|
|
400
|
-
{
|
|
401
|
-
background-color: oklch(25.11% 0.006 258.36);
|
|
402
|
-
border-color: oklch(25.11% 0.006 258.36);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
@keyframes spin
|
|
407
|
-
{
|
|
408
|
-
from { transform: rotate(0deg); }
|
|
409
|
-
to { transform: rotate(360deg); }
|
|
410
|
-
}`;var x=`<slot name="header">
|
|
411
|
-
<header id="header">
|
|
412
|
-
<span id="title"><slot name="title"><span id="title-text">Tests</span></slot></span>
|
|
413
|
-
<slot name="play-button">
|
|
414
|
-
<button type="button" class="run" data-all>
|
|
415
|
-
<slot name="play-button-label">
|
|
416
|
-
<span id="play-button-label" class="button-label label icon">Run Tests</span>
|
|
417
|
-
</slot>
|
|
418
|
-
</button>
|
|
419
|
-
</slot>
|
|
420
|
-
<slot name="details"></slot>
|
|
421
|
-
</header>
|
|
422
|
-
</slot>
|
|
423
|
-
<details id="required-before-any-details" class="hook">
|
|
424
|
-
<summary id="required-before-any-summary">
|
|
425
|
-
<span id="required-before-any-result-icon" class="result-icon"></span>
|
|
426
|
-
<span id="required-before-any-description" class="description">Results from Required Before Any Hook</span>
|
|
427
|
-
</summary>
|
|
428
|
-
<div id="required-before-any-results" class="results"></div>
|
|
429
|
-
</details>
|
|
430
|
-
<details id="before-all-details" class="hook">
|
|
431
|
-
<summary id="before-all-summary">
|
|
432
|
-
<span id="before-all-result-icon" class="result-icon"></span>
|
|
433
|
-
<span id="before-all-description" class="description">Results from Before All Hook</span>
|
|
434
|
-
</summary>
|
|
435
|
-
<div id="before-all-results" class="results"></div>
|
|
436
|
-
</details>
|
|
437
|
-
<ul id="tests"></ul>
|
|
438
|
-
<details id="after-all-details" class="hook">
|
|
439
|
-
<summary id="after-all-summary">
|
|
440
|
-
<span id="after-all-result-icon" class="result-icon"></span>
|
|
441
|
-
<span id="after-all-description" class="description">Results from After All Hook</span>
|
|
442
|
-
</summary>
|
|
443
|
-
<div id="after-all-results" class="results"></div>
|
|
444
|
-
</details>
|
|
445
|
-
<details id="required-after-any-details" class="hook">
|
|
446
|
-
<summary id="required-after-any-summary">
|
|
447
|
-
<span id="required-after-any-result-icon" class="result-icon"></span>
|
|
448
|
-
<span id="required-after-any-description" class="description">Results from Required After Any Hook</span>
|
|
449
|
-
</summary>
|
|
450
|
-
<div id="required-after-any-results" class="results"></div>
|
|
451
|
-
</details>
|
|
452
|
-
|
|
453
|
-
<template id="prompt-template">
|
|
454
|
-
<div class="prompt" part="prompt">
|
|
455
|
-
<div class="prompt-display">
|
|
456
|
-
<span class="icon prompt-icon"></span>
|
|
457
|
-
<span class="label prompt-label"></span>
|
|
458
|
-
</div>
|
|
459
|
-
<div class="prompt-actions">
|
|
460
|
-
<button class="prompt-button accept" type="button">Accept</button>
|
|
461
|
-
<button class="prompt-button reject" type="button">Reject</button>
|
|
462
|
-
</div>
|
|
463
|
-
</div>
|
|
464
|
-
</template>`;var y=class extends Promise{async toBeDefined(e){if(await this==null)throw new Error(`${e??"Value"} is undefined`)}async toBe(e,r=!1){let t=await this;if((r==!0?t===e:t==e)==!1)throw new Error(` Value is not equal.
|
|
465
|
-
Expected: ${e}
|
|
466
|
-
Result: ${t}`)}async toContainText(e){let r=await this}async toHaveAttribute(e){let r=await this;if(!(r instanceof HTMLElement))throw new Error("Unable to check for attribute on non-HTMLElement target");if(r.getAttribute(e))throw new Error("Taret does not have attribute")}},E=class f{static timeoutMS=500;static#e;static#r;static expect(e){return new y(async(t,s)=>{if(e instanceof Promise){let n=await e;t(n);return}t(e)})}static expectSync(e){return new y(async(t,s)=>{if(e instanceof Promise){let n=await e;t(n);return}t(e)})}static expectBefore(e){return new y(async(t,s)=>{if(e instanceof Promise){let n=await e;t(n);return}t(e)})}static async prompt(e,r,t,s){return new Promise((n,l)=>{let i=e.findElement("prompt-template"),o=f.createElementFromTemplate(i);o.querySelector(".label").textContent=t;let a=u=>{let c=u.composedPath();if(c.find(h=>h instanceof HTMLButtonElement&&h.classList.contains("accept"))!=null){let h=s?.onAccept?.()??!0;o.removeEventListener("click",a),n(h);return}if(c.find(h=>h instanceof HTMLButtonElement&&h.classList.contains("reject"))!=null){let h=s?.onReject?.()??!1;o.removeEventListener("click",a),n(h);return}};o.addEventListener("click",a),s?.acceptLabel!=null&&(o.querySelector(".accept").textContent=s.acceptLabel),s?.rejectLabel!=null&&(o.querySelector(".reject").textContent=s.rejectLabel);let p=r instanceof HTMLDetailsElement?r:r.querySelector(".test-details");p!=null&&(p.open=!0),r.querySelector(".result")?.append(o)})}static createElementFromTemplate(e,r){let t=e instanceof HTMLTemplateElement?e:document.querySelector(e);if(t==null)throw new Error(`Unable to find template element from selector: ${e}`);let s=t.content.cloneNode(!0).querySelector("*");if(s==null)throw new Error("Unable to find first child of template element");return r?.append(s),s}};function S(f){return E.expect(f)}function $(f,e,r,t){return E.prompt(f,e,r,t)}var A=":not(slot,defs,g,rect,path,circle,ellipse,line,polygon,text,tspan,use,svg image,svg title,desc,template,template *)";function L(f){let e=[...f.querySelectorAll(`${A}[id]`)];for(let t=0;t<e.length;t++)e[t].part.add(e[t].id);let r=[...f.querySelectorAll(`${A}[class]`)];for(let t=0;t<r.length;t++)r[t].part.add(...r[t].classList)}var P=(l=>(l.BeforeAll="beforeall",l.AfterAll="afterall",l.BeforeEach="beforeeach",l.AfterEach="aftereach",l.RequiredBeforeAny="requiredbeforeany",l.RequiredAfterAny="requiredafterany",l))(P||{}),F=(n=>(n.BeforeAll="beforeall",n.AfterAll="afterall",n.BeforeTest="beforetest",n.AfterTest="aftertest",n.Cancel="cancel",n))(F||{}),v=Symbol("No Test Defined"),H=new CSSStyleSheet;H.replaceSync(w);var C="code-tests",k=class extends HTMLElement{componentParts=new Map;getElement(e){if(this.componentParts.get(e)==null){let r=this.findElement(e);r!=null&&this.componentParts.set(e,r)}return this.componentParts.get(e)}findElement(e){return this.shadowRoot.getElementById(e)}#e={};#r=!0;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=x,this.shadowRoot.adoptedStyleSheets.push(H),this.#c=this.#h.bind(this)}connectedCallback(){if(L(this.shadowRoot),this.addEventListener("click",this.#c),this.getAttribute("auto")=="false")return;let e=this.#d();e!=null&&this.loadTests(e)}disconnectedCallback(){this.removeEventListener("click",this.#c)}#c;#h(e){let r=e.composedPath().find(l=>l instanceof HTMLButtonElement&&l.classList.contains("run"));if(r==null)return;let t=r.closest("li");if(t==null){if(r.hasAttribute("data-all")==!0)if(this.classList.contains("running")){if(this.classList.contains("canceled"))return;this.cancel()}else this.runTests();return}let s=t.dataset.testId;if(s==null)return;let n=this.#s.get(s);n!=null&&(this.isCanceled=!1,this.classList.remove("canceled"),this.part.remove("canceled"),this.#u(s,n))}#d(){return this.getAttribute("src")??this.getAttribute("test")??this.getAttribute("tests")??this.getAttribute("run")??this.getAttribute("path")}async loadTests(e){let r=e??this.#d();if(r!=null)try{this.getElement("tests").innerHTML="",this.#s.clear(),this.classList.remove("has-before-hook"),this.classList.remove("has-after-hook");let t=window.location.href.lastIndexOf("/"),n=window.location.href.substring(t).indexOf(".")!=-1==!0?window.location.href.substring(0,t+1):window.location.href,l=n+r.substring(0,r.lastIndexOf("/")+1),i=n+r,o=await(await fetch(i)).text();o=o.replaceAll(/['"`](((\.\/)|(\.\.\/))+(.*))['"`]/g,`'${l}$1'`);let a=new File([o],r.substring(r.lastIndexOf("/")),{type:"text/javascript"}),u=await import(URL.createObjectURL(a)),c=u.tests??u.default;if(c==null)throw new Error(`Unable to find tests definition in file at path: ${r}`);let g=c.beforeall;g!=null&&(this.#e.beforeall=g,delete c.beforeall,this.classList.add("has-before-hook"));let b=c.afterall;b!=null&&(this.#e.afterall=b,delete c.afterall,this.classList.add("has-after-hook"));let h=c.beforeeach;h!=null&&(this.#e.beforeeach=h,delete c.beforeeach);let m=c.aftereach;m!=null&&(this.#e.aftereach=m,delete c.aftereach);let d=c.requiredbeforeany;d!=null&&(this.#e.requiredbeforeany=d,delete c.requiredbeforeany,this.classList.add("has-required-before-hook"),this.part.add("has-required-before-hook"));let T=c.requiredafterany;T!=null&&(this.#e.requiredafterany=T,delete c.requiredafterany,this.classList.add("has-required-after-hook"),this.part.add("has-required-after-hook"));for(let[q,R]of Object.entries(c))this.#m(q,R)}catch(t){this.#i("An error occurred while loading the tasks:",t)}}isCanceled=!1;cancel(){this.isCanceled=!0,this.classList.add("canceled"),this.part.add("canceled"),this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}async runTests(){this.dispatchEvent(new CustomEvent("beforeall",{bubbles:!0,composed:!0})),this.#r=!0,this.classList.add("running"),this.isCanceled=!1,this.classList.remove("canceled"),this.part.remove("canceled"),this.toggleAttribute("success",!1);let e=this.findElement("play-button-label");e!=null&&(e.textContent="Cancel"),this.#f();let r=this.hasAttribute("in-order"),t=this.#e.requiredbeforeany;if(t!=null){let o;try{let a=this.getElement("required-before-any-details");if(a.classList.add("running"),a.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");o=await t(this,a),this.#t(o,!0,"before",!0),a.part.remove("running"),a.classList.remove("running")}catch(a){this.#t(o,!1,"before",!0,a),console.error(a),this.#r=!1,this.classList.remove("running"),this.part.remove("running"),e!=null&&(e.textContent="Run Tests"),this.dispatchEvent(new CustomEvent("afterall",{bubbles:!0,composed:!0}));return}}let s=this.#e.beforeall;if(s!=null){let o;try{let a=this.getElement("before-all-details");if(a.classList.add("running"),a.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");o=await s(this,a),this.#t(o,!0,"before",!1),a.part.remove("running"),a.classList.remove("running")}catch(a){this.#t(o,!1,"before",!1,a),console.error(a),this.#r=!1,this.classList.remove("running"),this.part.remove("running"),e!=null&&(e.textContent="Run Tests"),this.dispatchEvent(new CustomEvent("afterall",{bubbles:!0,composed:!0}));return}}if(r==!1){let o=[];for(let[a,p]of this.#s)o.push(this.#u(a,p));await Promise.all(o)}else for(let[o,a]of this.#s){if(this.#r==!1)break;await this.#u(o,a,!1)}if(this.#r==!1){this.classList.remove("running"),this.part.remove("running"),e!=null&&(e.textContent="Run Tests"),this.dispatchEvent(new CustomEvent("afterall",{bubbles:!0,composed:!0}));return}let n=this.#e.afterall;if(n!=null){let o;try{let a=this.getElement("after-all-details");if(a.classList.add("running"),a.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");o=await n(this,a),this.#t(o,!0,"after",!1),a.part.remove("running"),a.classList.remove("running")}catch(a){this.#t(o,!1,"after",!1,a),console.error(a);let p=this.#e.requiredafterany;if(p!=null){let u;try{let c=this.getElement("required-after-any-details");if(c.classList.add("running"),c.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");u=await p(this,c),this.#t(u,!0,"after",!0),c.part.remove("running"),c.classList.remove("running")}catch(c){this.#t(u,!1,"after",!0,c),console.error(c)}}this.#r=!1,this.classList.remove("running"),this.part.remove("running"),e!=null&&(e.textContent="Run Tests"),this.dispatchEvent(new CustomEvent("afterall",{bubbles:!0,composed:!0}));return}}let l=this.#e.requiredafterany;if(l!=null){let o;try{let a=this.getElement("required-after-any-details");if(a.classList.add("running"),a.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");o=await l(this,a),this.#t(o,!0,"after",!0),a.part.remove("running"),a.classList.remove("running")}catch(a){this.#t(o,!1,"after",!0,a),console.error(a),this.#r=!1}}let i=this.shadowRoot.querySelectorAll('[success="false"]');this.setAttribute("success",i.length==0?"true":"false"),this.classList.remove("running"),this.part.remove("running"),e!=null&&(e.textContent="Run Tests"),this.dispatchEvent(new CustomEvent("afterall",{bubbles:!0,composed:!0}))}#f(){for(let[t,s]of this.#s){let n=this.getElement("tests").querySelector(`[data-test-id="${t}"]`);if(n==null){this.#i(`Unable to find test element for test: ${t}`);return}n.toggleAttribute("success",!1),n.classList.remove("success","fail"),n.part.remove("success","fail")}let e=this.getElement("before-all-details");e.toggleAttribute("success",!1),e.classList.remove("success","fail"),e.part.remove("success","fail");let r=this.getElement("after-all-details");r.toggleAttribute("success",!1),r.classList.remove("success","fail"),r.part.remove("success","fail")}async#u(e,r,t=!0){let s=this.getElement("tests").querySelector(`[data-test-id="${e}"]`);if(s==null){this.#i(`Unable to find test element for test: ${e}`);return}s.toggleAttribute("success",!1),s.classList.add("running"),s.part.add("running"),s.classList.remove("success","fail"),s.part.remove("success","fail");let n=s.querySelector(".result-icon");n?.classList.remove("success","fail"),n?.part.remove("success","fail"),n?.classList.add("running"),n?.part.add("running");let l=s.querySelector(".error-message");l!=null&&(l.textContent="");let i=s.querySelector("details");i!=null&&(i.open=!1);let o=v,a,p=v,u;try{let c=this.dispatchEvent(new CustomEvent("beforetest",{bubbles:!0,cancelable:!0,composed:!0,detail:{testElement:s}}));if(t==!0){let h=this.#e.requiredbeforeany;if(h!=null){let m;try{let d=this.getElement("required-before-any-details");if(d.classList.add("running"),d.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");m=await h(this,d),this.#t(m,!0,"before",!0),d.part.remove("running"),d.classList.remove("running")}catch(d){this.#t(m,!0,"before",!0,d),console.error(d),this.#r=!1;return}}}if(this.#r==!1)throw new Error("Tests have been disabled from continuing to run.");if(c==!1||this.isCanceled==!0)throw new Error("Test has been cancelled");let g=this.#e.beforeeach;if(g!=null&&(o=await g(this,s)),this.isCanceled==!0)throw new Error("Test has been cancelled");if(a=await r(this,s),this.isCanceled==!0)throw new Error("Test has been cancelled");let b=this.#e.aftereach;if(b!=null&&(p=await b(this,s)),t==!0){let h=this.#e.requiredafterany;if(h!=null){let m;try{let d=this.getElement("required-before-any-details");if(d.classList.add("running"),d.part.add("running"),this.isCanceled==!0)throw new Error("Test has been cancelled");m=await h(this,d),this.#t(m,!0,"after",!0),d.part.remove("running"),d.classList.remove("running")}catch(d){this.#t(m,!0,"after",!0,d),console.error(d),this.#r=!1;return}}}u="before",o!=v&&this.#a(s,o,!0,void 0,u),u=void 0,this.#a(s,a,!0,void 0,u),u="after",p!=v&&this.#a(s,p,!0,void 0,u)}catch(c){this.#a(s,a,!1,c,u),console.error(c),this.#r=!1}finally{s?.classList.remove("running"),s?.part.remove("running"),n?.classList.remove("running"),n?.part.remove("running"),this.dispatchEvent(new CustomEvent("aftertest",{bubbles:!0,cancelable:!0,composed:!0,detail:{testElement:s}}))}}#a(e,r,t,s,n){if(r instanceof HTMLElement)this.#o(e,r,t,n);else if(r==null){let i=n==null?"Passed":"Hook Ran Successfully",o=this.#n(t==!0?`${i}`:`Failed${s!=null?`:
|
|
467
|
-
${s.message}`:""}`,t,n);this.#o(e,o,t,n)}else if(typeof r=="string"){let i=this.#n(`${r}${s==null?"":`:
|
|
468
|
-
${s.message}`}`,t,n);this.#o(e,i,t,n)}else if(typeof r=="object"){let i=r;if(i.success!=null&&i.expected!=null&&i.value!=null){let o=n==null?"Passed":"Success",a=n==null?"Failed":"Fail",p=this.#n(`${i.success==!0?`${o}:`:`${a}:`}
|
|
469
|
-
Expected:${i.expected}
|
|
470
|
-
Result:${i.value}`,i.success,n);this.#o(e,p,t,n)}}let l=e.querySelector("details");l!=null&&(l.open=!0)}#t(e,r,t,s,n){if(e instanceof HTMLElement)this.#l(e,r,t,s);else{let i;if(e==null)i=this.#n(r==!0?"Hook Ran Successfully":`Failed${n!=null?`:
|
|
471
|
-
${n.message}`:""}`,r),this.#l(i,r,t,s);else if(typeof e=="string")i=this.#n(`${e}${n==null?"":`:
|
|
472
|
-
${n.message}`}`,r),this.#l(i,r,t,s);else if(typeof e=="object"){let o=e;o.success!=null&&o.expected!=null&&o.value!=null&&(i=this.#n(`${o.success==!0?"Success:":"Fail:"}
|
|
473
|
-
Expected:${o.expected}
|
|
474
|
-
Result:${o.value}`,o.success),this.#l(i,r,t,s))}}let l=this.getElement(`${t}-all-details`);l!=null&&(l.open=!0)}static create(e){return document.createElement("code-tests")}#s=new Map;#m(e,r){let t=D();this.#s.set(t,r);let s=this.#g(t,e);return this.getElement("tests").append(s),t}#g(e,r){let t=document.createElement("li");t.dataset.testId=e,t.classList.add("test"),t.part.add("test");let s=document.createElement("details");s.classList.add("test-details"),s.part.add("test-details");let n=document.createElement("summary");n.classList.add("test-summary"),n.part.add("test-summary");let l=document.createElement("div");l.classList.add("result-icon"),l.part.add("result-icon"),n.append(l);let i=document.createElement("span");i.classList.add("description","test-description"),i.textContent=r,n.append(i);let o=document.createElement("button");o.classList.add("run","test-run"),o.part.add("run","test-run"),o.textContent="Run Test",o.title="Run Test",n.append(o);let a=document.createElement("div");a.classList.add("before-result","test-before-result"),a.part.add("before-result","test-before-result");let p=document.createElement("div");p.classList.add("result","test-result"),p.part.add("result","test-result");let u=document.createElement("div");return u.classList.add("after-result","test-after-result"),u.part.add("after-result","test-after-result"),s.append(n),s.append(a),s.append(p),s.append(u),t.append(s),t}#o(e,r,t,s){e.setAttribute("success",t==!0?"true":"false"),e.classList.toggle("success",t),e.part.toggle("success",t),e.classList.toggle("fail",!t),e.part.toggle("fail",!t);let n=e.querySelector(".result-icon");n?.classList.toggle("success",t),n?.part.toggle("success",t),n?.classList.toggle("fail",!t),n?.part.toggle("fail",!t);let l=e.querySelector(`.${s==null?"result":s=="before"?"before-result":"after-result"}`);if(l==null){this.#i("Unable to find result element");return}l.innerHTML="",l.appendChild(r)}#n(e,r,t){let s=document.createElement("code");s.classList.add("code"),s.part.add("code");let n=document.createElement("pre");n.textContent=e;let l=r==!0?"success-message":"error-message";return n.classList.add("pre",l),n.part.add("pre",l),s.appendChild(n),s}#l(e,r,t,s){let n=s==!0?`required-${t}-any`:`${t}-all`,l=this.getElement(`${n}-details`),i=this.getElement(`${n}-results`);l.setAttribute("success",r==!0?"true":"false"),l.classList.toggle("success",r),l.part.toggle("success",r),l.classList.toggle("fail",!r),l.part.toggle("fail",!r),i.innerHTML="",i.appendChild(e)}#i(e,r){r instanceof Error&&(e+=`
|
|
475
|
-
${r.message}`,console.error(r));let t=document.createElement("li");t.classList.add("error","process-error"),t.part.add("error","process-error");let s=document.createElement("code");s.classList.add("code","process-error-code"),s.part.add("code","process-error-code");let n=document.createElement("pre");n.classList.add("pre","process-error-pre"),n.part.add("pre","process-error-pre"),n.textContent=e,s.append(n),t.append(s),this.getElement("tests").append(t)}#p(e){if(e=="ordered"){let r=this.shadowRoot.querySelector("ul");if(r==null)return;let t=this.shadowRoot?.querySelectorAll("li"),s=document.createElement("ol");t!=null&&s.append(...t),s.id="tests",r.replaceWith(s)}else{let r=this.shadowRoot.querySelector("ol");if(r==null)return;let t=this.shadowRoot?.querySelectorAll("li"),s=document.createElement("ul");s.id="tests",t!=null&&s.append(...t),r.replaceWith(s)}}static observedAttributes=["in-order"];attributeChangedCallback(e,r,t){e=="in-order"&&(t==null?this.#p("unordered"):this.#p("ordered"))}};function D(){let f=new Uint8Array(20);crypto.getRandomValues(f);let e=[].slice.apply(f).map(function(t){return String.fromCharCode(t)}).join("");return btoa(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}customElements.get(C)==null&&customElements.define(C,k);export{F as CodeTestEventType,E as CodeTests,k as CodeTestsElement,P as HookType,S as expect,$ as prompt};
|
|
1
|
+
const t={BeforeAll:"beforeall",AfterAll:"afterall",BeforeTest:"beforetest",AfterTest:"aftertest",BeforeHook:"beforehook",AfterHook:"afterhook",Cancel:"cancel",Context:"context",Reset:"reset"},e="code-test";class s extends HTMLElement{state={testId:"",description:"none",isDisabled:!1,testState:void 0,beforeEachState:void 0,afterEachState:void 0};setState(t){this.state=t,this.#t()}setStateProperties(t){this.setState({...this.state,...t})}setTestStateProperties(t,e){null!=this.state[t]&&this.setState({...this.state,[t]:{...this.state[t],...e}})}findElement(t){return this.querySelector(t)}findElements(t){return Array.from(this.querySelectorAll(t))}isRunning(){return 1==this.state.testState?.isRunning||1==this.state.beforeEachState?.isRunning||1==this.state.afterEachState?.isRunning}hasRun(){return 1==this.state.testState?.hasRun||1==this.state.beforeEachState?.hasRun||1==this.state.afterEachState?.hasRun}resultCategory(){const t=this.state.testState?.resultCategory??"none",e=this.state.beforeEachState?.resultCategory??"none",s=this.state.afterEachState?.resultCategory??"none";return"none"==t&&"none"==e&&"none"==s?"none":null==this.state.beforeEachState&&null==this.state.afterEachState?t:null!=this.state.beforeEachState&&null==this.state.afterEachState?"fail"==t||"fail"==e?"fail":"success"==t&&"success"==e?"success":"none":null==this.state.beforeEachState&&null!=this.state.afterEachState?"fail"==t||"fail"==s?"fail":"success"==t&&"success"==s?"success":"none":null!=this.state.beforeEachState&&null!=this.state.afterEachState?"fail"==t||"fail"==e||"fail"==s?"fail":"success"==t&&"success"==e&&"success"==s?"success":"none":void 0}connectedCallback(){this.#t()}#t(){const t=null==this.state.testState?"":"boolean"==typeof this.state.testState.resultContent?1==this.state.testState.resultContent?'<code class="code" part="code"><pre class="pre success-message" part="pre success-message">Passed</pre></code>':'<code class="code" part="code"><pre class="pre error-message" part="pre error-message">Failed</pre></code>':"number"==typeof this.state.testState.resultContent?`<code class="code" part="code"><pre class="pre success-message" part="pre success-message">Passed: ${this.state.testState.resultContent.toString()}</pre></code>`:"string"==typeof this.state.testState.resultContent?this.state.testState.resultContent:"";this.innerHTML=`<details class="test-details" part="test-details" ${1==this.isRunning()||1==this.hasRun()?" open":""}>\n <summary class="test-summary" part="test-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <div class="result-icon test-result-icon${"none"!=this.state.testState?.resultCategory?` ${this.state.testState?.resultCategory}`:""}" part="result-icon"></div>\n <span class="test-description description">${this.state.description}</span>\n ${null!=this.state.testState?.duration&&this.state.testState.duration>0?`<span class="test-duration duration">\n <span class="test-duration-value">${this.state.testState.duration>10?this.state.testState.duration.toFixed(0):this.state.testState.duration.toFixed(2)}</span>\n <span class="test-duration-unit">ms</span>\n </span>`:""}\n <button type="button" class="run-test-button" part="run-test-button" title="Run Test"${1==this.state.isDisabled?" disabled":""}>\n <slot name="run-button-content">\n <slot name="run-button-icon"><svg class="icon arrow-icon run-button-icon"><use href="#icon-definition_arrow"></use></svg></slot>\n <slot name="run-button-label"><span class="run-button-label button-label label icon">Run Test</span></slot>\n </slot>\n </button>\n </summary>\n <div class="results" part="results">\n ${null==this.state.beforeEachState?"":`<details class="before-each-details hook${"none"==this.state.beforeEachState.resultCategory?"":` ${this.state.beforeEachState.resultCategory}`}${1==this.state.beforeEachState.isRunning?" running":""}" part="before-each-details hook">\n <summary class="before-each-summary" part="before-each-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <div class="before-each-result-icon result-icon${"none"!=this.state.beforeEachState.resultCategory?` ${this.state.beforeEachState.resultCategory}`:""}" part="before-each-result-icon"></div>\n <span class="before-each-description description hook-name">Before Each Hook</span>\n </summary>\n <div class="before-each-result result message" part="before-each-result result message">${"string"!=typeof this.state.beforeEachState.resultContent?"":this.state.beforeEachState.resultContent}</div>\n </details>`}\n ${null==this.state.testState?"":null==this.state.beforeEachState&&null==this.state.afterEachState?`<div class="test-result result message" part="test-result result message">${t}</div>`:`<details class="processing-details${"none"==this.state.testState.resultCategory?"":` ${this.state.testState.resultCategory}`}${1==this.state.testState.isRunning?" running":""}" part="processing-details"${1==this.state.testState.hasRun?" open":""}>\n <summary class="processing-summary" part="processing-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <div class="processing-result-icon result-icon${"none"!=this.state.testState.resultCategory?` ${this.state.testState.resultCategory}`:""}" part="processing-result-icon result-icon"></div>\n <span class="processing-description description">Test</span>\n </summary>\n <div class="test-result result message" part="test-result result message">${t}</div>\n </details>`} \n ${null==this.state.afterEachState?"":`<details class="after-each-details hook${"none"==this.state.afterEachState.resultCategory?"":` ${this.state.afterEachState.resultCategory}`}${1==this.state.afterEachState.isRunning?" running":""}" part="after-each-detail hooks">\n <summary class="after-each-summary" part="after-each-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <div class="after-each-result-icon result-icon${"none"!=this.state.afterEachState.resultCategory?` ${this.state.afterEachState.resultCategory}`:""}" part="before-each-result-icon"></div>\n <span class="after-each-description description hook-name">After Each Hook</span>\n </summary>\n <div class="after-each-result result message" part="after-each-result result message">${"string"!=typeof this.state.afterEachState.resultContent?"":this.state.afterEachState.resultContent}</div>\n </details>`}\n </div>\n </details>`,this.dataset.testId=this.state.testId,this.classList.add("test"),this.part.add("test"),this.toggleAttribute("success","success"==this.resultCategory()),this.classList.toggle("success","success"==this.resultCategory()),this.part.toggle("success","success"==this.resultCategory()),this.classList.toggle("fail","fail"==this.resultCategory()),this.part.toggle("fail","fail"==this.resultCategory()),this.classList.toggle("running",this.isRunning()),this.part.toggle("running",this.isRunning()),this.state.beforeEachState?.resultContent instanceof HTMLElement&&this.querySelector(".before-each-result").append(this.state.beforeEachState.resultContent),this.state.testState?.resultContent instanceof HTMLElement&&this.querySelector(".test-result").append(this.state.testState.resultContent),this.state.afterEachState?.resultContent instanceof HTMLElement&&this.querySelector(".after-each-result").append(this.state.afterEachState.resultContent)}enable(){this.state.isDisabled=!1,this.findElement(".run-test-button").toggleAttribute("disabled",!1)}disable(){this.state.isDisabled=!0,this.findElement(".run-test-button").toggleAttribute("disabled",!0)}async runTest(e,s){if(null==this.state.testState?.test)return;let n;this.reset();let a={},r=0;try{if(0==e.shouldContinueRunningTests)throw new Error("Tests have been disabled from continuing to run.");if(0==this.dispatchEvent(new CustomEvent(t.BeforeTest,{bubbles:!0,cancelable:!0,composed:!0,detail:{testElement:this}})))throw new Error("Test has been prevented.");if(1==s.codeTestsElement.state.isCanceled)throw new Error("Testing has been canceled.");this.setTestStateProperties("testState",{isRunning:!0}),e.codeTestsElement.setState(e.codeTestsElement.state);const o=performance?.now()??Date.now();n=await this.state.testState.test(s);r=(performance?.now()??Date.now())-o,this.setTestStateProperties("testState",{isRunning:!1,hasRun:!0}),e.codeTestsElement.setState(e.codeTestsElement.state);const i=e.parseTestResult(n,!0);a={testState:{test:this.state.testState.test,resultContent:i.result,resultCategory:i.resultCategory,hasRun:this.state.testState.hasRun,isRunning:!1,duration:r}}}catch(t){const s=e.parseTestResult(n,!1,t);a={testState:{test:this.state.testState.test,resultContent:s.result,resultCategory:s.resultCategory,hasRun:this.state.testState.hasRun,isRunning:!1,duration:r}},console.error(t),e.shouldContinueRunningTests=!1}finally{this.setStateProperties({...a}),e.codeTestsElement.setState(e.codeTestsElement.state),this.dispatchEvent(new CustomEvent(t.AfterTest,{bubbles:!0,cancelable:!0,composed:!0,detail:{testElement:this}}))}}reset(){const t=null!=this.state.testState?{resultCategory:"none",resultContent:"",test:this.state.testState.test,hasRun:this.state.testState.hasRun,isRunning:this.state.testState.isRunning,duration:0}:void 0;null!=t&&this.setTestStateProperties("testState",t)}getMessageElement(){return this.findElement(".test-result")}static observedAttributes=["open"];attributeChangedCallback(t,e,s){"open"==t&&this.findElement(".test-details").toggleAttribute("open",null!=s)}}null==customElements.get(e)&&customElements.define(e,s);const n=Symbol("No Test Defined");class a{codeTestsElement;constructor(t){this.codeTestsElement=t}async loadTests(t){if(null!=t)try{const{tests:e,hooks:s}=await this.#e(t),n=s[l.BeforeAll],a=s[l.AfterAll],r=s[l.BeforeEach],o=s[l.AfterEach],i=s[l.RequiredBeforeAny],c=s[l.RequiredAfterAny],u=null==n?void 0:{resultCategory:"none",resultContent:"",test:n,hasRun:!1,isRunning:!1,duration:0},d=null==a?void 0:{resultCategory:"none",resultContent:"",test:a,hasRun:!1,isRunning:!1,duration:0},h=null==r?void 0:{resultCategory:"none",resultContent:"",test:r,hasRun:!1,isRunning:!1,duration:0},f=null==o?void 0:{resultCategory:"none",resultContent:"",test:o,hasRun:!1,isRunning:!1,duration:0},p=null==i?void 0:{resultCategory:"none",resultContent:"",test:i,hasRun:!1,isRunning:!1,duration:0},g=null==c?void 0:{resultCategory:"none",resultContent:"",test:c,hasRun:!1,isRunning:!1,duration:0};this.codeTestsElement.state.beforeEachState=h,this.codeTestsElement.state.afterEachState=f;for(const[t,s]of Object.entries(e))this.#s(t,s);this.codeTestsElement.setStateProperties({beforeAllState:u,afterAllState:d,beforeEachState:h,afterEachState:f,requiredBeforeAnyState:p,requiredAfterAnyState:g,resetHook:s.reset,contextHook:s.context})}catch(t){console.error(t)}}async#e(t){const e=await this.#n(t),s=e.tests??e.default;if(null==s)throw new Error(`Unable to find tests definition in file at path: ${t}`);const n={},a=s[l.BeforeAll];null!=a&&(n[l.BeforeAll]=a,delete s[l.BeforeAll]);const r=s[l.AfterAll];null!=r&&(n[l.AfterAll]=r,delete s[l.AfterAll]);const o=s[l.BeforeEach];null!=o&&(n[l.BeforeEach]=o,delete s[l.BeforeEach]);const i=s[l.AfterEach];null!=i&&(n[l.AfterEach]=i,delete s[l.AfterEach]);const c=s[l.RequiredBeforeAny];null!=c&&(n[l.RequiredBeforeAny]=c,delete s[l.RequiredBeforeAny]);const u=s[l.RequiredAfterAny];null!=u&&(n[l.RequiredAfterAny]=u,delete s[l.RequiredAfterAny]);const d=s[l.Reset];null!=d&&(n[l.Reset]=d,delete s[l.Reset]);const h=s[l.Context];return null!=h&&(n[l.Context]=h,delete s[l.Context]),{tests:s,hooks:n}}async#n(t){const e=window.location.href.lastIndexOf("/"),s=1==(-1!=window.location.href.substring(e).indexOf("."))?window.location.href.substring(0,e+1):window.location.href,n=s+t.substring(0,t.lastIndexOf("/")+1),a=s+t;let r=await(await fetch(a)).text();r=r.replaceAll(/['"`](((\.\/)|(\.\.\/))+(.*))['"`]/g,`'${n}$1'`);const o=new File([r],t.substring(t.lastIndexOf("/")),{type:"text/javascript"}),i=URL.createObjectURL(o);return await import(i)}#s(t,e){const n=function(){const t=new Uint8Array(20);crypto.getRandomValues(t);const e=[].slice.apply(t).map(function(t){return String.fromCharCode(t)}).join("");return btoa(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}(),a=new s;return a.setStateProperties({testId:n,description:t,testState:{test:e,resultCategory:"none",resultContent:"",isRunning:!1,hasRun:!1,duration:0},beforeEachState:null==this.codeTestsElement.state.beforeEachState?void 0:{isRunning:this.codeTestsElement.state.beforeEachState.isRunning,hasRun:this.codeTestsElement.state.beforeEachState.hasRun,resultCategory:this.codeTestsElement.state.beforeEachState.resultCategory,resultContent:this.codeTestsElement.state.beforeEachState.resultContent,duration:0},afterEachState:null==this.codeTestsElement.state.afterEachState?void 0:{isRunning:this.codeTestsElement.state.afterEachState.isRunning,hasRun:this.codeTestsElement.state.afterEachState.hasRun,resultCategory:this.codeTestsElement.state.afterEachState.resultCategory,resultContent:this.codeTestsElement.state.afterEachState.resultContent,duration:0}}),this.codeTestsElement.findElement("#tests").append(a),n}shouldContinueRunningTests=!0;async runTests(e){if(0==this.codeTestsElement.dispatchEvent(new CustomEvent(t.BeforeAll,{bubbles:!0,composed:!0,cancelable:!0})))throw new Error("Tests have been prevented.");await this.codeTestsElement.reset();for(let t=0;t<e.length;t++)e[t].disable();const s=await this.createTestContext();if(await this.runHook("requiredBeforeAnyState",void 0,s),0==this.shouldContinueRunningTests)return void await this.#a(e,s);if(await this.runHook("beforeAllState",void 0,s),0==this.shouldContinueRunningTests)return void await this.#a(e,s);if(0==("false"!=this.codeTestsElement.getAttribute("ordered"))){const t=e.map(t=>this.runTest(t,!0,s));await Promise.all(t)}else for(let t=0;t<e.length;t++){const n=e[t];if(0==this.shouldContinueRunningTests)break;await this.runTest(n,!0,s)}0!=this.shouldContinueRunningTests?(await this.runHook("afterAllState",void 0,s),await this.#a(e,s)):await this.#a(e,s)}async#a(e,s){await this.runHook("requiredAfterAnyState",void 0,s);for(let t=0;t<e.length;t++)e[t].enable();this.codeTestsElement.dispatchEvent(new CustomEvent(t.AfterAll,{bubbles:!0,composed:!0}))}async runTest(t,e,s){if(null!=t){if(0==e){const t=this.codeTestsElement.findElements("code-test");for(let e=0;e<t.length;e++)t[e].disable()}s=s??await this.createTestContext(t),0!=e||(await this.runHook("requiredBeforeAnyState",void 0,s),0!=this.shouldContinueRunningTests)?(await this.runHook("beforeEachState",t,s),0!=this.shouldContinueRunningTests?(await t.runTest(this,s),0!=this.shouldContinueRunningTests?(await this.runHook("afterEachState",t,s),await this.#r(s,e)):await this.#r(s,e)):await this.#r(s,e)):await this.#r(s,e)}}async#r(t,e){if(1==e)return;await this.runHook("requiredAfterAnyState",void 0,t);const s=this.codeTestsElement.findElements("code-test");for(let t=0;t<s.length;t++)s[t].enable()}async runHook(e,s,a){const r=this.codeTestsElement.state[e];if(null==r)return n;if(1==this.codeTestsElement.state.isCanceled)return{success:!1,value:"Testing has been canceled."};let o;try{if(0==this.shouldContinueRunningTests&&("requiredAfterAnyState"!=e||"error"==this.codeTestsElement.getAttribute("required-after")))throw new Error("Tests have been disabled from continuing to run.");null!=s&&s.setTestStateProperties(e,{isRunning:!0}),this.codeTestsElement.setTestStateProperties(e,{isRunning:!0}),o=await r.test(a),null!=s&&s.setTestStateProperties(e,{isRunning:!1,hasRun:!0}),this.codeTestsElement.setTestStateProperties(e,{isRunning:!1,hasRun:!0});const t=this.parseTestResult(o,!0,void 0);null!=s&&s.setTestStateProperties(e,{resultCategory:t.resultCategory,resultContent:t.result}),this.codeTestsElement.setTestStateProperties(e,{resultCategory:t.resultCategory,resultContent:t.result})}catch(t){console.error(t),this.shouldContinueRunningTests=!1,o={success:!1,value:`Failed: ${t.message}`};const n=this.parseTestResult(o,!1,t);null!=s&&s.setTestStateProperties(e,{isRunning:!1,hasRun:!0,resultContent:n.result,resultCategory:n.resultCategory}),this.codeTestsElement.setTestStateProperties(e,{isRunning:!1,hasRun:!0,resultCategory:n.resultCategory,resultContent:n.result})}finally{return this.codeTestsElement.dispatchEvent(new CustomEvent(t.AfterHook,{bubbles:!0,composed:!0,detail:o})),o}}parseTestResult(t,e,s){if(t==n)return{result:"",resultCategory:"none"};if(null==t){const t=1==e?"success-message":"error-message";return{result:`<code class="code" part="code">\n <pre class="pre ${t}" part="pre ${t}">${1==e?"Passed":"Failed"+(null!=s?`:\n${s.message}`:"")}</pre>\n </code>`,resultCategory:1==e?"success":"fail"}}if("boolean"==typeof t)return{result:t,resultCategory:1==t?"success":"fail"};if("function"==typeof t)return console.log("function"),{result:"[A function was returned]",resultCategory:"none"};if(t instanceof HTMLElement||"string"==typeof t)return{result:t,resultCategory:"none"};if("object"==typeof t){const s=t,n=1==e?"success-message":"error-message";if(null!=s.success&&null!=s.expected&&null!=s.value)return{result:`<code class="code" part="code">\n <pre class="pre ${n}" part="pre ${n}">${1==s.success?"Passed":"Failed"}\nExpected:${s.expected}\nResult:${s.value}</pre>\n </code>`,resultCategory:1==s.success?"success":"fail"};if(null!=s.success)return{result:`<code class="code" part="code">\n <pre class="pre ${n}" part="pre ${n}">${JSON.stringify(t,void 0,2)}</pre>\n </code>`,resultCategory:1==s.success?"success":"fail"};{const s=1==e?"success-message":"error-message";return{result:`<code class="code" part="code">\n <pre class="pre ${s}" part="pre ${s}">${JSON.stringify(t,void 0,2)}</pre>\n </code>`,resultCategory:1==e?"success":"fail"}}}throw new Error("Unable to parse result type: Unknown result type")}async createTestContext(e){const s={detail:{},codeTestsElement:this.codeTestsElement,testElement:e,messageElement:e?.findElement(".message")};return null!=this.codeTestsElement.state.contextHook&&await this.codeTestsElement.state.contextHook(s),this.codeTestsElement.dispatchEvent(new CustomEvent(t.Context,{bubbles:!0,composed:!0,detail:{context:s}})),s}}class r extends Promise{async toBeDefined(t){if(null==await(this))throw new Error(`${null!=t?t:"Value"} is undefined`)}async toBe(t,e=!1){const s=await(this);if(0==(1==e?s===t:s==t))throw new Error(` Value is not equal.\n Expected: ${t}\n Result: ${s}`)}async toContainText(t){const e=await(this);return e instanceof HTMLElement?{success:e.textContent.includes(t),index:e.textContent.indexOf(t)}:"string"==typeof e&&{success:e.includes(t),index:e.indexOf(t)}}async toHaveAttribute(t){const e=await(this);if(!(e instanceof HTMLElement))throw new Error("Unable to check for attribute on non-HTMLElement target");if(e.getAttribute(t))throw new Error("Target does not have attribute")}}const o=":not(slot,defs,g,rect,path,circle,ellipse,line,polygon,text,tspan,use,svg image,svg title,desc,template,template *)";function i(t){!function(t){const e=[...t.querySelectorAll(`${o}[id]`)];for(let t=0;t<e.length;t++)e[t].part.add(e[t].id)}(t),function(t){const e=[...t.querySelectorAll(`${o}[class]`)];for(let t=0;t<e.length;t++)e[t].part.add(...e[t].classList)}(t)}const l={BeforeAll:"beforeall",AfterAll:"afterall",BeforeEach:"beforeeach",AfterEach:"aftereach",RequiredBeforeAny:"requiredbeforeany",RequiredAfterAny:"requiredafterany",Reset:"reset",Context:"context"},c=new CSSStyleSheet;c.replaceSync(":host\n{\n --gap: 7px;\n --gap-small: 3px;\n --gap-medium: 14px;\n --gap-large: 24px;\n \n --surface-success: oklch(93.96% 0.05 148.74);\n --primary-success: oklch(58.83% 0.158 145.05);\n --border-success: solid 1px var(--primary-success);\n\n --surface-fail: oklch(88.98% 0.052 3.28);\n --primary-fail: oklch(45.8% 0.177 17.7);\n --border-fail: solid 1px var(--primary-fail);\n\n --surface-process: oklch(89.66% 0.046 260.67);\n --primary-process: oklch(43.48% 0.17 260.2);\n --border-process: solid 1px var(--primary-process);\n\n\n\n --surface-test-summary: var(--uchu-gray);\n --surface-hook-summary: var(--uchu-light-purple);\n --surface-hook-any-summary: var(--uchu-light-blue);\n \n --border-test: solid 1px var(--uchu-dark-gray);\n --border-hook: solid 1px var(--uchu-dark-purple);\n --border-hook-any: solid 1px var(--uchu-dark-blue);\n --border-button: solid 1px var(--uchu-blue);\n \n --success-icon: url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"%232e943a\" d=\"M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z\"/></svg>');\n --info-icon: url('data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2022.812714%2022.814663%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Asvg%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20style%3D%22fill%3Atransparent%3Bstroke%3Atransparent%3Bstroke-width%3A0.999999%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A6.3%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A29.2913%3Bstroke-opacity%3A1%22%20d%3D%22M%2022.295505%2C11.407332%20A%2010.889144%2C10.889144%200%200%201%2011.406424%2C22.296479%2010.889144%2C10.889144%200%200%201%200.51720881%2C11.407332%2010.889144%2C10.889144%200%200%201%2011.406424%2C0.51818382%2010.889144%2C10.889144%200%200%201%2022.295505%2C11.407332%20Z%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22m%2013.945668%2C4.3053761%20c%200.150778%2C-0.96462%20-0.30687%2C-1.43709%20-1.36997%2C-1.43709%20-1.063%2C0%20-1.668452%2C0.47247%20-1.81923%2C1.43709%20-0.150779%2C0.96462%200.306971%2C1.43708%201.369971%2C1.43708%201.004%2C0%201.66845%2C-0.47246%201.819229%2C-1.43708%20z%20M%2011.693889%2C17.829726%2013.373994%2C7.0811161%20h%20-2.9333%20L%208.7605887%2C17.829726%20Z%22%20style%3D%22font-size%3A19.6861px%3Bfont-family%3APassageway%3B-inkscape-font-specification%3APassageway%3Bfill%3A%23a30d30%3Bstroke-width%3A2.5%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A6.3%3Bstroke-dashoffset%3A29.2913%22%20aria-label%3D%22i%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');\n\n\n display: grid;\n gap: var(--gap);\n grid-auto-rows: max-content;\n font-family: sans-serif;\n font-size: 12px;\n}\n\n#header\n{\n flex: 1;\n display: flex;\n align-items: center;\n gap: var(--gap);\n padding: var(--gap-small) var(--gap);\n}\n#title\n{\n flex: 1;\n}\n\n#tests\n,#component-content\n{\n display: grid;\n gap: var(--gap);\n grid-auto-rows: max-content;\n}\n\n#header button\n{\n align-self: stretch;\n display: inline-flex;\n align-items: center;\n gap: var(--gap-small);\n}\n\nbutton .reset-icon\n{\n width: 1em;\n height: 1em;\n transform: scaleX(-1);\n margin-inline: 3px;\n}\n\n/* Run button */\nbutton .arrow-icon\n{\n width: .75em;\n height: .75em;\n transform: rotate(-90deg);\n margin-inline: 3px;\n}\n:host(.running) .run-all-button-icon\n,:host(.fail) .run-all-button-icon\n{\n transform: rotate(0);\n}\n\n/* Dropdown Layout */\nsummary > .run-test-button\n, #run-all-button\n{\n justify-self: flex-end;\n margin-left: auto;\n}\n\nsummary:not(#component-summary)\n{\n padding: var(--gap-small) var(--gap);\n}\n#component-summary\n{\n padding-block: var(--gap-small);\n}\n\n\n/* Dropdown Markers */\nsummary\n{\n display: flex;\n align-items: center;\n gap: var(--gap);\n}\nsummary > .arrow-icon\n{\n background: var(--arrow-icon);\n transform: rotate(-90deg);\n transition: transform ease-out 90ms;\n width: .6em;\n height: .6em;\n}\ndetails[open] > summary > .arrow-icon\n{\n transform: rotate(0);\n}\n\n/* Result Icon */\n.result-icon\n{\n --background-size: 16px;\n width: var(--background-size);\n height: var(--background-size);\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n border: solid 1px currentColor;\n border-radius: 50%;\n}\n.result-icon::before\n{\n content: '⋯';\n font-size: 10px;\n}\n\n:host(.running) #component-summary .result-icon\n,.test.running .test-summary > .result-icon\n,.hook.running .result-icon\n,.processing-details.running .processing-result-icon\n{\n border: var(--border-process);\n background: var(--surface-process);\n}\n:host(.success) #component-summary .result-icon\n,.test.success .test-summary > .result-icon\n,.hook.success .result-icon\n,.processing-details.success .processing-result-icon\n{\n border: var(--border-success);\n background: var(--surface-success)\n var(--success-icon);\n background-repeat: no-repeat;\n background-position: center;\n background-size: var(--icon-size, 12px) var(--icon-size, 12px);\n}\n:host(.fail) #component-summary .result-icon\n,.test.fail .test-summary > .result-icon\n,.hook.fail .result-icon\n,.processing-details.fail .processing-result-icon\n{\n border: var(--border-fail);\n background: var(--surface-fail)\n var(--info-icon);\n background-size: var(--icon-size, 16px) var(--icon-size, 16px);\n background-repeat: no-repeat;\n background-position: center;\n transform: rotate(175deg);\n}\n:host(:is(.success,.fail)) #component-summary .result-icon::before\n,.test:is(.success,.fail) .test-summary > .result-icon::before\n,.hook:is(.success,.fail) .result-icon::before\n,.processing-details:is(.success,.fail) .processing-result-icon::before\n{\n display: none;\n}\n:host(.running) #component-summary .result-icon::before\n,.test:is(.running) .test-summary > .result-icon::before\n,.hook:is(.running) .result-icon::before\n,.processing-details:is(.running) .processing-result-icon::before\n{\n content: '';\n --color: var(--primary-process, currentColor);\n --animation-timing-function: linear;\n --animation-duration: 2s;\n width: var(--icon-size, 14px);\n height: var(--icon-size, 14px);\n mask-image: radial-gradient(circle at 50% 50%, transparent calc(var(--icon-size, 14px) / 3), black calc(var(--icon-size, 14px) / 3));\n background-image: conic-gradient(transparent, transparent 135deg, var(--color));\n border-radius: 50%;\n animation: var(--animation-timing-function) var(--animation-duration) infinite spin;\n margin: 2px;\n}\n\n/* Smaller Result icon settings for sub-test icons */\n.before-each-result-icon\n,.after-each-result-icon\n,.processing-result-icon\n{\n --background-size: 12px;\n}\n.before-each-result-icon::before\n,.after-each-result-icon::before\n,.processing-result-icon::before\n{\n font-size: 9px;\n}\n.hook.success .before-each-result-icon\n,.hook.success .after-each-result-icon\n,.processing-details.success .processing-result-icon\n{\n --icon-size: 8px;\n}\n.hook.fail .before-each-result-icon\n,.hook.fail .after-each-result-icon\n,.processing-details.fail .processing-result-icon\n{\n --icon-size: 12px;\n}\n.hook:is(.running) .before-each-result-icon::before\n,.hook:is(.running) .after-each-result-icon::before\n,.processing-details:is(.running) .processing-result-icon::before\n{\n --icon-size: 9px;\n}\n\n/* Hook Display */\n.hook\n{\n display: none;\n}\n:host(.has-before-all-hook) #before-all-details\n,:host(.has-after-all-hook) #after-all-details\n{\n display: initial;\n}\n:host(.has-before-each-hook) .before-each-details\n,:host(.has-after-each-hook) .after-each-details\n{\n display: initial;\n}\n:host(.has-required-before-hook) #required-before-any-details\n,:host(.has-required-after-hook) #required-after-any-details\n{\n display: initial;\n}\n\n/* Test Display */\ncode-test .results\n{\n display: grid;\n gap: var(--gap-small);\n padding-inline-start: 1em;\n}\n\ncode-test .results details .result\n,.hook > .results\n{\n margin-inline-start: 1em;\n}\n\n.result.message:empty\n{\n padding: .5em 1em;\n}\n.result.message:empty::before\n{\n content: '[ this function has not been run ]';\n font-family: monospace;\n font-size: 12px;\n font-style: italic;\n}\n\n/* Ordered Display */\n#tests\n{\n counter-reset: tests;\n}\ncode-test\n{\n counter-increment: tests;\n}\ncode-test > details > summary > .description\n{\n flex: 1;\n}\n:host(:not([ordered=\"false\"])) code-test > details > summary > .description::before\n{\n content: counter(tests) \". \";\n}\n\n/* Hook Name */\n.hook-name,.processing-description\n{\n border-radius: 3px;\n border: solid 1px;\n /* background: rgb(0 0 0 / .2); */\n font-family: monospace;\n text-transform: uppercase;\n font-size: 11px;\n padding: 3px 7px;\n}\n\n#footer\n{\n display: flex;\n justify-content: flex-end;\n}\n#group-results\n{\n display: flex;\n gap: var(--gap);\n padding: var(--gap);\n}\n\n#passed-total-percent::before\n{\n content: '(';\n}\n#passed-total-percent::after\n{\n content: ')';\n}\n\n@keyframes spin\n{\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}");const u="code-tests";class d extends HTMLElement{state={isCanceled:!1,beforeAllState:void 0,afterAllState:void 0,beforeEachState:void 0,afterEachState:void 0,requiredBeforeAnyState:void 0,requiredAfterAnyState:void 0,resetHook:void 0,contextHook:void 0};setState(t){this.state=t,this.#t()}setStateProperties(t){this.setState({...this.state,...t})}setTestStateProperties(t,e){null!=this.state[t]&&this.setState({...this.state,[t]:{...this.state[t],...e}})}findElement(t){return this.shadowRoot.querySelector(t)}findElements(t){return Array.from(this.shadowRoot.querySelectorAll(t))}getIsRunning(){return 1==(null!=this.findElements("code-test").find(t=>1==t.isRunning()))||1==this.state.requiredBeforeAnyState?.isRunning||1==this.state.requiredAfterAnyState?.isRunning||1==this.state.beforeAllState?.isRunning||1==this.state.afterAllState?.isRunning}getResultCategory(){const t=this.findElements("code-test").reduce((t,e,s)=>{const n=e.resultCategory();return"fail"==t||"fail"==n?"fail":"success"!=t&&""!=t||"success"!=n?"none":"success"},""),e=[this.state.requiredBeforeAnyState,this.state.requiredAfterAnyState,this.state.beforeAllState,this.state.afterAllState].reduce((t,e,s)=>{if(null==e)return null;const n=e?.resultCategory;return"fail"==t||"fail"==n?"fail":"success"!=t&&""!=t||"success"!=n?"none":"success"},"");return"none"==t&&null==e?"none":"fail"==t||"fail"==e?"fail":"success"==t&&"success"==e?"success":"none"}#o;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='<details id="component-details" class="details">\n <summary id="component-summary" class="summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <slot name="header">\n <header id="header">\n <span id="component-result-icon" class="result-icon"></span>\n <span id="title"><slot name="title"><span id="title-text">Tests</span></slot></span>\n <slot name="reload-button">\n <button type="button" id="reload-button" title="Reload">\n <slot name="reload-button-content">\n <slot name="reload-button-icon"><svg class="icon reset-icon reload-button-icon"><use href="#icon-definition_reset"></use></svg></slot>\n <slot name="reload-button-label"><span class="reload-button-label button-label label icon">Reload</span></slot>\n </slot>\n </button>\n </slot>\n <slot name="run-all-button">\n <button type="button" id="run-all-button" title="Run All Tests">\n <slot name="run-all-button-content">\n <slot name="run-all-button-icon"><svg class="icon arrow-icon run-button-icon run-all-button-icon"><use href="#icon-definition_arrow"></use></svg></slot>\n <slot name="run-all-button-label"><span class="run-all-button-label run-button-label button-label label icon">Run Tests</span></slot>\n </slot>\n </button>\n </slot>\n <slot name="header-details"></slot>\n </header>\n </slot>\n </summary>\n <div id="component-content" class="content">\n <details id="required-before-any-details" class="hook">\n <summary id="required-before-any-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <span id="required-before-any-result-icon" class="result-icon"></span>\n <span id="required-before-any-description" class="description hook-name">Required Before Any Hook</span>\n </summary>\n <div class="results">\n <div id="required-before-any-results" class="result message"></div>\n </div>\n </details>\n <details id="before-all-details" class="hook">\n <summary id="before-all-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <span id="before-all-result-icon" class="result-icon"></span>\n <span id="before-all-description" class="description hook-name">Before All Hook</span>\n </summary>\n <div class="results">\n <div id="before-all-results" class="result message"></div>\n </div>\n </details>\n <div id="tests"></div>\n <details id="after-all-details" class="hook">\n <summary id="after-all-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <span id="after-all-result-icon" class="result-icon"></span>\n <span id="after-all-description" class="description hook-name">After All Hook</span>\n </summary>\n <div class="results">\n <div id="after-all-results" class="result message"></div>\n </div>\n </details>\n <details id="required-after-any-details" class="hook">\n <summary id="required-after-any-summary">\n <svg class="icon arrow-icon"><use href="#icon-definition_arrow"></use></svg>\n <span id="required-after-any-result-icon" class="result-icon"></span>\n <span id="required-after-any-description" class="description hook-name">Required After Any Hook</span>\n </summary>\n <div class="results">\n <div id="required-after-any-results" class="result message"></div>\n </div>\n </details>\n </div>\n \n <slot name="footer">\n <foooter id="footer">\n <span id="group-results">\n <span id="duration">\n <span id="duration-label">Duration</span>\n <span id="duration-value"></span>\n <span id="duration-unit">ms</span>\n </span>\n <span id="results-progress">\n <progress id="results-progress-value"></progress>\n </span>\n <span id="passed-total-pair">\n <span id="total-tests-passed-value"></span>\n <span id="passed-total-delimiter">of</span>\n <span id="total-tests-count-value"></span>\n <span id="total-tests-passed-label">Passed</span>\n </span>\n <span id="passed-total-percent">\n <span id="passed-total-percent-value"></span>\n <span id="passed-total-percent-label">%</span>\n </span>\n </span>\n </foooter>\n </slot>\n</details>\n<template id="prompt-template">\n <div class="prompt">\n <div class="prompt-display">\n <span class="icon prompt-icon"></span>\n <span class="label prompt-label"></span>\n </div>\n <div class="prompt-actions">\n <button class="prompt-button accept" type="button">Accept</button>\n <button class="prompt-button reject" type="button">Reject</button>\n </div>\n </div>\n</template>\n<div id="icon-definitions" style="display: none;">\n <svg id="icon-definition_arrow" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">\n <path d="m3.26,6.81l-2.93,-4.69c-0.37,-0.58 0.05,-1.34 0.74,-1.34l5.87,0c0.69,0 1.11,0.76 0.74,1.34l-2.93,4.69c-0.35,0.55 -1.14,0.55 -1.49,0z" fill="var(--fill-color, currentcolor)" />\n </svg>\n <svg id="icon-definition_reset" class="icon reset" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">\n <path\n style="fill:var(--fill-color, currentcolor);stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none;paint-order:markers stroke fill"\n d="M 5.484375 0.43359375 A 1.5224222 1.5224222 0 0 0 4.2558594 1.2011719 L 0.99804688 6.9453125 A 1.5224222 1.5224222 0 0 0 2.5488281 9.2011719 L 9.34375 8.171875 A 1.5224222 1.5224222 0 0 0 10.332031 5.7539062 L 9.4746094 4.6113281 C 11.949333 3.8016718 14.718209 4.258351 16.822266 5.9570312 C 19.510764 8.1275534 20.456787 11.785479 19.160156 14.988281 C 17.863527 18.191083 14.6405 20.15873 11.199219 19.847656 C 7.7579362 19.536584 4.9376009 17.022073 4.2363281 13.638672 A 1.5 1.5 0 0 0 2.4628906 12.474609 A 1.5 1.5 0 0 0 1.2988281 14.248047 C 2.2656928 18.912838 6.1831413 22.407052 10.927734 22.835938 C 15.672328 23.264824 20.153706 20.531029 21.941406 16.115234 C 23.729107 11.699441 22.413741 6.6156073 18.707031 3.6230469 C 16.853677 2.1267667 14.61485 1.3255701 12.347656 1.2324219 C 10.738216 1.1662975 9.1150542 1.4598646 7.6035156 2.1132812 L 6.7988281 1.0390625 A 1.5224222 1.5224222 0 0 0 5.484375 0.43359375 z " />\n </svg>\n <svg id="icon-definition_cancel" class="icon cancel" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">\n <path\n style="fill:var(--fill-color, currentcolor);stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none;paint-order:markers stroke fill"\n d="M -7.063234 9.5244002 C -5.8135728 7.6769245 -5.0820528 5.453265 -5.0820528 3.0633809 C -5.0820529 -3.3096433 -10.278145 -8.5098163 -16.65117 -8.5098163 C -23.024193 -8.5098163 -28.22385 -3.3110105 -28.22385 3.0620137 C -28.22385 9.4350379 -23.025043 14.634694 -16.65202 14.634694 C -12.668879 14.634694 -9.1460028 12.603526 -7.063234 9.5244002 z M -9.5406311 7.8637601 C -11.076991 10.143147 -13.683157 11.63463 -16.652974 11.63463 C -19.960499 11.63463 -22.814085 9.782061 -24.244824 7.0543029 L -24.236684 7.0527515 L -8.1332524 3.983715 L -8.1305391 3.9831979 C -8.2815631 5.4121635 -8.7798709 6.7350751 -9.5406311 7.8637601 z M -9.0610781 -0.92890828 L -9.069218 -0.92735695 L -25.17265 2.1416796 L -25.175363 2.1421967 C -24.719122 -2.1725739 -21.093311 -5.5092358 -16.652928 -5.5092358 C -13.345403 -5.5092358 -10.491243 -3.6566663 -9.0610781 -0.92890828 z "\n transform="rotate(-124.20981)" />\n </svg>\n</div>',this.shadowRoot.adoptedStyleSheets.push(c)}connectedCallback(){this.#i()}disconnectedCallback(){this.#l()}#c=!1;async#i(){1!=this.#c&&(i(this.shadowRoot),this.addEventListener("click",this.#u),await new Promise(t=>requestAnimationFrame(()=>{this.#o=new a(this),t()})),this.#c=!0,"false"!=this.getAttribute("auto")&&this.reloadTests())}#l(){this.removeEventListener("click",this.#u)}#u=this.#d.bind(this);#d(t){if(null!=t.composedPath().find(t=>t instanceof HTMLButtonElement&&"run-all-button"==t.id))return void(this.classList.contains("running")?this.cancel():this.classList.contains("fail")||this.classList.contains("success")?this.reset():this.runTests());null!=t.composedPath().find(t=>t instanceof HTMLButtonElement&&"reload-button"==t.id)&&this.reloadTests();const e=t.composedPath().find(t=>t instanceof HTMLButtonElement&&t.classList.contains("run-test-button"));if(null==e)return;const s=e.closest("code-test")??void 0;this.#o.runTest(s,!1)}#h(){return this.getAttribute("src")??this.getAttribute("test")??this.getAttribute("tests")??this.getAttribute("run")??this.getAttribute("path")??void 0}#t(){const t=this.getIsRunning(),e=this.getResultCategory(),s=null!=this.state.beforeAllState,n=null!=this.state.beforeEachState,a=null!=this.state.requiredAfterAnyState,r=null!=this.state.beforeAllState,o=null!=this.state.beforeEachState,i=null!=this.state.requiredAfterAnyState,l=1==a||1==s||1==n,c=1==i||1==r||1==o;this.classList.toggle("canceled",this.state.isCanceled),this.part.toggle("canceled",this.state.isCanceled),this.classList.toggle("running",1==t),this.part.toggle("running",1==t),this.toggleAttribute("success","success"==e),this.classList.toggle("success","success"==e),this.part.toggle("success","success"==e),this.classList.toggle("fail","fail"==e),this.part.toggle("fail","fail"==e),this.classList.toggle("has-before-hook",l),this.part.toggle("has-before-hook",l),this.classList.toggle("has-after-hook",c),this.part.toggle("has-after-hook",c),this.classList.toggle("has-before-all-hook",s),this.part.toggle("has-before-all-hook",s),this.classList.toggle("has-after-all-hook",r),this.part.toggle("has-after-all-hook",r),this.classList.toggle("has-before-each-hook",n),this.part.toggle("has-before-each-hook",n),this.classList.toggle("has-after-each-hook",o),this.part.toggle("has-after-each-hook",o),this.classList.toggle("has-required-before-hook",a),this.part.toggle("has-required-before-hook",a),this.classList.toggle("has-required-after-hook",i),this.part.toggle("has-required-after-hook",i);const u=this.findElement(".run-all-button-label");null!=u&&(u.textContent=1==t?"Cancel":"fail"==e?"Reset":"Run Tests",u.title=1==t?"Cancel the testing":"fail"==e?"Reset the tests so they can be run again":"Run the tests");const d=this.findElement(".run-all-button-icon");null!=d&&(d.innerHTML=1==t?'<use href="#icon-definition_cancel"></use>':"fail"==e?'<use href="#icon-definition_reset"></use>':'<use href="#icon-definition_arrow"></use>'),this.#f(this.state.beforeAllState,"#before-all-results"),this.#f(this.state.afterAllState,"#after-all-results"),this.#f(this.state.requiredBeforeAnyState,"#required-before-any-results"),this.#f(this.state.requiredAfterAnyState,"#required-after-any-results");const h=this.findElement("#title");null!=h&&(h.textContent=this.getAttribute("label")??"Tests"),this.#p()}#f(t,e){const s=this.findElement(e);t?.resultContent instanceof HTMLElement?s.append(t.resultContent):"string"==typeof t?.resultContent&&(s.innerHTML=t.resultContent);const n=s.closest("details");n.toggleAttribute("open",null!=t&&"none"!=t.resultCategory),n.classList.toggle("running",1==t?.isRunning),n.part.toggle("running",1==t?.isRunning),n.toggleAttribute("success","success"==t?.resultCategory),n.classList.toggle("success","success"==t?.resultCategory),n.part.toggle("success","success"==t?.resultCategory),n.classList.toggle("fail","fail"==t?.resultCategory),n.part.toggle("fail","fail"==t?.resultCategory)}#p(){const t=this.collectTestResults(),e=this.findElement("#results-progress-value");null!=e&&(e.max=t.totalTests,e.value=t.totalPassed);const s=this.findElement("#total-tests-passed-value");null!=s&&(s.textContent=t.totalPassed.toString());const n=this.findElement("#total-tests-count-value");null!=n&&(n.textContent=t.totalTests.toString());const a=this.findElement("#passed-total-percent-value");null!=a&&(a.textContent=t.totalPercentage.toFixed(1));const r=this.findElement("#duration-value");null!=r&&(r.textContent=t.duration>10?t.duration.toFixed(0):t.duration.toFixed(2))}collectTestResults(){const t=this.findElements("code-test"),e=t.length,s=t.filter(t=>"success"==t.state.testState?.resultCategory).length;return{totalTests:e,totalPassed:s,totalPercentage:0==e?0:s/e*100,duration:t.reduce((t,e,s)=>t+(e.state.testState?.duration??0),0)}}async runTests(){const t=this.findElements("code-test");return this.#o.runTests(t)}async reloadTests(){this.findElement("#tests").innerHTML="",await this.reset();const t=this.#h();this.#o.loadTests(t)}async reset(){const e=this.findElements("code-test");for(let t=0;t<e.length;t++){const s=e[t],n=null!=this.state.beforeEachState?{resultCategory:"none",resultContent:"",hasRun:this.state.beforeEachState.hasRun,isRunning:this.state.beforeEachState.isRunning,duration:0}:void 0,a=null!=this.state.afterEachState?{resultCategory:"none",resultContent:"",hasRun:this.state.afterEachState.hasRun,isRunning:this.state.afterEachState.isRunning,duration:0}:void 0;null!=n&&(s.state.beforeEachState=n),null!=a&&(s.state.afterEachState=a),s.reset()}const s=null==this.state.beforeAllState?void 0:{resultContent:"",resultCategory:"none",test:this.state.beforeAllState.test,isRunning:!1,hasRun:!1,duration:0},n=null==this.state.afterAllState?void 0:{resultContent:"",resultCategory:"none",test:this.state.afterAllState.test,isRunning:!1,hasRun:!1,duration:0},a=null==this.state.beforeEachState?void 0:{resultContent:"",resultCategory:"none",test:this.state.beforeEachState.test,isRunning:!1,hasRun:!1,duration:0},r=null==this.state.afterEachState?void 0:{resultContent:"",resultCategory:"none",test:this.state.afterEachState.test,isRunning:!1,hasRun:!1,duration:0},o=null==this.state.requiredBeforeAnyState?void 0:{resultContent:"",resultCategory:"none",test:this.state.requiredBeforeAnyState.test,isRunning:!1,hasRun:!1,duration:0},i=null==this.state.requiredAfterAnyState?void 0:{resultContent:"",resultCategory:"none",test:this.state.requiredAfterAnyState.test,isRunning:!1,hasRun:!1,duration:0};this.setStateProperties({isCanceled:!1,beforeAllState:s,afterAllState:n,beforeEachState:a,afterEachState:r,requiredAfterAnyState:i,requiredBeforeAnyState:o}),this.#o.shouldContinueRunningTests=!0,null!=this.state.resetHook&&await this.state.resetHook(await this.#o.createTestContext()),this.dispatchEvent(new CustomEvent(t.Reset,{bubbles:!0,composed:!0}))}cancel(){this.state.isCanceled=!0,this.#o.shouldContinueRunningTests=!1,this.classList.add("canceled"),this.part.add("canceled"),this.dispatchEvent(new CustomEvent(t.Cancel,{bubbles:!0,composed:!0}))}static observedAttributes=["open","label"];attributeChangedCallback(t,e,s){if("open"==t)this.findElement("#component-details").toggleAttribute("open",null!=s);else if("label"==t){const t=this.findElement("#title");null!=t&&(t.textContent=s??"Tests")}}}function h(t){return new r(async(e,s)=>{if(t instanceof Promise){return void e(await t)}e(t)})}async function f(t,e,s,n){return new Promise((a,r)=>{const o=p(n?.template??t.querySelector(".prompt-template")??t.findElement("#prompt-template"));o.querySelector(".label").textContent=s;const i=t=>{const e=t.composedPath();if(null!=e.find(t=>t instanceof HTMLButtonElement&&t.classList.contains("accept"))){const t=n?.onAccept?.()??!0;return o.removeEventListener("click",i),void a(t)}if(null!=e.find(t=>t instanceof HTMLButtonElement&&t.classList.contains("reject"))){const t=n?.onReject?.()??!1;return o.removeEventListener("click",i),void a(t)}};o.addEventListener("click",i),null!=n?.acceptLabel&&(o.querySelector(".accept").textContent=n.acceptLabel),null!=n?.rejectLabel&&(o.querySelector(".reject").textContent=n.rejectLabel),e.append(o)})}function p(t,e){const s=t instanceof HTMLTemplateElement?t:document.querySelector(t);if(null==s)throw new Error(`Unable to find template element from selector: ${t}`);const n=s.content.cloneNode(!0).firstElementChild;if(null==n)throw new Error("Unable to find first child of template element");return e?.append(n),n}null==customElements.get(u)&&customElements.define(u,d);export{s as CodeTestElement,t as CodeTestEvent,d as CodeTestsElement,l as Hook,r as TestPromise,p as createElementFromTemplate,h as expect,f as prompt};
|