| 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 ElementTest; | 5 library ElementTest; |
| 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:async'; | 8 import 'dart:async'; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 import 'dart:svg' as svg; | 10 import 'dart:svg' as svg; |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 test('sublist', () { | 493 test('sublist', () { |
| 494 var el = makeElementWithChildren(); | 494 var el = makeElementWithChildren(); |
| 495 expect(el.children.sublist(1, 2), isElementList); | 495 expect(el.children.sublist(1, 2), isElementList); |
| 496 }); | 496 }); |
| 497 | 497 |
| 498 test('getRange', () { | 498 test('getRange', () { |
| 499 var el = makeElementWithChildren(); | 499 var el = makeElementWithChildren(); |
| 500 expect(el.children.getRange(1, 2).length, 1); | 500 expect(el.children.getRange(1, 2).length, 1); |
| 501 }); | 501 }); |
| 502 | 502 |
| 503 test('retainWhere', () { | |
| 504 var el = makeElementWithChildren(); | |
| 505 expect(el.children.length, 3); | |
| 506 el.children.retainWhere((e) => true); | |
| 507 expect(el.children.length, 3); | |
| 508 | |
| 509 el = makeElementWithChildren(); | |
| 510 expect(el.children.length, 3); | |
| 511 el.children.retainWhere((e) => false); | |
| 512 expect(el.children.length, 0); | |
| 513 | |
| 514 el = makeElementWithChildren(); | |
| 515 expect(el.children.length, 3); | |
| 516 el.children.retainWhere((e) => e.localName == 'input'); | |
| 517 expect(el.children.length, 1); | |
| 518 | |
| 519 el = makeElementWithChildren(); | |
| 520 expect(el.children.length, 3); | |
| 521 el.children.retainWhere((e) => e.localName == 'br'); | |
| 522 expect(el.children.length, 1); | |
| 523 }); | |
| 524 | |
| 525 test('removeWhere', () { | |
| 526 var el = makeElementWithChildren(); | |
| 527 expect(el.children.length, 3); | |
| 528 el.children.removeWhere((e) => true); | |
| 529 expect(el.children.length, 0); | |
| 530 | |
| 531 el = makeElementWithChildren(); | |
| 532 expect(el.children.length, 3); | |
| 533 el.children.removeWhere((e) => false); | |
| 534 expect(el.children.length, 3); | |
| 535 | |
| 536 el = makeElementWithChildren(); | |
| 537 expect(el.children.length, 3); | |
| 538 el.children.removeWhere((e) => e.localName == 'input'); | |
| 539 expect(el.children.length, 2); | |
| 540 | |
| 541 el = makeElementWithChildren(); | |
| 542 expect(el.children.length, 3); | |
| 543 el.children.removeWhere((e) => e.localName == 'br'); | |
| 544 expect(el.children.length, 2); | |
| 545 }); | |
| 546 | |
| 547 testUnsupported('sort', () { | 503 testUnsupported('sort', () { |
| 548 var l = makeElementWithChildren().children; | 504 var l = makeElementWithChildren().children; |
| 549 l.sort(); | 505 l.sort(); |
| 550 }); | 506 }); |
| 551 | 507 |
| 552 testUnsupported('setRange', () { | 508 testUnsupported('setRange', () { |
| 553 var l = makeElementWithChildren().children; | 509 var l = makeElementWithChildren().children; |
| 554 l.setRange(0, 0, []); | 510 l.setRange(0, 0, []); |
| 555 }); | 511 }); |
| 556 | 512 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 }); | 675 }); |
| 720 | 676 |
| 721 test('sublist', () { | 677 test('sublist', () { |
| 722 var range = makeElList().sublist(1, 3); | 678 var range = makeElList().sublist(1, 3); |
| 723 expect(range, isElementList); | 679 expect(range, isElementList); |
| 724 expect(range[0], isImageElement); | 680 expect(range[0], isImageElement); |
| 725 expect(range[1], isInputElement); | 681 expect(range[1], isInputElement); |
| 726 }); | 682 }); |
| 727 }); | 683 }); |
| 728 } | 684 } |
| OLD | NEW |