| 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 12 matching lines...) Expand all Loading... |
| 23 var isImageElement = | 23 var isImageElement = |
| 24 predicate((x) => x is ImageElement, 'is an ImageElement'); | 24 predicate((x) => x is ImageElement, 'is an ImageElement'); |
| 25 var isInputElement = | 25 var isInputElement = |
| 26 predicate((x) => x is InputElement, 'is an InputElement'); | 26 predicate((x) => x is InputElement, 'is an InputElement'); |
| 27 | 27 |
| 28 group('functional', () { | 28 group('functional', () { |
| 29 test('toString', () { | 29 test('toString', () { |
| 30 final nodes = makeNodeWithChildren(); | 30 final nodes = makeNodeWithChildren(); |
| 31 // TODO(efortuna): Update this test when you have actual toString methods | 31 // TODO(efortuna): Update this test when you have actual toString methods |
| 32 // for the items in the node List as well. | 32 // for the items in the node List as well. |
| 33 expect(nodes.nodes.toString(), "[Instance of 'Text', BR, " | 33 expect(nodes.nodes.toString(), "[Foo, br, baz]"); |
| 34 "Instance of 'Comment']"); | |
| 35 final node = makeNode(); | 34 final node = makeNode(); |
| 36 expect(node.nodes.toString(), '[]'); | 35 expect(node.nodes.toString(), '[]'); |
| 37 }); | 36 }); |
| 38 | 37 |
| 39 test('replaceWith', () { | 38 test('replaceWith', () { |
| 40 final node = makeNodeWithChildren(); | 39 final node = makeNodeWithChildren(); |
| 41 final subnode = node.nodes[1]; | 40 final subnode = node.nodes[1]; |
| 42 final out = subnode.replaceWith(new Text('Bar')); | 41 final out = subnode.replaceWith(new Text('Bar')); |
| 43 expect(out, equals(subnode), reason: '#replaceWith should be chainable'); | 42 expect(out, equals(subnode), reason: '#replaceWith should be chainable'); |
| 44 expect(node.nodes.length, 3); | 43 expect(node.nodes.length, 3); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 }); | 279 }); |
| 281 | 280 |
| 282 test('sublist', () { | 281 test('sublist', () { |
| 283 var range = makeNodeList().sublist(1, 3); | 282 var range = makeNodeList().sublist(1, 3); |
| 284 expect(range, isNodeList); | 283 expect(range, isNodeList); |
| 285 expect(range[0], isBRElement); | 284 expect(range[0], isBRElement); |
| 286 expect(range[1], isComment); | 285 expect(range[1], isComment); |
| 287 }); | 286 }); |
| 288 }); | 287 }); |
| 289 } | 288 } |
| OLD | NEW |