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

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

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 }); 234 });
235 235
236 test('removeLast', () { 236 test('removeLast', () {
237 var node = makeNodeWithChildren(); 237 var node = makeNodeWithChildren();
238 expect(node.nodes.removeLast(), isComment); 238 expect(node.nodes.removeLast(), isComment);
239 expect(node.nodes.length, 2); 239 expect(node.nodes.length, 2);
240 expect(node.nodes.removeLast(), isBRElement); 240 expect(node.nodes.removeLast(), isBRElement);
241 expect(node.nodes.length, 1); 241 expect(node.nodes.length, 1);
242 }); 242 });
243 243
244 test('getRange', () { 244 test('sublist', () {
245 var node = makeNodeWithChildren(); 245 var node = makeNodeWithChildren();
246 expect(node.nodes.getRange(1, 2), isNodeList); 246 expect(node.nodes.sublist(1, 3), isNodeList);
247 }); 247 });
248 }); 248 });
249 249
250 group('_NodeList', () { 250 group('_NodeList', () {
251 List<Node> makeNodeList() => 251 List<Node> makeNodeList() =>
252 makeNodeWithChildren().nodes.where((_) => true).toList(); 252 makeNodeWithChildren().nodes.where((_) => true).toList();
253 253
254 test('first', () { 254 test('first', () {
255 var nodes = makeNodeList(); 255 var nodes = makeNodeList();
256 expect(nodes.first, isText); 256 expect(nodes.first, isText);
257 }); 257 });
258 258
259 test('where', () { 259 test('where', () {
260 var filtered = makeNodeList().where((n) => n is BRElement).toList(); 260 var filtered = makeNodeList().where((n) => n is BRElement).toList();
261 expect(filtered.length, 1); 261 expect(filtered.length, 1);
262 expect(filtered[0], isBRElement); 262 expect(filtered[0], isBRElement);
263 expect(filtered, isNodeList); 263 expect(filtered, isNodeList);
264 }); 264 });
265 265
266 test('getRange', () { 266 test('sublist', () {
267 var range = makeNodeList().getRange(1, 2); 267 var range = makeNodeList().sublist(1, 3);
268 expect(range, isNodeList); 268 expect(range, isNodeList);
269 expect(range[0], isBRElement); 269 expect(range[0], isBRElement);
270 expect(range[1], isComment); 270 expect(range[1], isComment);
271 }); 271 });
272 }); 272 });
273 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698