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 dom_test; | 2 library dom_test; |
3 | 3 |
4 import 'package:unittest/unittest.dart'; | 4 import 'package:unittest/unittest.dart'; |
5 import 'package:html5lib/parser.dart'; | 5 import 'package:html5lib/parser.dart'; |
6 import 'package:html5lib/dom.dart'; | 6 import 'package:html5lib/dom.dart'; |
7 | 7 |
8 main() { | 8 main() { |
9 group('Node.query type selectors', () { | 9 group('Node.querySelector type selectors', () { |
10 test('x-foo', () { | 10 test('x-foo', () { |
11 expect(parse('<x-foo>').body.query('x-foo'), isNotNull); | 11 expect(parse('<x-foo>').body.querySelector('x-foo'), isNotNull); |
12 }); | 12 }); |
13 | 13 |
14 test('-x-foo', () { | 14 test('-x-foo', () { |
15 var doc = parse('<body><-x-foo>'); | 15 var doc = parse('<body><-x-foo>'); |
16 expect(doc.body.outerHtml, equals('<body><-x-foo></body>')); | 16 expect(doc.body.outerHtml, equals('<body><-x-foo></body>')); |
17 expect(doc.body.query('-x-foo'), isNull); | 17 expect(doc.body.querySelector('-x-foo'), isNull); |
18 }); | 18 }); |
19 | 19 |
20 test('foo123', () { | 20 test('foo123', () { |
21 expect(parse('<foo123>').body.query('foo123'), isNotNull); | 21 expect(parse('<foo123>').body.querySelector('foo123'), isNotNull); |
22 }); | 22 }); |
23 | 23 |
24 test('123 - invalid', () { | 24 test('123 - invalid', () { |
25 var doc = parse('<123>'); | 25 var doc = parse('<123>'); |
26 expect(() => doc.body.query('123'), throwsUnimplementedError); | 26 expect(() => doc.body.querySelector('123'), throwsUnimplementedError); |
27 }); | 27 }); |
28 | 28 |
29 test('x\\ny - not implemented', () { | 29 test('x\\ny - not implemented', () { |
30 var doc = parse('<x\\ny>'); | 30 var doc = parse('<x\\ny>'); |
31 expect(() => doc.body.query('x\\ny'), throwsUnimplementedError); | 31 expect(() => doc.body.querySelector('x\\ny'), throwsUnimplementedError); |
32 }); | 32 }); |
33 }); | 33 }); |
34 } | 34 } |
OLD | NEW |