| 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 21 matching lines...) Expand all Loading... |
| 32 final out = subnode.replaceWith(new Text('Bar')); | 32 final out = subnode.replaceWith(new Text('Bar')); |
| 33 expect(out, equals(subnode), reason: '#replaceWith should be chainable'); | 33 expect(out, equals(subnode), reason: '#replaceWith should be chainable'); |
| 34 expect(node.nodes.length, 3); | 34 expect(node.nodes.length, 3); |
| 35 expect(node.nodes[0], isText); | 35 expect(node.nodes[0], isText); |
| 36 expect(node.nodes[0].text, 'Foo'); | 36 expect(node.nodes[0].text, 'Foo'); |
| 37 expect(node.nodes[1], isText); | 37 expect(node.nodes[1], isText); |
| 38 expect(node.nodes[1].text, 'Bar'); | 38 expect(node.nodes[1].text, 'Bar'); |
| 39 expect(node.nodes[2], isComment); | 39 expect(node.nodes[2], isComment); |
| 40 }); | 40 }); |
| 41 | 41 |
| 42 test('append', () { |
| 43 var node = makeNode(); |
| 44 node.append(new Element.tag('hr')); |
| 45 expect(node.nodes.last, isHRElement); |
| 46 }); |
| 47 |
| 42 test('remove', () { | 48 test('remove', () { |
| 43 final node = makeNodeWithChildren(); | 49 final node = makeNodeWithChildren(); |
| 44 final subnode = node.nodes[1]; | 50 final subnode = node.nodes[1]; |
| 45 subnode.remove(); | 51 subnode.remove(); |
| 46 expect(node.nodes.length, 2); | 52 expect(node.nodes.length, 2); |
| 47 expect(node.nodes[0], isText); | 53 expect(node.nodes[0], isText); |
| 48 expect(node.nodes[1], isComment); | 54 expect(node.nodes[1], isComment); |
| 49 }); | 55 }); |
| 50 | 56 |
| 51 test('contains', () { | 57 test('contains', () { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 }); | 259 }); |
| 254 | 260 |
| 255 test('getRange', () { | 261 test('getRange', () { |
| 256 var range = makeNodeList().getRange(1, 2); | 262 var range = makeNodeList().getRange(1, 2); |
| 257 expect(range, isNodeList); | 263 expect(range, isNodeList); |
| 258 expect(range[0], isBRElement); | 264 expect(range[0], isBRElement); |
| 259 expect(range[1], isComment); | 265 expect(range[1], isComment); |
| 260 }); | 266 }); |
| 261 }); | 267 }); |
| 262 } | 268 } |
| OLD | NEW |