aboutsummaryrefslogtreecommitdiff
path: root/tests/html5lib-tests/serializer/injectmeta.test
blob: feaaa44f839a7bcb77c9d41b0da683b099671a2a (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
61
62
63
64
65
66
{"tests": [

{"description": "no encoding",
 "options": {"inject_meta_charset": true},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": [""],
 "xhtml": ["<head></head>"]
},

{"description": "empytag head",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta charset=utf-8>"],
 "xhtml":    ["<head><meta charset=\"utf-8\" /></head>"]
},

{"description": "head w/title",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["StartTag", "http://www.w3.org/1999/xhtml","title",{}], ["Characters", "foo"],["EndTag", "http://www.w3.org/1999/xhtml", "title"], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta charset=utf-8><title>foo</title>"],
 "xhtml":    ["<head><meta charset=\"utf-8\" /><title>foo</title></head>"]
},

{"description": "head w/meta-charset",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "charset", "value": "ascii"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta charset=utf-8>"],
 "xhtml":    ["<head><meta charset=\"utf-8\" /></head>"]
},

{"description": "head w/ two meta-charset",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "charset", "value": "ascii"}]], ["EmptyTag","meta",[{"namespace": null, "name": "charset", "value": "ascii"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta charset=utf-8><meta charset=utf-8>", "<head><meta charset=utf-8><meta charset=ascii>"],
 "xhtml": ["<head><meta charset=\"utf-8\" /><meta charset=\"utf-8\" /></head>", "<head><meta charset=\"utf-8\" /><meta charset=\"ascii\" /></head>"]
},

{"description": "head w/robots",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "name", "value": "robots"},{"namespace": null, "name": "content", "value": "noindex"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta charset=utf-8><meta content=noindex name=robots>"],
 "xhtml":    ["<head><meta charset=\"utf-8\" /><meta content=\"noindex\" name=\"robots\" /></head>"]
},

{"description": "head w/robots & charset",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "name", "value": "robots"},{"namespace": null, "name": "content", "value": "noindex"}]], ["EmptyTag","meta",[{"namespace": null, "name": "charset", "value": "ascii"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta content=noindex name=robots><meta charset=utf-8>"],
 "xhtml":    ["<head><meta content=\"noindex\" name=\"robots\" /><meta charset=\"utf-8\" /></head>"]
},

{"description": "head w/ charset in http-equiv content-type",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "http-equiv", "value": "content-type"}, {"namespace": null, "name": "content", "value": "text/html; charset=ascii"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"],
 "xhtml":    ["<head><meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\" /></head>"]
},

{"description": "head w/robots & charset in http-equiv content-type",
 "options": {"inject_meta_charset": true, "encoding":"utf-8"},
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "head", {}], ["EmptyTag","meta",[{"namespace": null, "name": "name", "value": "robots"},{"namespace": null, "name": "content", "value": "noindex"}]], ["EmptyTag","meta",[{"namespace": null, "name": "http-equiv", "value": "content-type"}, {"namespace": null, "name": "content", "value": "text/html; charset=ascii"}]], ["EndTag", "http://www.w3.org/1999/xhtml", "head"]],
 "expected": ["<meta content=noindex name=robots><meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"],
 "xhtml": ["<head><meta content=\"noindex\" name=\"robots\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\" /></head>"]
}

]}