| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }); | 99 }); |
| 100 | 100 |
| 101 group('nodes', () { | 101 group('nodes', () { |
| 102 test('is a NodeList', () { | 102 test('is a NodeList', () { |
| 103 expect(makeNodeWithChildren().nodes, isNodeList); | 103 expect(makeNodeWithChildren().nodes, isNodeList); |
| 104 }); | 104 }); |
| 105 | 105 |
| 106 test('first', () { | 106 test('first', () { |
| 107 var node = makeNodeWithChildren(); | 107 var node = makeNodeWithChildren(); |
| 108 expect(node.nodes.first, isText); | 108 expect(node.nodes.first, isText); |
| 109 |
| 110 node = new DivElement(); |
| 111 expect(() { |
| 112 node = node.nodes.first; |
| 113 }, throwsStateError); |
| 109 }); | 114 }); |
| 110 | 115 |
| 111 test('last', () { | 116 test('last', () { |
| 112 var node = makeNodeWithChildren(); | 117 var node = makeNodeWithChildren(); |
| 113 expect(node.nodes.last, isComment); | 118 expect(node.nodes.last, isComment); |
| 114 }); | 119 }); |
| 115 | 120 |
| 116 test('forEach', () { | 121 test('forEach', () { |
| 117 var nodes = []; | 122 var nodes = []; |
| 118 var node = makeNodeWithChildren(); | 123 var node = makeNodeWithChildren(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 }); | 264 }); |
| 260 | 265 |
| 261 test('getRange', () { | 266 test('getRange', () { |
| 262 var range = makeNodeList().getRange(1, 2); | 267 var range = makeNodeList().getRange(1, 2); |
| 263 expect(range, isNodeList); | 268 expect(range, isNodeList); |
| 264 expect(range[0], isBRElement); | 269 expect(range[0], isBRElement); |
| 265 expect(range[1], isComment); | 270 expect(range[1], isComment); |
| 266 }); | 271 }); |
| 267 }); | 272 }); |
| 268 } | 273 } |
| OLD | NEW |