aboutsummaryrefslogtreecommitdiff
path: root/tests/html5lib-tests/serializer/options.test
blob: 6f342dd3f73ea09f79de530058b01d0e7f324d48 (plain)
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
{"tests":[

{"description": "quote_char=\"'\"",
 "options": {"quote_char": "'"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "test 'with' quote_char"}]]],
 "expected": ["<span title='test &#39;with&#39; quote_char'>"]
},

{"description": "quote_attr_values=true",
 "options": {"quote_attr_values": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "button", [{"namespace": null, "name": "disabled", "value" :"disabled"}]]],
 "expected": ["<button disabled>"],
 "xhtml":    ["<button disabled=\"disabled\">"]
},

{"description": "quote_attr_values=true with irrelevant",
 "options": {"quote_attr_values": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "div", [{"namespace": null, "name": "irrelevant", "value" :"irrelevant"}]]],
 "expected": ["<div irrelevant>"],
 "xhtml":    ["<div irrelevant=\"irrelevant\">"]
},

{"description": "use_trailing_solidus=true with void element",
 "options": {"use_trailing_solidus": true},
 "input": [["EmptyTag", "img", {}]],
 "expected": ["<img />"]
},

{"description": "use_trailing_solidus=true with non-void element",
 "options": {"use_trailing_solidus": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "div", {}]],
 "expected": ["<div>"]
},

{"description": "minimize_boolean_attributes=false",
 "options": {"minimize_boolean_attributes": false},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "div", [{"namespace": null, "name": "irrelevant", "value" :"irrelevant"}]]],
 "expected": ["<div irrelevant=irrelevant>"],
 "xhtml":    ["<div irrelevant=\"irrelevant\">"]
},

{"description": "minimize_boolean_attributes=false with empty value",
 "options": {"minimize_boolean_attributes": false},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "div", [{"namespace": null, "name": "irrelevant", "value" :""}]]],
 "expected": ["<div irrelevant=\"\">"]
},

{"description": "escape less than signs in attribute values",
 "options": {"escape_lt_in_attrs": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "a", [{"namespace": null, "name": "title", "value": "a<b>c&d"}]]],
 "expected": ["<a title=\"a&lt;b>c&amp;d\">"]
},

{"description": "rcdata",
 "options": {"escape_rcdata": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "script", {}], ["Characters", "a<b>c&d"]],
 "expected": ["<script>a&lt;b&gt;c&amp;d"]
}

]}