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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 testUnsupported('removeRange', () => getQueryAll().removeRange(0, 1)); | 609 testUnsupported('removeRange', () => getQueryAll().removeRange(0, 1)); |
610 | 610 |
611 testUnsupported('insertangeRange', () => getQueryAll().insertRange(0, 1)); | 611 testUnsupported('insertangeRange', () => getQueryAll().insertRange(0, 1)); |
612 | 612 |
613 testUnsupported('clear', () => getQueryAll().clear()); | 613 testUnsupported('clear', () => getQueryAll().clear()); |
614 | 614 |
615 testUnsupported('removeLast', () => getQueryAll().removeLast()); | 615 testUnsupported('removeLast', () => getQueryAll().removeLast()); |
616 }); | 616 }); |
617 | 617 |
618 group('functional', () { | 618 group('functional', () { |
| 619 test('toString', () { |
| 620 final elems = makeElementWithChildren().children; |
| 621 expect(elems.toString(), "[BR, IMG, INPUT]"); |
| 622 final elem = makeElement().children; |
| 623 expect(elem.toString(), '[]'); |
| 624 }); |
| 625 |
619 test('scrollIntoView', () { | 626 test('scrollIntoView', () { |
620 var child = new DivElement(); | 627 var child = new DivElement(); |
621 document.body.append(child); | 628 document.body.append(child); |
622 | 629 |
623 child.scrollIntoView(ScrollAlignment.TOP); | 630 child.scrollIntoView(ScrollAlignment.TOP); |
624 child.scrollIntoView(ScrollAlignment.BOTTOM); | 631 child.scrollIntoView(ScrollAlignment.BOTTOM); |
625 child.scrollIntoView(ScrollAlignment.CENTER); | 632 child.scrollIntoView(ScrollAlignment.CENTER); |
626 child.scrollIntoView(); | 633 child.scrollIntoView(); |
627 }); | 634 }); |
628 }); | 635 }); |
629 | 636 |
630 group('_ElementList', () { | 637 group('_ElementList', () { |
631 List<Element> makeElList() => makeElementWithChildren().children; | 638 List<Element> makeElList() => makeElementWithChildren().children; |
632 | 639 |
633 test('where', () { | 640 test('where', () { |
634 var filtered = makeElList().where((n) => n is ImageElement); | 641 var filtered = makeElList().where((n) => n is ImageElement); |
635 expect(filtered.length, 1); | 642 expect(filtered.length, 1); |
636 expect(filtered.first, isImageElement); | 643 expect(filtered.first, isImageElement); |
637 expect(filtered, isElementIterable); | 644 expect(filtered, isElementIterable); |
638 }); | 645 }); |
639 | 646 |
640 test('sublist', () { | 647 test('sublist', () { |
641 var range = makeElList().sublist(1, 3); | 648 var range = makeElList().sublist(1, 3); |
642 expect(range, isElementList); | 649 expect(range, isElementList); |
643 expect(range[0], isImageElement); | 650 expect(range[0], isImageElement); |
644 expect(range[1], isInputElement); | 651 expect(range[1], isInputElement); |
645 }); | 652 }); |
646 }); | 653 }); |
647 } | 654 } |
OLD | NEW |