OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library NodeTest; | |
6 import 'package:unittest/unittest.dart'; | |
7 import 'package:unittest/html_individual_config.dart'; | |
8 import 'dart:html'; | 5 import 'dart:html'; |
9 import 'dart:svg' as svg; | 6 import 'dart:svg' as svg; |
10 | 7 |
| 8 import 'package:expect/minitest.dart'; |
| 9 |
11 Node makeNode() => new Element.tag('div'); | 10 Node makeNode() => new Element.tag('div'); |
12 Node makeNodeWithChildren() => | 11 Element makeNodeWithChildren() => |
13 new Element.html("<div>Foo<br/><!--baz--></div>"); | 12 new Element.html("<div>Foo<br/><!--baz--></div>"); |
14 | 13 |
15 void testUnsupported(String name, void f()) { | 14 void testUnsupported(String name, void f()) { |
16 test(name, () { | 15 test(name, () { |
17 expect(f, throwsUnsupportedError); | 16 expect(f, throwsUnsupportedError); |
18 }); | 17 }); |
19 } | 18 } |
20 | 19 |
21 main() { | 20 main() { |
22 useHtmlIndividualConfiguration(); | |
23 | |
24 var isText = predicate((x) => x is Text, 'is a Text'); | 21 var isText = predicate((x) => x is Text, 'is a Text'); |
25 var isComment = predicate((x) => x is Comment, 'is a Comment'); | 22 var isComment = predicate((x) => x is Comment, 'is a Comment'); |
26 var isBRElement = predicate((x) => x is BRElement, 'is a BRElement'); | 23 var isBRElement = predicate((x) => x is BRElement, 'is a BRElement'); |
27 var isHRElement = predicate((x) => x is HRElement, 'is a HRElement'); | 24 var isHRElement = predicate((x) => x is HRElement, 'is a HRElement'); |
28 var isNodeList = predicate((x) => x is List<Node>, 'is a List<Node>'); | 25 var isNodeList = predicate((x) => x is List<Node>, 'is a List<Node>'); |
29 var isImageElement = | 26 var isImageElement = |
30 predicate((x) => x is ImageElement, 'is an ImageElement'); | 27 predicate((x) => x is ImageElement, 'is an ImageElement'); |
31 var isInputElement = | 28 var isInputElement = |
32 predicate((x) => x is InputElement, 'is an InputElement'); | 29 predicate((x) => x is InputElement, 'is an InputElement'); |
33 | 30 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 }); | 348 }); |
352 | 349 |
353 test('TreeWalker', () { | 350 test('TreeWalker', () { |
354 var root = makeNodeWithChildren(); | 351 var root = makeNodeWithChildren(); |
355 var treeWalker = new TreeWalker(root, NodeFilter.SHOW_COMMENT); | 352 var treeWalker = new TreeWalker(root, NodeFilter.SHOW_COMMENT); |
356 expect(treeWalker.nextNode(), isComment); | 353 expect(treeWalker.nextNode(), isComment); |
357 expect(treeWalker.nextNode(), isNull); | 354 expect(treeWalker.nextNode(), isNull); |
358 }); | 355 }); |
359 }); | 356 }); |
360 } | 357 } |
OLD | NEW |