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_config.dart'; | 7 import '../../pkg/unittest/lib/html_config.dart'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 }); | 143 }); |
144 | 144 |
145 test('toggleAll', () { | 145 test('toggleAll', () { |
146 final classes = makeClassSet(); | 146 final classes = makeClassSet(); |
147 classes.toggleAll(['bar', 'foo']); | 147 classes.toggleAll(['bar', 'foo']); |
148 expect(classes, orderedEquals(['baz'])); | 148 expect(classes, orderedEquals(['baz'])); |
149 classes.toggleAll(['qux', 'quux']); | 149 classes.toggleAll(['qux', 'quux']); |
150 expect(classes, orderedEquals(['baz', 'qux', 'quux'])); | 150 expect(classes, orderedEquals(['baz', 'qux', 'quux'])); |
151 }); | 151 }); |
152 | 152 |
153 test('isSubsetOf', () { | |
154 final classes = makeClassSet(); | |
155 expect(classes.isSubsetOf(['foo', 'bar', 'baz'].toSet()), isTrue); | |
156 expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux'].toSet()), isTrue); | |
157 expect(classes.isSubsetOf(['foo', 'bar', 'qux'].toSet()), isFalse); | |
158 }); | |
159 | |
160 test('containsAll', () { | 153 test('containsAll', () { |
161 final classes = makeClassSet(); | 154 final classes = makeClassSet(); |
162 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue); | 155 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue); |
163 expect(classes.containsAll(['foo', 'qux'].toSet()), isFalse); | 156 expect(classes.containsAll(['foo', 'qux'].toSet()), isFalse); |
164 }); | 157 }); |
165 | 158 |
166 test('intersection', () { | 159 test('intersection', () { |
167 final classes = makeClassSet(); | 160 final classes = makeClassSet(); |
168 expect(classes.intersection(['foo', 'qux', 'baz'].toSet()), | 161 expect(classes.intersection(['foo', 'qux', 'baz'].toSet()), |
169 unorderedEquals(['foo', 'baz'])); | 162 unorderedEquals(['foo', 'baz'])); |
170 }); | 163 }); |
171 | 164 |
172 test('clear', () { | 165 test('clear', () { |
173 final classes = makeClassSet(); | 166 final classes = makeClassSet(); |
174 classes.clear(); | 167 classes.clear(); |
175 expect(classes, equals([])); | 168 expect(classes, equals([])); |
176 }); | 169 }); |
177 | 170 |
178 test('order', () { | 171 test('order', () { |
179 var classes = makeClassSet(); | 172 var classes = makeClassSet(); |
180 classes.add('aardvark'); | 173 classes.add('aardvark'); |
181 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'aardvark'])); | 174 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'aardvark'])); |
182 classes.toggle('baz'); | 175 classes.toggle('baz'); |
183 expect(classes, orderedEquals(['foo', 'bar', 'aardvark'])); | 176 expect(classes, orderedEquals(['foo', 'bar', 'aardvark'])); |
184 classes.toggle('baz'); | 177 classes.toggle('baz'); |
185 expect(classes, orderedEquals(['foo', 'bar', 'aardvark', 'baz'])); | 178 expect(classes, orderedEquals(['foo', 'bar', 'aardvark', 'baz'])); |
186 }); | 179 }); |
187 } | 180 } |
OLD | NEW |