1{ 2 "tests": [ 3 { 4 "expected": [ 5 "" 6 ], 7 "input": [ 8 [ 9 "StartTag", 10 "http://www.w3.org/1999/xhtml", 11 "head", 12 {} 13 ], 14 [ 15 "EndTag", 16 "http://www.w3.org/1999/xhtml", 17 "head" 18 ] 19 ], 20 "description": "no encoding", 21 "options": { 22 "inject_meta_charset": true 23 } 24 }, 25 { 26 "expected": [ 27 "<meta charset=utf-8>" 28 ], 29 "input": [ 30 [ 31 "StartTag", 32 "http://www.w3.org/1999/xhtml", 33 "head", 34 {} 35 ], 36 [ 37 "EndTag", 38 "http://www.w3.org/1999/xhtml", 39 "head" 40 ] 41 ], 42 "description": "empytag head", 43 "options": { 44 "encoding": "utf-8", 45 "inject_meta_charset": true 46 } 47 }, 48 { 49 "expected": [ 50 "<meta charset=utf-8><title>foo</title>" 51 ], 52 "input": [ 53 [ 54 "StartTag", 55 "http://www.w3.org/1999/xhtml", 56 "head", 57 {} 58 ], 59 [ 60 "StartTag", 61 "http://www.w3.org/1999/xhtml", 62 "title", 63 {} 64 ], 65 [ 66 "Characters", 67 "foo" 68 ], 69 [ 70 "EndTag", 71 "http://www.w3.org/1999/xhtml", 72 "title" 73 ], 74 [ 75 "EndTag", 76 "http://www.w3.org/1999/xhtml", 77 "head" 78 ] 79 ], 80 "description": "head w/title", 81 "options": { 82 "encoding": "utf-8", 83 "inject_meta_charset": true 84 } 85 }, 86 { 87 "expected": [ 88 "<meta charset=utf-8>" 89 ], 90 "input": [ 91 [ 92 "StartTag", 93 "http://www.w3.org/1999/xhtml", 94 "head", 95 {} 96 ], 97 [ 98 "EmptyTag", 99 "meta", 100 [ 101 { 102 "namespace": null, 103 "name": "charset", 104 "value": "ascii" 105 } 106 ] 107 ], 108 [ 109 "EndTag", 110 "http://www.w3.org/1999/xhtml", 111 "head" 112 ] 113 ], 114 "description": "head w/meta-charset", 115 "options": { 116 "encoding": "utf-8", 117 "inject_meta_charset": true 118 } 119 }, 120 { 121 "expected": [ 122 "<meta charset=utf-8><meta charset=utf-8>", 123 "<head><meta charset=utf-8><meta charset=ascii>" 124 ], 125 "input": [ 126 [ 127 "StartTag", 128 "http://www.w3.org/1999/xhtml", 129 "head", 130 {} 131 ], 132 [ 133 "EmptyTag", 134 "meta", 135 [ 136 { 137 "namespace": null, 138 "name": "charset", 139 "value": "ascii" 140 } 141 ] 142 ], 143 [ 144 "EmptyTag", 145 "meta", 146 [ 147 { 148 "namespace": null, 149 "name": "charset", 150 "value": "ascii" 151 } 152 ] 153 ], 154 [ 155 "EndTag", 156 "http://www.w3.org/1999/xhtml", 157 "head" 158 ] 159 ], 160 "description": "head w/ two meta-charset", 161 "options": { 162 "encoding": "utf-8", 163 "inject_meta_charset": true 164 } 165 }, 166 { 167 "expected": [ 168 "<meta charset=utf-8><meta content=noindex name=robots>" 169 ], 170 "input": [ 171 [ 172 "StartTag", 173 "http://www.w3.org/1999/xhtml", 174 "head", 175 {} 176 ], 177 [ 178 "EmptyTag", 179 "meta", 180 [ 181 { 182 "namespace": null, 183 "name": "name", 184 "value": "robots" 185 }, 186 { 187 "namespace": null, 188 "name": "content", 189 "value": "noindex" 190 } 191 ] 192 ], 193 [ 194 "EndTag", 195 "http://www.w3.org/1999/xhtml", 196 "head" 197 ] 198 ], 199 "description": "head w/robots", 200 "options": { 201 "encoding": "utf-8", 202 "inject_meta_charset": true 203 } 204 }, 205 { 206 "expected": [ 207 "<meta content=noindex name=robots><meta charset=utf-8>" 208 ], 209 "input": [ 210 [ 211 "StartTag", 212 "http://www.w3.org/1999/xhtml", 213 "head", 214 {} 215 ], 216 [ 217 "EmptyTag", 218 "meta", 219 [ 220 { 221 "namespace": null, 222 "name": "name", 223 "value": "robots" 224 }, 225 { 226 "namespace": null, 227 "name": "content", 228 "value": "noindex" 229 } 230 ] 231 ], 232 [ 233 "EmptyTag", 234 "meta", 235 [ 236 { 237 "namespace": null, 238 "name": "charset", 239 "value": "ascii" 240 } 241 ] 242 ], 243 [ 244 "EndTag", 245 "http://www.w3.org/1999/xhtml", 246 "head" 247 ] 248 ], 249 "description": "head w/robots & charset", 250 "options": { 251 "encoding": "utf-8", 252 "inject_meta_charset": true 253 } 254 }, 255 { 256 "expected": [ 257 "<meta content=\"text/html; charset=utf-8\" http-equiv=content-type>" 258 ], 259 "input": [ 260 [ 261 "StartTag", 262 "http://www.w3.org/1999/xhtml", 263 "head", 264 {} 265 ], 266 [ 267 "EmptyTag", 268 "meta", 269 [ 270 { 271 "namespace": null, 272 "name": "http-equiv", 273 "value": "content-type" 274 }, 275 { 276 "namespace": null, 277 "name": "content", 278 "value": "text/html; charset=ascii" 279 } 280 ] 281 ], 282 [ 283 "EndTag", 284 "http://www.w3.org/1999/xhtml", 285 "head" 286 ] 287 ], 288 "description": "head w/ charset in http-equiv content-type", 289 "options": { 290 "encoding": "utf-8", 291 "inject_meta_charset": true 292 } 293 }, 294 { 295 "expected": [ 296 "<meta content=noindex name=robots><meta content=\"text/html; charset=utf-8\" http-equiv=content-type>" 297 ], 298 "input": [ 299 [ 300 "StartTag", 301 "http://www.w3.org/1999/xhtml", 302 "head", 303 {} 304 ], 305 [ 306 "EmptyTag", 307 "meta", 308 [ 309 { 310 "namespace": null, 311 "name": "name", 312 "value": "robots" 313 }, 314 { 315 "namespace": null, 316 "name": "content", 317 "value": "noindex" 318 } 319 ] 320 ], 321 [ 322 "EmptyTag", 323 "meta", 324 [ 325 { 326 "namespace": null, 327 "name": "http-equiv", 328 "value": "content-type" 329 }, 330 { 331 "namespace": null, 332 "name": "content", 333 "value": "text/html; charset=ascii" 334 } 335 ] 336 ], 337 [ 338 "EndTag", 339 "http://www.w3.org/1999/xhtml", 340 "head" 341 ] 342 ], 343 "description": "head w/robots & charset in http-equiv content-type", 344 "options": { 345 "encoding": "utf-8", 346 "inject_meta_charset": true 347 } 348 } 349 ] 350}