-
Notifications
You must be signed in to change notification settings - Fork 18
/
tests.json
683 lines (568 loc) · 16 KB
/
tests.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
{
"headers" : {
"an XHTML XML prolog" : {
"haml" : "!!! XML",
"html" : "<?xml version='1.0' encoding='utf-8' ?>",
"config" : {
"format" : "xhtml"
}
},
"an XHTML default (transitional) doctype" : {
"haml" : "!!!",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
"config" : {
"format" : "xhtml"
}
},
"an XHTML 1.1 doctype" : {
"haml" : "!!! 1.1",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">",
"config" : {
"format" : "xhtml"
}
},
"an XHTML 1.2 mobile doctype" : {
"haml" : "!!! mobile",
"html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">",
"config" : {
"format" : "xhtml"
}
},
"an XHTML 1.1 basic doctype" : {
"haml" : "!!! basic",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">",
"config" : {
"format" : "xhtml"
}
},
"an XHTML 1.0 frameset doctype" : {
"haml" : "!!! frameset",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">",
"config" : {
"format" : "xhtml"
}
},
"an HTML 5 doctype with XHTML syntax" : {
"haml" : "!!! 5",
"html" : "<!DOCTYPE html>",
"config" : {
"format" : "xhtml"
}
},
"an HTML 5 XML prolog (silent)" : {
"haml" : "!!! XML",
"html" : "",
"config" : {
"format" : "html5"
}
},
"an HTML 5 doctype" : {
"haml" : "!!!",
"html" : "<!DOCTYPE html>",
"config" : {
"format" : "html5"
}
},
"an HTML 4 XML prolog (silent)" : {
"haml" : "!!! XML",
"html" : "",
"config" : {
"format" : "html4"
}
},
"an HTML 4 default (transitional) doctype" : {
"haml" : "!!!",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"config" : {
"format" : "html4"
}
},
"an HTML 4 frameset doctype" : {
"haml" : "!!! frameset",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
"config" : {
"format" : "html4"
}
},
"an HTML 4 strict doctype" : {
"haml" : "!!! strict",
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">",
"config" : {
"format" : "html4"
}
}
},
"basic Haml tags and CSS": {
"a simple Haml tag" : {
"haml" : "%p",
"html" : "<p></p>"
},
"a self-closing tag (XHTML)" : {
"haml" : "%meta",
"html" : "<meta />",
"config" : {
"format" : "xhtml"
}
},
"a self-closing tag (HTML4)" : {
"haml" : "%meta",
"html" : "<meta>",
"config" : {
"format" : "html4"
}
},
"a self-closing tag (HTML5)" : {
"haml" : "%meta",
"html" : "<meta>",
"config" : {
"format" : "html5"
}
},
"a self-closing tag ('/' modifier + XHTML)" : {
"haml" : "%zzz/",
"html" : "<zzz />",
"config" : {
"format" : "xhtml"
}
},
"a self-closing tag ('/' modifier + HTML5)" : {
"haml" : "%zzz/",
"html" : "<zzz>",
"config" : {
"format" : "html5"
}
},
"a tag with a CSS class" : {
"haml" : "%p.class1",
"html" : "<p class='class1'></p>"
},
"a tag with multiple CSS classes" : {
"haml" : "%p.class1.class2",
"html" : "<p class='class1 class2'></p>"
},
"a tag with a CSS id" : {
"haml" : "%p#id1",
"html" : "<p id='id1'></p>"
},
"a tag with multiple CSS id's" : {
"haml" : "%p#id1#id2",
"html" : "<p id='id2'></p>"
},
"a tag with a class followed by an id" : {
"haml" : "%p.class1#id1",
"html" : "<p class='class1' id='id1'></p>"
},
"a tag with an id followed by a class" : {
"haml" : "%p#id1.class1",
"html" : "<p class='class1' id='id1'></p>"
},
"an implicit div with a CSS id" : {
"haml" : "#id1",
"html" : "<div id='id1'></div>"
},
"an implicit div with a CSS class" : {
"haml" : ".class1",
"html" : "<div class='class1'></div>"
},
"multiple simple Haml tags" : {
"haml" : "%div\n %div\n %p",
"html" : "<div>\n<div>\n<p></p>\n</div>\n</div>"
}
},
"tags with unusual HTML characters" : {
"a tag with colons" : {
"haml" : "%ns:tag",
"html" : "<ns:tag></ns:tag>"
},
"a tag with underscores" : {
"haml" : "%snake_case",
"html" : "<snake_case></snake_case>"
},
"a tag with dashes" : {
"haml" : "%dashed-tag",
"html" : "<dashed-tag></dashed-tag>"
},
"a tag with camelCase" : {
"haml" : "%camelCase",
"html" : "<camelCase></camelCase>"
},
"a tag with PascalCase" : {
"haml" : "%PascalCase",
"html" : "<PascalCase></PascalCase>"
}
},
"tags with unusual CSS identifiers" : {
"an all-numeric class" : {
"haml" : ".123",
"html" : "<div class='123'></div>"
},
"a class with underscores" : {
"haml" : ".__",
"html" : "<div class='__'></div>"
},
"a class with dashes" : {
"haml" : ".--",
"html" : "<div class='--'></div>"
},
"a class with escaped unsupported characters like / and '\\'": {
"haml" : ".h\/c\\",
"html" : "<div class='h\/c\\'></div>"
}
},
"tags with inline content" : {
"Inline content simple tag" : {
"haml" : "%p hello",
"html" : "<p>hello</p>"
},
"Inline content tag with CSS" : {
"haml" : "%p.class1 hello",
"html" : "<p class='class1'>hello</p>"
},
"Inline content multiple simple tags" : {
"haml" : "%div\n %div\n %p text",
"html" : "<div>\n<div>\n<p>text</p>\n</div>\n</div>"
}
},
"tags with nested content" : {
"Nested content simple tag" : {
"haml" : "%p\n hello",
"html" : "<p>\nhello\n</p>"
},
"Nested content tag with CSS" : {
"haml" : "%p.class1\n hello",
"html" : "<p class='class1'>\nhello\n</p>"
},
"Nested content multiple simple tags" : {
"haml" : "%div\n %div\n %p\n text",
"html" : "<div>\n<div>\n<p>\ntext\n</p>\n</div>\n</div>"
}
},
"tags with HTML-style attributes": {
"HTML-style one attribute" : {
"haml" : "%p(a='b')",
"html" : "<p a='b'></p>"
},
"HTML-style multiple attributes" : {
"haml" : "%p(a='b' c='d')",
"html" : "<p a='b' c='d'></p>"
},
"HTML-style attributes separated with newlines" : {
"haml" : "%p(a='b'\n c='d')",
"html" : "<p a='b' c='d'></p>"
},
"HTML-style interpolated attribute" : {
"haml" : "%p(a=\"#{var}\")",
"html" : "<p a='value'></p>",
"locals" : {
"var" : "value"
}
},
"HTML-style 'class' as an attribute" : {
"haml" : "%p(class='class1')",
"html" : "<p class='class1'></p>"
},
"HTML-style tag with a CSS class and 'class' as an attribute" : {
"haml" : "%p.class2(class='class1')",
"html" : "<p class='class2 class1'></p>"
},
"HTML-style tag with 'id' as an attribute" : {
"haml" : "%p(id='1')",
"html" : "<p id='1'></p>"
},
"HTML-style tag with a CSS id and 'id' as an attribute" : {
"haml" : "%p#id(id='1')",
"html" : "<p id='id_1'></p>"
},
"HTML-style tag with a variable attribute" : {
"haml" : "%p(class=var)",
"html" : "<p class='hello'></p>",
"locals" : {
"var" : "hello"
}
},
"HTML-style tag with a CSS class and 'class' as a variable attribute" : {
"haml" : ".hello(class=var)",
"html" : "<div class='hello world'></div>",
"locals" : {
"var" : "world"
}
},
"HTML-style tag multiple CSS classes" : {
"haml" : ".z(class=var)",
"html" : "<div class='z a'></div>",
"locals" : {
"var" : "a"
}
},
"HTML-style tag with an atomic attribute" : {
"haml" : "%a(flag)",
"html" : "<a flag></a>"
}
},
"tags with Ruby-style attributes": {
"Ruby-style one attribute" : {
"haml" : "%p{:a => 'b'}",
"html" : "<p a='b'></p>",
"optional" : true
},
"Ruby-style attributes hash with whitespace" : {
"haml" : "%p{ :a => 'b' }",
"html" : "<p a='b'></p>",
"optional" : true
},
"Ruby-style interpolated attribute" : {
"haml" : "%p{:a =>\"#{var}\"}",
"html" : "<p a='value'></p>",
"optional" : true,
"locals" : {
"var" : "value"
}
},
"Ruby-style multiple attributes" : {
"haml" : "%p{ :a => 'b', 'c' => 'd' }",
"html" : "<p a='b' c='d'></p>",
"optional" : true
},
"Ruby-style attributes separated with newlines" : {
"haml" : "%p{ :a => 'b',\n 'c' => 'd' }",
"html" : "<p a='b' c='d'></p>",
"optional" : true
},
"Ruby-style 'class' as an attribute" : {
"haml" : "%p{:class => 'class1'}",
"html" : "<p class='class1'></p>",
"optional" : true
},
"Ruby-style tag with a CSS class and 'class' as an attribute" : {
"haml" : "%p.class2{:class => 'class1'}",
"html" : "<p class='class2 class1'></p>",
"optional" : true
},
"Ruby-style tag with 'id' as an attribute" : {
"haml" : "%p{:id => '1'}",
"html" : "<p id='1'></p>",
"optional" : true
},
"Ruby-style tag with a CSS id and 'id' as an attribute" : {
"haml" : "%p#id{:id => '1'}",
"html" : "<p id='id_1'></p>",
"optional" : true
},
"Ruby-style tag with a CSS id and a numeric 'id' as an attribute" : {
"haml" : "%p#id{:id => 1}",
"html" : "<p id='id_1'></p>",
"optional" : true
},
"Ruby-style tag with a variable attribute" : {
"haml" : "%p{:class => var}",
"html" : "<p class='hello'></p>",
"optional" : true,
"locals" : {
"var" : "hello"
}
},
"Ruby-style tag with a CSS class and 'class' as a variable attribute" : {
"haml" : ".hello{:class => var}",
"html" : "<div class='hello world'></div>",
"optional" : true,
"locals" : {
"var" : "world"
}
},
"Ruby-style tag multiple CSS classes" : {
"haml" : ".z{:class => var}",
"html" : "<div class='z a'></div>",
"optional" : true,
"locals" : {
"var" : "a"
}
}
},
"tags with multiple types of classes": {
"HTML-style class and Ruby-style class": {
"haml": "%div{class: 'hash'}(class='html')",
"html": "<div class='html hash'></div>",
"optional": true
},
"Three types of multiple classes come out in correct order": {
"haml": ".foo.moo{:class => ['bar', 'alpha']}(class='baz')",
"html": "<div class='foo moo baz bar alpha'></div>",
"optional": true
}
},
"silent comments" : {
"an inline silent comment" : {
"haml" : "-# hello",
"html" : ""
},
"a nested silent comment" : {
"haml" : "-#\n hello",
"html" : ""
},
"a multiply nested silent comment" : {
"haml" : "-#\n %div\n foo",
"html" : ""
},
"a multiply nested silent comment with inconsistent indents" : {
"haml" : "-#\n %div\n foo",
"html" : ""
}
},
"markup comments" : {
"an inline markup comment" : {
"haml" : "/ comment",
"html" : "<!-- comment -->"
},
"a nested markup comment" : {
"haml" : "/\n comment\n comment2",
"html" : "<!--\ncomment\ncomment2\n-->"
}
},
"conditional comments": {
"a conditional comment" : {
"haml" : "/[if IE]\n %p a",
"html" : "<!--[if IE]>\n<p>a</p>\n<![endif]-->"
}
},
"internal filters": {
"content in an 'escaped' filter" : {
"haml" : ":escaped\n <&\">",
"html" : "<&">"
},
"content in a 'preserve' filter" : {
"haml" : ":preserve\n hello\n\n%p",
"html" : "hello
\n<p></p>"
},
"content in a 'plain' filter" : {
"haml" : ":plain\n hello\n\n%p",
"html" : "hello\n<p></p>"
},
"content in a 'css' filter (XHTML)" : {
"haml" : ":css\n hello\n\n%p",
"html" : "<style type='text/css'>\n /*<![CDATA[*/\n hello\n /*]]>*/\n</style>\n<p></p>",
"config" : {
"format" : "xhtml"
}
},
"content in a 'javascript' filter (XHTML)" : {
"haml" : ":javascript\n a();\n%p",
"html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>",
"config" : {
"format" : "xhtml"
}
},
"content in a 'css' filter (HTML)" : {
"haml" : ":css\n hello\n\n%p",
"html" : "<style>\n hello\n</style>\n<p></p>",
"config" : {
"format" : "html5"
}
},
"content in a 'javascript' filter (HTML)" : {
"haml" : ":javascript\n a();\n%p",
"html" : "<script>\n a();\n</script>\n<p></p>",
"config" : {
"format" : "html5"
}
}
},
"Ruby-style interpolation": {
"interpolation inside inline content" : {
"haml" : "%p #{var}",
"html" : "<p>value</p>",
"optional" : true,
"locals" : {
"var" : "value"
}
},
"no interpolation when escaped" : {
"haml" : "%p \\#{var}",
"html" : "<p>#{var}</p>",
"optional" : true,
"locals" : {
"var" : "value"
}
},
"interpolation when the escape character is escaped" : {
"haml" : "%p \\\\#{var}",
"html" : "<p>\\value</p>",
"optional" : true,
"locals" : {
"var" : "value"
}
},
"interpolation inside filtered content" : {
"haml" : ":plain\n #{var} interpolated: #{var}",
"html" : "value interpolated: value",
"optional" : true,
"locals" : {
"var" : "value"
}
}
},
"HTML escaping" : {
"code following '&='" : {
"haml" : "&= '<\"&>'",
"html" : "<"&>"
},
"code following '=' when escape_haml is set to true" : {
"haml" : "= '<\"&>'",
"html" : "<"&>",
"config" : {
"escape_html" : "true"
}
},
"code following '!=' when escape_haml is set to true" : {
"haml" : "!= '<\"&>'",
"html" : "<\"&>",
"config" : {
"escape_html" : "true"
}
}
},
"boolean attributes" : {
"boolean attribute with XHTML" : {
"haml" : "%input(checked=true)",
"html" : "<input checked='checked' />",
"config" : {
"format" : "xhtml"
}
},
"boolean attribute with HTML" : {
"haml" : "%input(checked=true)",
"html" : "<input checked>",
"config" : {
"format" : "html5"
}
}
},
"whitespace preservation" : {
"following the '~' operator" : {
"haml" : "~ \"Foo\\n<pre>Bar\\nBaz</pre>\"",
"html" : "Foo\n<pre>Bar
Baz</pre>",
"optional" : true
},
"inside a textarea tag" : {
"haml" : "%textarea\n hello\n hello",
"html" : "<textarea>hello\nhello</textarea>"
},
"inside a pre tag" : {
"haml" : "%pre\n hello\n hello",
"html" : "<pre>hello\nhello</pre>"
}
},
"whitespace removal" : {
"a tag with '>' appended and inline content" : {
"haml" : "%li hello\n%li> world\n%li again",
"html" : "<li>hello</li><li>world</li><li>again</li>"
},
"a tag with '>' appended and nested content" : {
"haml" : "%li hello\n%li>\n world\n%li again",
"html" : "<li>hello</li><li>\nworld\n</li><li>again</li>"
},
"a tag with '<' appended" : {
"haml" : "%p<\n hello\n world",
"html" : "<p>hello\nworld</p>"
}
}
}