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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months 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/native_gc_test.dart ('k') | tests/html/queryall_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/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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 test('forEach', () { 72 test('forEach', () {
73 var nodes = []; 73 var nodes = [];
74 var node = makeNodeWithChildren(); 74 var node = makeNodeWithChildren();
75 node.nodes.forEach((n) => nodes.add(n)); 75 node.nodes.forEach((n) => nodes.add(n));
76 expect(nodes[0], isText); 76 expect(nodes[0], isText);
77 expect(nodes[1], isBRElement); 77 expect(nodes[1], isBRElement);
78 expect(nodes[2], isComment); 78 expect(nodes[2], isComment);
79 }); 79 });
80 80
81 test('filter', () { 81 test('where', () {
82 var filtered = makeNodeWithChildren().nodes.filter((n) => n is BRElement); 82 var filtered =
83 makeNodeWithChildren().nodes.where((n) => n is BRElement).toList();
83 expect(filtered.length, 1); 84 expect(filtered.length, 1);
84 expect(filtered[0], isBRElement); 85 expect(filtered[0], isBRElement);
85 expect(filtered, isNodeList); 86 expect(filtered, isNodeList);
86 }); 87 });
87 88
88 test('every', () { 89 test('every', () {
89 var node = makeNodeWithChildren(); 90 var node = makeNodeWithChildren();
90 expect(node.nodes.every((n) => n is Node), isTrue); 91 expect(node.nodes.every((n) => n is Node), isTrue);
91 expect(node.nodes.every((n) => n is Comment), isFalse); 92 expect(node.nodes.every((n) => n is Comment), isFalse);
92 }); 93 });
93 94
94 test('some', () { 95 test('any', () {
95 var node = makeNodeWithChildren(); 96 var node = makeNodeWithChildren();
96 expect(node.nodes.some((n) => n is Comment), isTrue); 97 expect(node.nodes.any((n) => n is Comment), isTrue);
97 expect(node.nodes.some((n) => n is svg.SvgElement), isFalse); 98 expect(node.nodes.any((n) => n is svg.SvgElement), isFalse);
98 }); 99 });
99 100
100 test('isEmpty', () { 101 test('isEmpty', () {
101 expect(makeNode().nodes.isEmpty, isTrue); 102 expect(makeNode().nodes.isEmpty, isTrue);
102 expect(makeNodeWithChildren().nodes.isEmpty, isFalse); 103 expect(makeNodeWithChildren().nodes.isEmpty, isFalse);
103 }); 104 });
104 105
105 test('length', () { 106 test('length', () {
106 expect(makeNode().nodes.length, 0); 107 expect(makeNode().nodes.length, 0);
107 expect(makeNodeWithChildren().nodes.length, 3); 108 expect(makeNodeWithChildren().nodes.length, 3);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 }); 176 });
176 177
177 test('getRange', () { 178 test('getRange', () {
178 var node = makeNodeWithChildren(); 179 var node = makeNodeWithChildren();
179 expect(node.nodes.getRange(1, 2), isNodeList); 180 expect(node.nodes.getRange(1, 2), isNodeList);
180 }); 181 });
181 }); 182 });
182 183
183 group('_NodeList', () { 184 group('_NodeList', () {
184 List<Node> makeNodeList() => 185 List<Node> makeNodeList() =>
185 makeNodeWithChildren().nodes.filter((_) => true); 186 makeNodeWithChildren().nodes.where((_) => true).toList();
186 187
187 test('first', () { 188 test('first', () {
188 var nodes = makeNodeList(); 189 var nodes = makeNodeList();
189 expect(nodes.first, isText); 190 expect(nodes.first, isText);
190 }); 191 });
191 192
192 test('filter', () { 193 test('where', () {
193 var filtered = makeNodeList().filter((n) => n is BRElement); 194 var filtered = makeNodeList().where((n) => n is BRElement).toList();
194 expect(filtered.length, 1); 195 expect(filtered.length, 1);
195 expect(filtered[0], isBRElement); 196 expect(filtered[0], isBRElement);
196 expect(filtered, isNodeList); 197 expect(filtered, isNodeList);
197 }); 198 });
198 199
199 test('getRange', () { 200 test('getRange', () {
200 var range = makeNodeList().getRange(1, 2); 201 var range = makeNodeList().getRange(1, 2);
201 expect(range, isNodeList); 202 expect(range, isNodeList);
202 expect(range[0], isBRElement); 203 expect(range[0], isBRElement);
203 expect(range[1], isComment); 204 expect(range[1], isComment);
204 }); 205 });
205 }); 206 });
206 } 207 }
OLDNEW
« no previous file with comments | « tests/html/native_gc_test.dart ('k') | tests/html/queryall_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698