| 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; | 5 library NodeTest; |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
| 7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:svg' as svg; | 9 import 'dart:svg' as svg; |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 expect(node.nodes[7], isInputElement); | 111 expect(node.nodes[7], isInputElement); |
| 112 expect(node.nodes[8], isComment); | 112 expect(node.nodes[8], isComment); |
| 113 }); | 113 }); |
| 114 }); | 114 }); |
| 115 | 115 |
| 116 group('nodes', () { | 116 group('nodes', () { |
| 117 test('is a NodeList', () { | 117 test('is a NodeList', () { |
| 118 expect(makeNodeWithChildren().nodes, isNodeList); | 118 expect(makeNodeWithChildren().nodes, isNodeList); |
| 119 }); | 119 }); |
| 120 | 120 |
| 121 test('indexer', () { |
| 122 var node = new DivElement(); |
| 123 expect(() { |
| 124 node.nodes[0]; |
| 125 }, throwsRangeError); |
| 126 |
| 127 expect(() { |
| 128 node.nodes[-1]; |
| 129 }, throwsRangeError); |
| 130 }); |
| 131 |
| 121 test('first', () { | 132 test('first', () { |
| 122 var node = makeNodeWithChildren(); | 133 var node = makeNodeWithChildren(); |
| 123 expect(node.nodes.first, isText); | 134 expect(node.nodes.first, isText); |
| 124 | 135 |
| 125 node = new DivElement(); | 136 node = new DivElement(); |
| 126 expect(() { | 137 expect(() { |
| 127 node = node.nodes.first; | 138 node = node.nodes.first; |
| 128 }, throwsStateError); | 139 }, throwsStateError); |
| 129 }); | 140 }); |
| 130 | 141 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 }); | 368 }); |
| 358 | 369 |
| 359 test('TreeWalker', () { | 370 test('TreeWalker', () { |
| 360 var root = makeNodeWithChildren(); | 371 var root = makeNodeWithChildren(); |
| 361 var treeWalker = new TreeWalker(root, NodeFilter.SHOW_COMMENT); | 372 var treeWalker = new TreeWalker(root, NodeFilter.SHOW_COMMENT); |
| 362 expect(treeWalker.nextNode(), isComment); | 373 expect(treeWalker.nextNode(), isComment); |
| 363 expect(treeWalker.nextNode(), isNull); | 374 expect(treeWalker.nextNode(), isNull); |
| 364 }); | 375 }); |
| 365 }); | 376 }); |
| 366 } | 377 } |
| OLD | NEW |