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/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/html_config.dart'); |
8 #import('dart:html'); | 8 #import('dart:html'); |
9 | 9 |
10 Node makeNode() => new Element.tag('div'); | 10 Node makeNode() => new Element.tag('div'); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 Expect.isFalse(node.nodes.every((n) => n is Comment)); | 81 Expect.isFalse(node.nodes.every((n) => n is Comment)); |
82 }); | 82 }); |
83 | 83 |
84 test('some', () { | 84 test('some', () { |
85 var node = makeNodeWithChildren(); | 85 var node = makeNodeWithChildren(); |
86 Expect.isTrue(node.nodes.some((n) => n is Comment)); | 86 Expect.isTrue(node.nodes.some((n) => n is Comment)); |
87 Expect.isFalse(node.nodes.some((n) => n is SVGElement)); | 87 Expect.isFalse(node.nodes.some((n) => n is SVGElement)); |
88 }); | 88 }); |
89 | 89 |
90 test('isEmpty', () { | 90 test('isEmpty', () { |
91 Expect.isTrue(makeNode().nodes.isEmpty()); | 91 Expect.isTrue(makeNode().nodes.isEmpty); |
92 Expect.isFalse(makeNodeWithChildren().nodes.isEmpty()); | 92 Expect.isFalse(makeNodeWithChildren().nodes.isEmpty); |
93 }); | 93 }); |
94 | 94 |
95 test('length', () { | 95 test('length', () { |
96 Expect.equals(0, makeNode().nodes.length); | 96 Expect.equals(0, makeNode().nodes.length); |
97 Expect.equals(3, makeNodeWithChildren().nodes.length); | 97 Expect.equals(3, makeNodeWithChildren().nodes.length); |
98 }); | 98 }); |
99 | 99 |
100 test('[]', () { | 100 test('[]', () { |
101 var node = makeNodeWithChildren(); | 101 var node = makeNodeWithChildren(); |
102 Expect.isTrue(node.nodes[0] is Text); | 102 Expect.isTrue(node.nodes[0] is Text); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 }); | 187 }); |
188 | 188 |
189 test('getRange', () { | 189 test('getRange', () { |
190 var range = makeNodeList().getRange(1, 2); | 190 var range = makeNodeList().getRange(1, 2); |
191 Expect.isTrue(range is List<Node>); | 191 Expect.isTrue(range is List<Node>); |
192 Expect.isTrue(range[0] is BRElement); | 192 Expect.isTrue(range[0] is BRElement); |
193 Expect.isTrue(range[1] is Comment); | 193 Expect.isTrue(range[1] is Comment); |
194 }); | 194 }); |
195 }); | 195 }); |
196 } | 196 } |
OLD | NEW |