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 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 import 'package:unittest/html_individual_config.dart'; | 7 import 'package:unittest/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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 group('ElementList', () { | 908 group('ElementList', () { |
909 // Tests for methods on the DOM class 'NodeList'. | 909 // Tests for methods on the DOM class 'NodeList'. |
910 // | 910 // |
911 // There are two interesting things that are checked here from the viewpoint | 911 // There are two interesting things that are checked here from the viewpoint |
912 // of the dart2js implementation of a 'native' class: | 912 // of the dart2js implementation of a 'native' class: |
913 // | 913 // |
914 // 1. Some methods are implementated from by 'Object' or 'Interceptor'; | 914 // 1. Some methods are implementated from by 'Object' or 'Interceptor'; |
915 // some of these tests simply check that a method can be called. | 915 // some of these tests simply check that a method can be called. |
916 // 2. Some methods are implemented by mixins. | 916 // 2. Some methods are implemented by mixins. |
917 | 917 |
918 ElementList makeElementList() => | 918 ElementList<Element> makeElementList() => |
919 (new Element.html("<div>Foo<br/><!--baz--><br/><br/></div>")) | 919 (new Element.html("<div>Foo<br/><!--baz--><br/><br/></div>")) |
920 .queryAll('br'); | 920 .queryAll('br'); |
921 | 921 |
922 test('hashCode', () { | 922 test('hashCode', () { |
923 var nodes = makeElementList(); | 923 var nodes = makeElementList(); |
924 var hash = nodes.hashCode; | 924 var hash = nodes.hashCode; |
925 final int N = 1000; | 925 final int N = 1000; |
926 int matchCount = 0; | 926 int matchCount = 0; |
927 for (int i = 0; i < N; i++) { | 927 for (int i = 0; i < N; i++) { |
928 if (makeElementList().hashCode == hash) matchCount++; | 928 if (makeElementList().hashCode == hash) matchCount++; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 | 969 |
970 test('sublist', () { | 970 test('sublist', () { |
971 var range = makeElementList().sublist(1, 3); | 971 var range = makeElementList().sublist(1, 3); |
972 expect(range.length, 2); | 972 expect(range.length, 2); |
973 expect(range[0], isBRElement); | 973 expect(range[0], isBRElement); |
974 expect(range[1], isBRElement); | 974 expect(range[1], isBRElement); |
975 }); | 975 }); |
976 | 976 |
977 }); | 977 }); |
978 } | 978 } |
OLD | NEW |