@markuplint/svelte-parser 3.0.0-canary.5 → 3.0.0-dev.176

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.
@@ -0,0 +1,508 @@
1
+ const { attributesToDebugMaps, nodeListToDebugMaps } = require('@markuplint/parser-utils');
2
+
3
+ const { parse } = require('../lib/');
4
+
5
+ describe('parser', () => {
6
+ test('syntax error', () => {
7
+ expect(() => {
8
+ parse('<div></div\nattr>');
9
+ }).toThrow('Expected >\n1: <div></div\n2: attr>\n ^');
10
+ });
11
+
12
+ test('standard', () => {
13
+ const r = parse('<div>text</div>');
14
+ const map = nodeListToDebugMaps(r.nodeList);
15
+ expect(map).toStrictEqual([
16
+ '[1:1]>[1:6](0,5)div: <div>',
17
+ '[1:6]>[1:10](5,9)#text: text',
18
+ '[1:10]>[1:16](9,15)div: </div>',
19
+ ]);
20
+ });
21
+
22
+ test('with script', () => {
23
+ const r = parse(`<script>let i = 1;</script>
24
+
25
+ <div data-attr={i}>{i}</div>
26
+ <span></span>`);
27
+ const map = nodeListToDebugMaps(r.nodeList);
28
+ expect(map).toStrictEqual([
29
+ '[1:1]>[1:28](0,27)#ps:Script: <script>let␣i␣=␣1;</script>',
30
+ '[1:28]>[3:1](27,29)#text: ⏎⏎',
31
+ '[3:1]>[3:20](29,48)div: <div␣data-attr={i}>',
32
+ '[3:20]>[3:23](48,51)#ps:MustacheTag: {i}',
33
+ '[3:23]>[3:29](51,57)div: </div>',
34
+ '[3:29]>[4:2](57,59)#text: ⏎→',
35
+ '[4:2]>[4:8](59,65)span: <span>',
36
+ '[4:8]>[4:15](65,72)span: </span>',
37
+ ]);
38
+ });
39
+
40
+ test('with script (complex order)', () => {
41
+ const r = parse(`
42
+ <div>1</div>
43
+ <script>let i = 1;</script>
44
+ <div>2</div>
45
+ <style>div { display: none; }</style>
46
+ <div>3</div>
47
+ `);
48
+ const map = nodeListToDebugMaps(r.nodeList);
49
+ expect(map).toStrictEqual([
50
+ '[1:1]>[2:1](0,1)#text: ⏎',
51
+ '[2:1]>[2:6](1,6)div: <div>',
52
+ '[2:6]>[2:7](6,7)#text: 1',
53
+ '[2:7]>[2:13](7,13)div: </div>',
54
+ '[2:13]>[3:1](13,14)#text: ⏎',
55
+ '[3:1]>[3:28](14,41)#ps:Script: <script>let␣i␣=␣1;</script>',
56
+ '[3:28]>[4:1](41,42)#text: ⏎',
57
+ '[4:1]>[4:6](42,47)div: <div>',
58
+ '[4:6]>[4:7](47,48)#text: 2',
59
+ '[4:7]>[4:13](48,54)div: </div>',
60
+ '[4:13]>[5:1](54,55)#text: ⏎',
61
+ '[5:1]>[5:38](55,92)#ps:Style: <style>div␣{␣display:␣none;␣}</style>',
62
+ '[5:38]>[6:1](92,93)#text: ⏎',
63
+ '[6:1]>[6:6](93,98)div: <div>',
64
+ '[6:6]>[6:7](98,99)#text: 3',
65
+ '[6:7]>[6:13](99,105)div: </div>',
66
+ '[6:13]>[7:1](105,106)#text: ⏎',
67
+ ]);
68
+ });
69
+
70
+ test('variable', () => {
71
+ const r = parse('<div>{variable}</div>');
72
+ const map = nodeListToDebugMaps(r.nodeList);
73
+ expect(map).toStrictEqual([
74
+ '[1:1]>[1:6](0,5)div: <div>',
75
+ '[1:6]>[1:16](5,15)#ps:MustacheTag: {variable}',
76
+ '[1:16]>[1:22](15,21)div: </div>',
77
+ ]);
78
+ });
79
+
80
+ test('if statement', () => {
81
+ const r = parse('<div>{#if bool}true{:else}false{/if}</div>');
82
+ const map = nodeListToDebugMaps(r.nodeList);
83
+ expect(map).toStrictEqual([
84
+ '[1:1]>[1:6](0,5)div: <div>',
85
+ '[1:6]>[1:16](5,15)IfBlock: {#if␣bool}',
86
+ '[1:16]>[1:20](15,19)#text: true',
87
+ '[1:20]>[1:27](19,26)ElseBlock: {:else}',
88
+ '[1:27]>[1:32](26,31)#text: false',
89
+ '[1:32]>[1:37](31,36)IfBlock: {/if}',
90
+ '[1:37]>[1:43](36,42)div: </div>',
91
+ ]);
92
+ });
93
+
94
+ test('else if statement', () => {
95
+ const r = parse(`<div>
96
+ {#if porridge.temperature > 100}
97
+ <p>too hot!</p>
98
+ {:else if 80 > porridge.temperature}
99
+ <p>too cold!</p>
100
+ {:else}
101
+ <p>just right!</p>
102
+ {/if}
103
+ </div>`);
104
+ const map = nodeListToDebugMaps(r.nodeList);
105
+ expect(map).toStrictEqual([
106
+ '[1:1]>[1:6](0,5)div: <div>',
107
+ '[1:6]>[2:2](5,7)#text: ⏎→',
108
+ '[2:2]>[3:3](7,42)IfBlock: {#if␣porridge.temperature␣>␣100}⏎→→',
109
+ '[3:3]>[3:6](42,45)p: <p>',
110
+ '[3:6]>[3:14](45,53)#text: too␣hot!',
111
+ '[3:14]>[3:18](53,57)p: </p>',
112
+ '[3:18]>[5:3](57,98)ElseIfBlock: ⏎→{:else␣if␣80␣>␣porridge.temperature}⏎→→',
113
+ '[5:3]>[5:6](98,101)p: <p>',
114
+ '[5:6]>[5:15](101,110)#text: too␣cold!',
115
+ '[5:15]>[5:19](110,114)p: </p>',
116
+ '[5:19]>[6:9](114,123)ElseBlock: ⏎→{:else}',
117
+ '[6:9]>[7:3](123,126)#text: ⏎→→',
118
+ '[7:3]>[7:6](126,129)p: <p>',
119
+ '[7:6]>[7:17](129,140)#text: just␣right!',
120
+ '[7:17]>[7:21](140,144)p: </p>',
121
+ '[7:21]>[8:2](144,146)#text: ⏎→',
122
+ '[8:2]>[8:7](146,151)IfBlock: {/if}',
123
+ '[8:7]>[9:1](151,152)#text: ⏎',
124
+ '[9:1]>[9:7](152,158)div: </div>',
125
+ ]);
126
+ });
127
+
128
+ test('each statement', () => {
129
+ const r = parse('{#each expression as name}...{/each}');
130
+ const map = nodeListToDebugMaps(r.nodeList);
131
+ expect(map).toStrictEqual([
132
+ '[1:1]>[1:27](0,26)EachBlock: {#each␣expression␣as␣name}',
133
+ '[1:27]>[1:30](26,29)#text: ...',
134
+ '[1:30]>[1:37](29,36)EachBlock: {/each}',
135
+ ]);
136
+ });
137
+
138
+ test('each else statement', () => {
139
+ const r = parse('{#each expression as name}...{:else}...{/each}');
140
+ const map = nodeListToDebugMaps(r.nodeList);
141
+ expect(map).toStrictEqual([
142
+ '[1:1]>[1:27](0,26)EachBlock: {#each␣expression␣as␣name}',
143
+ '[1:27]>[1:30](26,29)#text: ...',
144
+ '[1:30]>[1:37](29,36)ElseBlock: {:else}',
145
+ '[1:37]>[1:40](36,39)#text: ...',
146
+ '[1:40]>[1:47](39,46)EachBlock: {/each}',
147
+ ]);
148
+ });
149
+
150
+ test('deep each statement', () => {
151
+ const r = parse('<ul>{#each a as b}<li>{#each c as d}{/each}</li>{/each}</ul>');
152
+ const map = nodeListToDebugMaps(r.nodeList);
153
+ expect(map).toStrictEqual([
154
+ '[1:1]>[1:5](0,4)ul: <ul>',
155
+ '[1:5]>[1:19](4,18)EachBlock: {#each␣a␣as␣b}',
156
+ '[1:19]>[1:23](18,22)li: <li>',
157
+ '[1:23]>[1:37](22,36)EachBlock: {#each␣c␣as␣d}',
158
+ '[1:37]>[1:44](36,43)EachBlock: {/each}',
159
+ '[1:44]>[1:49](43,48)li: </li>',
160
+ '[1:49]>[1:56](48,55)EachBlock: {/each}',
161
+ '[1:56]>[1:61](55,60)ul: </ul>',
162
+ ]);
163
+ });
164
+
165
+ test('await then catch statement', () => {
166
+ const r = parse('{#await expression}...{:then name}...{:catch name}...{/await}');
167
+ const map = nodeListToDebugMaps(r.nodeList);
168
+ expect(map).toStrictEqual([
169
+ '[1:1]>[1:20](0,19)PendingBlock: {#await␣expression}',
170
+ '[1:20]>[1:23](19,22)#text: ...',
171
+ '[1:23]>[1:35](22,34)ThenBlock: {:then␣name}',
172
+ '[1:35]>[1:38](34,37)#text: ...',
173
+ '[1:38]>[1:51](37,50)CatchBlock: {:catch␣name}',
174
+ '[1:51]>[1:54](50,53)#text: ...',
175
+ '[1:54]>[1:62](53,61)AwaitBlock: {/await}',
176
+ ]);
177
+ });
178
+
179
+ test('attribute', () => {
180
+ const r = parse('<el attr-name="value" />');
181
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
182
+ expect(attr).toStrictEqual([
183
+ [
184
+ '[1:5]>[1:22](4,21)attr-name: attr-name="value"',
185
+ ' [1:5]>[1:5](4,4)bN: ',
186
+ ' [1:5]>[1:14](4,13)name: attr-name',
187
+ ' [1:14]>[1:14](13,13)bE: ',
188
+ ' [1:14]>[1:15](13,14)equal: =',
189
+ ' [1:15]>[1:15](14,14)aE: ',
190
+ ' [1:15]>[1:16](14,15)sQ: "',
191
+ ' [1:16]>[1:21](15,20)value: value',
192
+ ' [1:21]>[1:22](20,21)eQ: "',
193
+ ' isDirective: false',
194
+ ' isDynamicValue: false',
195
+ ],
196
+ ]);
197
+ });
198
+
199
+ test('event directive', () => {
200
+ const r = parse('<el on:eventname={ `abc${def}ghi` } />');
201
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
202
+ expect(attr).toStrictEqual([
203
+ [
204
+ '[1:5]>[1:36](4,35)on:eventname: on:eventname={␣`abc${def}ghi`␣}',
205
+ ' [1:5]>[1:5](4,4)bN: ',
206
+ ' [1:5]>[1:17](4,16)name: on:eventname',
207
+ ' [1:17]>[1:17](16,16)bE: ',
208
+ ' [1:17]>[1:18](16,17)equal: =',
209
+ ' [1:18]>[1:18](17,17)aE: ',
210
+ ' [1:18]>[1:19](17,18)sQ: {',
211
+ ' [1:19]>[1:35](18,34)value: ␣`abc${def}ghi`␣',
212
+ ' [1:35]>[1:36](34,35)eQ: }',
213
+ ' isDirective: true',
214
+ ' isDynamicValue: false',
215
+ ],
216
+ ]);
217
+ });
218
+
219
+ test('event directive 2', () => {
220
+ const r = parse('<el on:eventname|modifiers = {handler} />');
221
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
222
+ expect(attr).toStrictEqual([
223
+ [
224
+ '[1:5]>[1:39](4,38)on:eventname|modifiers: on:eventname|modifiers␣=␣{handler}',
225
+ ' [1:5]>[1:5](4,4)bN: ',
226
+ ' [1:5]>[1:27](4,26)name: on:eventname|modifiers',
227
+ ' [1:27]>[1:28](26,27)bE: ␣',
228
+ ' [1:28]>[1:29](27,28)equal: =',
229
+ ' [1:29]>[1:30](28,29)aE: ␣',
230
+ ' [1:30]>[1:31](29,30)sQ: {',
231
+ ' [1:31]>[1:38](30,37)value: handler',
232
+ ' [1:38]>[1:39](37,38)eQ: }',
233
+ ' isDirective: true',
234
+ ' isDynamicValue: false',
235
+ ],
236
+ ]);
237
+ });
238
+
239
+ test('event directive 3', () => {
240
+ const r = parse('<el on:eventname />');
241
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
242
+ expect(attr).toStrictEqual([
243
+ [
244
+ '[1:5]>[1:17](4,16)on:eventname: on:eventname',
245
+ ' [1:5]>[1:5](4,4)bN: ',
246
+ ' [1:5]>[1:17](4,16)name: on:eventname',
247
+ ' [1:17]>[1:17](16,16)bE: ',
248
+ ' [1:17]>[1:17](16,16)equal: ',
249
+ ' [1:17]>[1:17](16,16)aE: ',
250
+ ' [1:17]>[1:17](16,16)sQ: ',
251
+ ' [1:17]>[1:17](16,16)value: ',
252
+ ' [1:17]>[1:17](16,16)eQ: ',
253
+ ' isDirective: true',
254
+ ' isDynamicValue: false',
255
+ ],
256
+ ]);
257
+ });
258
+
259
+ test('bind directive', () => {
260
+ const r = parse('<el bind:property={variable} />');
261
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
262
+ expect(attr).toStrictEqual([
263
+ [
264
+ '[1:5]>[1:29](4,28)property: bind:property={variable}',
265
+ ' [1:5]>[1:5](4,4)bN: ',
266
+ ' [1:5]>[1:18](4,17)name: bind:property',
267
+ ' [1:18]>[1:18](17,17)bE: ',
268
+ ' [1:18]>[1:19](17,18)equal: =',
269
+ ' [1:19]>[1:19](18,18)aE: ',
270
+ ' [1:19]>[1:20](18,19)sQ: {',
271
+ ' [1:20]>[1:28](19,27)value: variable',
272
+ ' [1:28]>[1:29](27,28)eQ: }',
273
+ ' isDirective: false',
274
+ ' isDynamicValue: true',
275
+ ' potentialName: property',
276
+ ],
277
+ ]);
278
+ });
279
+
280
+ test('bind directive 2', () => {
281
+ const r = parse('<el bind:property />');
282
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
283
+ expect(attr).toStrictEqual([
284
+ [
285
+ '[1:5]>[1:18](4,17)property: bind:property',
286
+ ' [1:5]>[1:5](4,4)bN: ',
287
+ ' [1:5]>[1:18](4,17)name: bind:property',
288
+ ' [1:18]>[1:18](17,17)bE: ',
289
+ ' [1:18]>[1:18](17,17)equal: ',
290
+ ' [1:18]>[1:18](17,17)aE: ',
291
+ ' [1:18]>[1:18](17,17)sQ: ',
292
+ ' [1:18]>[1:18](17,17)value: ',
293
+ ' [1:18]>[1:18](17,17)eQ: ',
294
+ ' isDirective: false',
295
+ ' isDynamicValue: true',
296
+ ' potentialName: property',
297
+ ],
298
+ ]);
299
+ });
300
+
301
+ test('other directives', () => {
302
+ const r = parse(`<el
303
+ class:name={value}
304
+ use:action={parameters}
305
+ transition:fn
306
+ transition:fn2={params}
307
+ transition:fn3|local
308
+ transition:fn4|local={params}
309
+ transition:fade="{{ duration: 2000 }}"
310
+ in:whoosh
311
+ in:fn
312
+ in:fn2={params}
313
+ in:fn3|local
314
+ in:fn4|local={params}
315
+ out:fn
316
+ out:fn2={params}
317
+ out:fn3|local
318
+ out:fn4|local={params}
319
+ animate:name
320
+ animate:name2={params}
321
+ />`);
322
+ const attrs = r.nodeList[0].attributes;
323
+ expect(attrs.every(attr => (attr.type === 'html-attr' ? attr.isDirective : false))).toBe(true);
324
+ });
325
+
326
+ test('multiple class directives', () => {
327
+ const r = parse('<el class:selected="{isSelected}" class:focused="{isFocused}" />');
328
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
329
+ expect(attr).toStrictEqual([
330
+ [
331
+ '[1:5]>[1:34](4,33)class: class:selected="{isSelected}"',
332
+ ' [1:5]>[1:5](4,4)bN: ',
333
+ ' [1:5]>[1:19](4,18)name: class:selected',
334
+ ' [1:19]>[1:19](18,18)bE: ',
335
+ ' [1:19]>[1:20](18,19)equal: =',
336
+ ' [1:20]>[1:20](19,19)aE: ',
337
+ ' [1:20]>[1:21](19,20)sQ: "',
338
+ ' [1:21]>[1:33](20,32)value: {isSelected}',
339
+ ' [1:33]>[1:34](32,33)eQ: "',
340
+ ' isDirective: true',
341
+ ' isDynamicValue: true',
342
+ ' potentialName: class',
343
+ ],
344
+ [
345
+ '[1:35]>[1:62](34,61)class: class:focused="{isFocused}"',
346
+ ' [1:35]>[1:35](34,34)bN: ',
347
+ ' [1:35]>[1:48](34,47)name: class:focused',
348
+ ' [1:48]>[1:48](47,47)bE: ',
349
+ ' [1:48]>[1:49](47,48)equal: =',
350
+ ' [1:49]>[1:49](48,48)aE: ',
351
+ ' [1:49]>[1:50](48,49)sQ: "',
352
+ ' [1:50]>[1:61](49,60)value: {isFocused}',
353
+ ' [1:61]>[1:62](60,61)eQ: "',
354
+ ' isDirective: true',
355
+ ' isDynamicValue: true',
356
+ ' potentialName: class',
357
+ ],
358
+ ]);
359
+ });
360
+
361
+ test('shorthand', () => {
362
+ const r = parse('<el {items} />');
363
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
364
+ expect(attr).toStrictEqual([
365
+ [
366
+ '[1:5]>[1:12](4,11)items: {items}',
367
+ ' [1:5]>[1:5](4,4)bN: ',
368
+ ' [1:5]>[1:5](4,4)name: ',
369
+ ' [1:5]>[1:5](4,4)bE: ',
370
+ ' [1:5]>[1:5](4,4)equal: ',
371
+ ' [1:5]>[1:5](4,4)aE: ',
372
+ ' [1:5]>[1:6](4,5)sQ: {',
373
+ ' [1:6]>[1:11](5,10)value: items',
374
+ ' [1:11]>[1:12](10,11)eQ: }',
375
+ ' isDirective: false',
376
+ ' isDynamicValue: true',
377
+ ' potentialName: items',
378
+ ],
379
+ ]);
380
+ });
381
+
382
+ test('spread attributes', () => {
383
+ const r = parse('<el { ... attrs} />');
384
+ const attr = attributesToDebugMaps(r.nodeList[0].attributes);
385
+ expect(attr).toStrictEqual([]);
386
+ // @ts-ignore
387
+ expect(r.nodeList[0].hasSpreadAttr).toBeTruthy();
388
+ });
389
+
390
+ test('namespace', () => {
391
+ const doc = parse('<div><svg><text /></svg></div>');
392
+ expect(doc.nodeList[0].nodeName).toBe('div');
393
+ expect(doc.nodeList[0].namespace).toBe('http://www.w3.org/1999/xhtml');
394
+ expect(doc.nodeList[1].nodeName).toBe('svg');
395
+ expect(doc.nodeList[1].namespace).toBe('http://www.w3.org/2000/svg');
396
+ expect(doc.nodeList[2].nodeName).toBe('text');
397
+ expect(doc.nodeList[2].namespace).toBe('http://www.w3.org/2000/svg');
398
+ });
399
+ });
400
+
401
+ describe('Issues', () => {
402
+ test('#444', () => {
403
+ parse(`<script lang="ts">
404
+ let count= 0
405
+ const increment = () => {
406
+ count += 1
407
+ }
408
+ </script>
409
+
410
+ <button on:click={increment}>
411
+ Clicks: {count}
412
+ </button>`);
413
+ // No Error is success
414
+ });
415
+
416
+ test('#503', () => {
417
+ const r = parse(`<nav>
418
+ <ul>
419
+ <li>
420
+ <p>test</p>
421
+ <ul>
422
+ <li>
423
+ <p>test</p>
424
+ <ul>
425
+ <li>test</li>
426
+ </ul>
427
+ </li>
428
+ <li>test</li>
429
+ </ul>
430
+ </li>
431
+ </ul>
432
+ </nav>`);
433
+ const map = nodeListToDebugMaps(r.nodeList);
434
+ expect(map).toStrictEqual([
435
+ '[1:1]>[1:6](0,5)nav: <nav>',
436
+ '[1:6]>[2:2](5,7)#text: ⏎→',
437
+ '[2:2]>[2:6](7,11)ul: <ul>',
438
+ '[2:6]>[3:3](11,14)#text: ⏎→→',
439
+ '[3:3]>[3:7](14,18)li: <li>',
440
+ '[3:7]>[4:4](18,22)#text: ⏎→→→',
441
+ '[4:4]>[4:7](22,25)p: <p>',
442
+ '[4:7]>[4:11](25,29)#text: test',
443
+ '[4:11]>[4:15](29,33)p: </p>',
444
+ '[4:15]>[5:4](33,37)#text: ⏎→→→',
445
+ '[5:4]>[5:8](37,41)ul: <ul>',
446
+ '[5:8]>[6:5](41,46)#text: ⏎→→→→',
447
+ '[6:5]>[6:9](46,50)li: <li>',
448
+ '[6:9]>[7:6](50,56)#text: ⏎→→→→→',
449
+ '[7:6]>[7:9](56,59)p: <p>',
450
+ '[7:9]>[7:13](59,63)#text: test',
451
+ '[7:13]>[7:17](63,67)p: </p>',
452
+ '[7:17]>[8:6](67,73)#text: ⏎→→→→→',
453
+ '[8:6]>[8:10](73,77)ul: <ul>',
454
+ '[8:10]>[9:7](77,84)#text: ⏎→→→→→→',
455
+ '[9:7]>[9:11](84,88)li: <li>',
456
+ '[9:11]>[9:15](88,92)#text: test',
457
+ '[9:15]>[9:20](92,97)li: </li>',
458
+ '[9:20]>[10:6](97,103)#text: ⏎→→→→→',
459
+ '[10:6]>[10:11](103,108)ul: </ul>',
460
+ '[10:11]>[11:5](108,113)#text: ⏎→→→→',
461
+ '[11:5]>[11:10](113,118)li: </li>',
462
+ '[11:10]>[12:5](118,123)#text: ⏎→→→→',
463
+ '[12:5]>[12:9](123,127)li: <li>',
464
+ '[12:9]>[12:13](127,131)#text: test',
465
+ '[12:13]>[12:18](131,136)li: </li>',
466
+ '[12:18]>[13:4](136,140)#text: ⏎→→→',
467
+ '[13:4]>[13:9](140,145)ul: </ul>',
468
+ '[13:9]>[14:3](145,148)#text: ⏎→→',
469
+ '[14:3]>[14:8](148,153)li: </li>',
470
+ '[14:8]>[15:2](153,155)#text: ⏎→',
471
+ '[15:2]>[15:7](155,160)ul: </ul>',
472
+ '[15:7]>[16:1](160,161)#text: ⏎',
473
+ '[16:1]>[16:7](161,167)nav: </nav>',
474
+ ]);
475
+ });
476
+
477
+ test('#698', () => {
478
+ const r = parse(`<ul>
479
+ {#if cond === valueA}
480
+ <li>A</li>
481
+ {:else if cond === valueB}
482
+ <li>B</li>
483
+ {/if}
484
+ </ul>`);
485
+ const map = nodeListToDebugMaps(r.nodeList);
486
+ expect(map).toStrictEqual([
487
+ '[1:1]>[1:5](0,4)ul: <ul>',
488
+ '[1:5]>[2:2](4,6)#text: ⏎→',
489
+ '[2:2]>[3:3](6,30)IfBlock: {#if␣cond␣===␣valueA}⏎→→',
490
+ '[3:3]>[3:7](30,34)li: <li>',
491
+ '[3:7]>[3:8](34,35)#text: A',
492
+ '[3:8]>[3:13](35,40)li: </li>',
493
+ '[3:13]>[5:3](40,71)ElseIfBlock: ⏎→{:else␣if␣cond␣===␣valueB}⏎→→',
494
+ '[5:3]>[5:7](71,75)li: <li>',
495
+ '[5:7]>[5:8](75,76)#text: B',
496
+ '[5:8]>[5:13](76,81)li: </li>',
497
+ '[5:13]>[6:2](81,83)#text: ⏎→',
498
+ '[6:2]>[6:7](83,88)IfBlock: {/if}',
499
+ '[6:7]>[7:1](88,89)#text: ⏎',
500
+ '[7:1]>[7:6](89,94)ul: </ul>',
501
+ ]);
502
+
503
+ expect(r.nodeList[0].childNodes[4].raw).toBe('{/if}');
504
+ expect(r.nodeList[11].raw).toBe('{/if}');
505
+ expect(r.nodeList[0].childNodes[4].raw).toBe(r.nodeList[11].raw);
506
+ expect(r.nodeList[0].childNodes[4].uuid).toBe(r.nodeList[11].uuid);
507
+ });
508
+ });