| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 new Element.tag('hr'), | 152 new Element.tag('hr'), |
| 153 new Element.tag('img'), | 153 new Element.tag('img'), |
| 154 new Element.tag('input') | 154 new Element.tag('input') |
| 155 ]); | 155 ]); |
| 156 expect(node.nodes[0], isText); | 156 expect(node.nodes[0], isText); |
| 157 expect(node.nodes[1], isBRElement); | 157 expect(node.nodes[1], isBRElement); |
| 158 expect(node.nodes[2], isComment); | 158 expect(node.nodes[2], isComment); |
| 159 expect(node.nodes[3], isHRElement); | 159 expect(node.nodes[3], isHRElement); |
| 160 expect(node.nodes[4], isImageElement); | 160 expect(node.nodes[4], isImageElement); |
| 161 expect(node.nodes[5], isInputElement); | 161 expect(node.nodes[5], isInputElement); |
| 162 |
| 163 var a = makeNodeWithChildren(); |
| 164 var b = makeNodeWithChildren(); |
| 165 var childrenLength = a.children.length + b.children.length; |
| 166 var nodesLength = a.nodes.length + b.nodes.length; |
| 167 |
| 168 a.children.addAll(b.children); |
| 169 expect(b.children.length, 0); |
| 170 expect(a.children.length, childrenLength); |
| 171 |
| 172 b.nodes.addAll(a.children); |
| 173 expect(a.children.length, 0); |
| 174 expect(b.children.length, childrenLength); |
| 175 |
| 176 a.nodes.addAll(b.nodes); |
| 177 expect(b.nodes.length, 0); |
| 178 expect(a.nodes.length, nodesLength); |
| 162 }); | 179 }); |
| 163 | 180 |
| 164 test('clear', () { | 181 test('clear', () { |
| 165 var node = makeNodeWithChildren(); | 182 var node = makeNodeWithChildren(); |
| 166 node.nodes.clear(); | 183 node.nodes.clear(); |
| 167 expect(node.nodes, []); | 184 expect(node.nodes, []); |
| 168 }); | 185 }); |
| 169 | 186 |
| 170 test('removeLast', () { | 187 test('removeLast', () { |
| 171 var node = makeNodeWithChildren(); | 188 var node = makeNodeWithChildren(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 198 }); | 215 }); |
| 199 | 216 |
| 200 test('getRange', () { | 217 test('getRange', () { |
| 201 var range = makeNodeList().getRange(1, 2); | 218 var range = makeNodeList().getRange(1, 2); |
| 202 expect(range, isNodeList); | 219 expect(range, isNodeList); |
| 203 expect(range[0], isBRElement); | 220 expect(range[0], isBRElement); |
| 204 expect(range[1], isComment); | 221 expect(range[1], isComment); |
| 205 }); | 222 }); |
| 206 }); | 223 }); |
| 207 } | 224 } |
| OLD | NEW |