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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 expect(node.nodes[1], isHRElement); | 171 expect(node.nodes[1], isHRElement); |
172 expect(node.nodes[2], isComment); | 172 expect(node.nodes[2], isComment); |
173 }); | 173 }); |
174 | 174 |
175 test('add', () { | 175 test('add', () { |
176 var node = makeNode(); | 176 var node = makeNode(); |
177 node.nodes.add(new Element.tag('hr')); | 177 node.nodes.add(new Element.tag('hr')); |
178 expect(node.nodes.last, isHRElement); | 178 expect(node.nodes.last, isHRElement); |
179 }); | 179 }); |
180 | 180 |
181 test('addLast', () { | |
182 var node = makeNode(); | |
183 node.nodes.addLast(new Element.tag('hr')); | |
184 expect(node.nodes.last, isHRElement); | |
185 }); | |
186 | |
187 test('iterator', () { | 181 test('iterator', () { |
188 var nodes = []; | 182 var nodes = []; |
189 var node = makeNodeWithChildren(); | 183 var node = makeNodeWithChildren(); |
190 for (var subnode in node.nodes) { | 184 for (var subnode in node.nodes) { |
191 nodes.add(subnode); | 185 nodes.add(subnode); |
192 } | 186 } |
193 expect(nodes[0], isText); | 187 expect(nodes[0], isText); |
194 expect(nodes[1], isBRElement); | 188 expect(nodes[1], isBRElement); |
195 expect(nodes[2], isComment); | 189 expect(nodes[2], isComment); |
196 }); | 190 }); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 }); | 270 }); |
277 | 271 |
278 test('sublist', () { | 272 test('sublist', () { |
279 var range = makeNodeList().sublist(1, 3); | 273 var range = makeNodeList().sublist(1, 3); |
280 expect(range, isNodeList); | 274 expect(range, isNodeList); |
281 expect(range[0], isBRElement); | 275 expect(range[0], isBRElement); |
282 expect(range[1], isComment); | 276 expect(range[1], isComment); |
283 }); | 277 }); |
284 }); | 278 }); |
285 } | 279 } |
OLD | NEW |