Chromium Code Reviews| Index: tests/html/node_test.dart |
| diff --git a/tests/html/node_test.dart b/tests/html/node_test.dart |
| index c8a009cdc3a535be01311d3d97aa03830ca7ba99..a32af53833aa779552a6623424fc57b34b801897 100644 |
| --- a/tests/html/node_test.dart |
| +++ b/tests/html/node_test.dart |
| @@ -324,6 +324,51 @@ main() { |
| }); |
| }); |
| + group('NodeList', () { |
|
blois
2013/05/10 00:34:30
Why not put it in group('_NodeList')?
Names are t
sra1
2013/05/10 22:13:26
Done.
|
| + // Tests for methods on the DOM class 'NodeList' that get their |
| + // implementation from 'Object' and/or 'Interceptor'. Some of these tests |
| + // simply check that a method can be called. |
| + List<Node> makeNodeList() => |
| + makeNodeWithChildren().$dom_getElementsByTagName('br'); |
| + |
| + test('trueNodeList', () { |
| + var nodes = makeNodeList(); |
| + expect(nodes is NodeList, true); |
| + }); |
| + |
| + test('hashCode', () { |
| + var nodes = makeNodeList(); |
| + var hash = nodes.hashCode; |
| + final int N = 1000; |
| + int matchCount = 0; |
| + for (int i = 0; i < N; i++) { |
| + if (makeNodeList().hashCode == hash) matchCount++; |
| + } |
| + expect(matchCount, lessThan(N)); |
| + }); |
| + |
| + test('operator==', () { |
| + var a = [makeNodeList(), makeNodeList(), null]; |
| + for (int i = 0; i < a.length; i++) { |
| + for (int j = 0; j < a.length; j++) { |
| + expect(i == j, a[i] == a[j]); |
| + } |
| + } |
| + }); |
| + |
| + test('runtimeType', () { |
| + var nodes1 = makeNodeList(); |
| + var nodes2 = makeNodeList(); |
| + var type1 = nodes1.runtimeType; |
| + var type2 = nodes2.runtimeType; |
| + expect(type1 == type2, true); |
| + String name = '$type1'; |
| + if (name.length > 3) { |
| + expect(name, 'NodeList'); |
| + } |
| + }); |
| + }); |
| + |
| group('_NodeList', () { |
| List<Node> makeNodeList() => |
| makeNodeWithChildren().nodes.where((_) => true).toList(); |