Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: tests/html/node_test.dart

Issue 11273041: Make first and last getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/html/htmlcollection_test.dart ('k') | tests/html/selectelement_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Expect.isTrue(makeNodeWithChildren().nodes is List<Node>); 49 Expect.isTrue(makeNodeWithChildren().nodes is List<Node>);
50 }); 50 });
51 51
52 test('first', () { 52 test('first', () {
53 var node = makeNodeWithChildren(); 53 var node = makeNodeWithChildren();
54 Expect.isTrue(node.nodes.first is Text); 54 Expect.isTrue(node.nodes.first is Text);
55 }); 55 });
56 56
57 test('last', () { 57 test('last', () {
58 var node = makeNodeWithChildren(); 58 var node = makeNodeWithChildren();
59 Expect.isTrue(node.nodes.last() is Comment); 59 Expect.isTrue(node.nodes.last is Comment);
60 }); 60 });
61 61
62 test('forEach', () { 62 test('forEach', () {
63 var nodes = []; 63 var nodes = [];
64 var node = makeNodeWithChildren(); 64 var node = makeNodeWithChildren();
65 node.nodes.forEach((n) => nodes.add(n)); 65 node.nodes.forEach((n) => nodes.add(n));
66 Expect.isTrue(nodes[0] is Text); 66 Expect.isTrue(nodes[0] is Text);
67 Expect.isTrue(nodes[1] is BRElement); 67 Expect.isTrue(nodes[1] is BRElement);
68 Expect.isTrue(nodes[2] is Comment); 68 Expect.isTrue(nodes[2] is Comment);
69 }); 69 });
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 var node = makeNodeWithChildren(); 108 var node = makeNodeWithChildren();
109 node.nodes[1] = new Element.tag('hr'); 109 node.nodes[1] = new Element.tag('hr');
110 Expect.isTrue(node.nodes[0] is Text); 110 Expect.isTrue(node.nodes[0] is Text);
111 Expect.isTrue(node.nodes[1] is HRElement); 111 Expect.isTrue(node.nodes[1] is HRElement);
112 Expect.isTrue(node.nodes[2] is Comment); 112 Expect.isTrue(node.nodes[2] is Comment);
113 }); 113 });
114 114
115 test('add', () { 115 test('add', () {
116 var node = makeNode(); 116 var node = makeNode();
117 node.nodes.add(new Element.tag('hr')); 117 node.nodes.add(new Element.tag('hr'));
118 Expect.isTrue(node.nodes.last() is HRElement); 118 Expect.isTrue(node.nodes.last is HRElement);
119 }); 119 });
120 120
121 test('addLast', () { 121 test('addLast', () {
122 var node = makeNode(); 122 var node = makeNode();
123 node.nodes.addLast(new Element.tag('hr')); 123 node.nodes.addLast(new Element.tag('hr'));
124 Expect.isTrue(node.nodes.last() is HRElement); 124 Expect.isTrue(node.nodes.last is HRElement);
125 }); 125 });
126 126
127 test('iterator', () { 127 test('iterator', () {
128 var nodes = []; 128 var nodes = [];
129 var node = makeNodeWithChildren(); 129 var node = makeNodeWithChildren();
130 for (var subnode in node.nodes) { 130 for (var subnode in node.nodes) {
131 nodes.add(subnode); 131 nodes.add(subnode);
132 } 132 }
133 Expect.isTrue(nodes[0] is Text); 133 Expect.isTrue(nodes[0] is Text);
134 Expect.isTrue(nodes[1] is BRElement); 134 Expect.isTrue(nodes[1] is BRElement);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « tests/html/htmlcollection_test.dart ('k') | tests/html/selectelement_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698