| 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 23 matching lines...) Expand all Loading... |
| 34 expect(node.nodes[0], isText); | 34 expect(node.nodes[0], isText); |
| 35 expect(node.nodes[0].text, 'Foo'); | 35 expect(node.nodes[0].text, 'Foo'); |
| 36 expect(node.nodes[1], isText); | 36 expect(node.nodes[1], isText); |
| 37 expect(node.nodes[1].text, 'Bar'); | 37 expect(node.nodes[1].text, 'Bar'); |
| 38 expect(node.nodes[2], isComment); | 38 expect(node.nodes[2], isComment); |
| 39 }); | 39 }); |
| 40 | 40 |
| 41 test('remove', () { | 41 test('remove', () { |
| 42 final node = makeNodeWithChildren(); | 42 final node = makeNodeWithChildren(); |
| 43 final subnode = node.nodes[1]; | 43 final subnode = node.nodes[1]; |
| 44 final out = subnode.remove(); | 44 subnode.remove(); |
| 45 expect(out, isNull); | |
| 46 expect(node.nodes.length, 2); | 45 expect(node.nodes.length, 2); |
| 47 expect(node.nodes[0], isText); | 46 expect(node.nodes[0], isText); |
| 48 expect(node.nodes[1], isComment); | 47 expect(node.nodes[1], isComment); |
| 49 }); | 48 }); |
| 50 | 49 |
| 51 test('contains', () { | 50 test('contains', () { |
| 52 final Node node = new Element.html("<div>Foo<span>Bar</span></div>"); | 51 final Node node = new Element.html("<div>Foo<span>Bar</span></div>"); |
| 53 expect(node.contains(node.nodes.first), isTrue); | 52 expect(node.contains(node.nodes.first), isTrue); |
| 54 expect(node.contains(node.nodes[1].nodes.first), isTrue); | 53 expect(node.contains(node.nodes[1].nodes.first), isTrue); |
| 55 expect(node.contains(new Text('Foo')), isFalse); | 54 expect(node.contains(new Text('Foo')), isFalse); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 }); | 197 }); |
| 199 | 198 |
| 200 test('getRange', () { | 199 test('getRange', () { |
| 201 var range = makeNodeList().getRange(1, 2); | 200 var range = makeNodeList().getRange(1, 2); |
| 202 expect(range, isNodeList); | 201 expect(range, isNodeList); |
| 203 expect(range[0], isBRElement); | 202 expect(range[0], isBRElement); |
| 204 expect(range[1], isComment); | 203 expect(range[1], isComment); |
| 205 }); | 204 }); |
| 206 }); | 205 }); |
| 207 } | 206 } |
| OLD | NEW |