OLD | NEW |
1 /** Additional feature tests that aren't based on test data. */ | 1 /** Additional feature tests that aren't based on test data. */ |
2 library parser_test; | 2 library parser_test; |
3 | 3 |
4 import 'dart:io'; | 4 import 'dart:io'; |
5 import 'package:unittest/unittest.dart'; | 5 import 'package:unittest/unittest.dart'; |
6 import 'package:unittest/vm_config.dart'; | 6 import 'package:unittest/vm_config.dart'; |
7 import 'package:html5lib/dom.dart'; | 7 import 'package:html5lib/dom.dart'; |
8 import 'package:html5lib/parser.dart'; | 8 import 'package:html5lib/parser.dart'; |
9 import 'package:html5lib/parser_console.dart' as parser_console; | 9 import 'package:html5lib/parser_console.dart' as parser_console; |
10 import 'package:html5lib/src/constants.dart'; | 10 import 'package:html5lib/src/constants.dart'; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Note: this is a nonsensical example, but it triggers the behavior | 158 // Note: this is a nonsensical example, but it triggers the behavior |
159 // we're looking for with attribute names in foreign content. | 159 // we're looking for with attribute names in foreign content. |
160 var doc = parse(''' | 160 var doc = parse(''' |
161 <body> | 161 <body> |
162 <svg> | 162 <svg> |
163 <desc xlink:type="simple" | 163 <desc xlink:type="simple" |
164 xlink:href="http://example.com/logo.png" | 164 xlink:href="http://example.com/logo.png" |
165 xlink:show="new"></desc> | 165 xlink:show="new"></desc> |
166 '''); | 166 '''); |
167 var n = doc.query('desc'); | 167 var n = doc.query('desc'); |
168 var keys = n.attributes.getKeys(); | 168 var keys = n.attributes.keys; |
169 expect(keys[0] is AttributeName); | 169 expect(keys[0] is AttributeName); |
170 expect(keys[0].prefix, equals('xlink')); | 170 expect(keys[0].prefix, equals('xlink')); |
171 expect(keys[0].namespace, equals('http://www.w3.org/1999/xlink')); | 171 expect(keys[0].namespace, equals('http://www.w3.org/1999/xlink')); |
172 expect(keys[0].name, equals('type')); | 172 expect(keys[0].name, equals('type')); |
173 | 173 |
174 expect(n.outerHTML, equals('<desc xlink:type="simple" ' | 174 expect(n.outerHTML, equals('<desc xlink:type="simple" ' |
175 'xlink:href="http://example.com/logo.png" xlink:show="new"></desc>')); | 175 'xlink:href="http://example.com/logo.png" xlink:show="new"></desc>')); |
176 }); | 176 }); |
177 }); | 177 }); |
178 | 178 |
179 test('dart:io', () { | 179 test('dart:io', () { |
180 // ensure IO support is unregistered | 180 // ensure IO support is unregistered |
181 expect(inputstream.consoleSupport, | 181 expect(inputstream.consoleSupport, |
182 new isInstanceOf<inputstream.ConsoleSupport>()); | 182 new isInstanceOf<inputstream.ConsoleSupport>()); |
183 var file = new File('test/data/parser_feature/raw_file.html').openSync(); | 183 var file = new File('test/data/parser_feature/raw_file.html').openSync(); |
184 expect(() => parse(file), throwsA(new isInstanceOf<ArgumentError>())); | 184 expect(() => parse(file), throwsA(new isInstanceOf<ArgumentError>())); |
185 parser_console.useConsole(); | 185 parser_console.useConsole(); |
186 expect(parse(file).body.innerHTML.trim(), equals('Hello world!')); | 186 expect(parse(file).body.innerHTML.trim(), equals('Hello world!')); |
187 }); | 187 }); |
188 } | 188 } |
OLD | NEW |