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

Side by Side Diff: tests/html/htmlcollection_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/element_test.dart ('k') | tests/html/isolates_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 library ElementListTest; 1 library ElementListTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 5
6 // Test that List<Element> implements List<T> 6 // Test that List<Element> implements List<T>
7 main() { 7 main() {
8 Element insertTestDiv() { 8 Element insertTestDiv() {
9 Element element = new Element.tag('div'); 9 Element element = new Element.tag('div');
10 element.innerHtml = r""" 10 element.innerHtml = r"""
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 List<Element> someChecked = 78 List<Element> someChecked =
79 document.query('#someChecked').children; 79 document.query('#someChecked').children;
80 80
81 List<Element> noneChecked = 81 List<Element> noneChecked =
82 document.query('#noneChecked').children; 82 document.query('#noneChecked').children;
83 83
84 expect(eachChecked.length, 4); 84 expect(eachChecked.length, 4);
85 expect(someChecked.length, 4); 85 expect(someChecked.length, 4);
86 expect(noneChecked.length, 4); 86 expect(noneChecked.length, 4);
87 87
88 expect(eachChecked.some((x) => x.checked), isTrue); 88 expect(eachChecked.any((x) => x.checked), isTrue);
89 expect(eachChecked.some((x) => !x.checked), isFalse); 89 expect(eachChecked.any((x) => !x.checked), isFalse);
90 expect(someChecked.some((x) => x.checked), isTrue); 90 expect(someChecked.any((x) => x.checked), isTrue);
91 expect(someChecked.some((x) => !x.checked), isTrue); 91 expect(someChecked.any((x) => !x.checked), isTrue);
92 expect(noneChecked.some((x) => x.checked), isFalse); 92 expect(noneChecked.any((x) => x.checked), isFalse);
93 expect(noneChecked.some((x) => !x.checked), isTrue); 93 expect(noneChecked.any((x) => !x.checked), isTrue);
94 94
95 root.remove(); 95 root.remove();
96 }); 96 });
97 test('Filter', () { 97 test('Filter', () {
98 Element root = insertTestDiv(); 98 Element root = insertTestDiv();
99 99
100 List<Element> eachChecked = 100 List<Element> eachChecked =
101 document.query('#allChecked').children; 101 document.query('#allChecked').children;
102 102
103 List<Element> someChecked = 103 List<Element> someChecked =
104 document.query('#someChecked').children; 104 document.query('#someChecked').children;
105 105
106 List<Element> noneChecked = 106 List<Element> noneChecked =
107 document.query('#noneChecked').children; 107 document.query('#noneChecked').children;
108 108
109 expect(eachChecked.length, 4); 109 expect(eachChecked.length, 4);
110 expect(someChecked.length, 4); 110 expect(someChecked.length, 4);
111 expect(noneChecked.length, 4); 111 expect(noneChecked.length, 4);
112 112
113 expect(eachChecked.filter((x) => x.checked).length, 4); 113 expect(eachChecked.where((x) => x.checked).length, 4);
114 expect(eachChecked.filter((x) => !x.checked).length, 0); 114 expect(eachChecked.where((x) => !x.checked).length, 0);
115 expect(someChecked.filter((x) => x.checked).length, 2); 115 expect(someChecked.where((x) => x.checked).length, 2);
116 expect(someChecked.filter((x) => !x.checked).length, 2); 116 expect(someChecked.where((x) => !x.checked).length, 2);
117 expect(noneChecked.filter((x) => x.checked).length, 0); 117 expect(noneChecked.where((x) => x.checked).length, 0);
118 expect(noneChecked.filter((x) => !x.checked).length, 4); 118 expect(noneChecked.where((x) => !x.checked).length, 4);
119 119
120 root.remove(); 120 root.remove();
121 }); 121 });
122 test('IsEmpty', () { 122 test('IsEmpty', () {
123 Element root = insertTestDiv(); 123 Element root = insertTestDiv();
124 124
125 List<Element> someChecked = 125 List<Element> someChecked =
126 document.query('#someChecked').children; 126 document.query('#someChecked').children;
127 127
128 List<Element> emptyDiv = 128 List<Element> emptyDiv =
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 expect(someChecked.lastIndexOf(someChecked[3], 2), -1); 268 expect(someChecked.lastIndexOf(someChecked[3], 2), -1);
269 269
270 expect(someChecked.lastIndexOf(noneChecked[0], 3), -1); 270 expect(someChecked.lastIndexOf(noneChecked[0], 3), -1);
271 expect(noneChecked.lastIndexOf(someChecked[0], 3), -1); 271 expect(noneChecked.lastIndexOf(someChecked[0], 3), -1);
272 expect(someChecked.lastIndexOf(noneChecked[1], 3), -1); 272 expect(someChecked.lastIndexOf(noneChecked[1], 3), -1);
273 expect(noneChecked.lastIndexOf(someChecked[1], 3), -1); 273 expect(noneChecked.lastIndexOf(someChecked[1], 3), -1);
274 274
275 root.remove(); 275 root.remove();
276 }); 276 });
277 } 277 }
OLDNEW
« no previous file with comments | « tests/html/element_test.dart ('k') | tests/html/isolates_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698