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

Side by Side Diff: tests/html/element_classes_test.dart

Issue 12851014: Add toggleAll to CSSClassSet. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/CssClassSet.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 // 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 classes.addAll(['bar', 'qux', 'bip']); 135 classes.addAll(['bar', 'qux', 'bip']);
136 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'qux', 'bip'])); 136 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'qux', 'bip']));
137 }); 137 });
138 138
139 test('removeAll', () { 139 test('removeAll', () {
140 final classes = makeClassSet(); 140 final classes = makeClassSet();
141 classes.removeAll(['bar', 'baz', 'qux']); 141 classes.removeAll(['bar', 'baz', 'qux']);
142 expect(classes, orderedEquals(['foo'])); 142 expect(classes, orderedEquals(['foo']));
143 }); 143 });
144 144
145 test('toggleAll', () {
146 final classes = makeClassSet();
147 classes.toggleAll(['bar', 'foo']);
148 expect(classes, orderedEquals(['baz']));
149 classes.toggleAll(['qux', 'quux']);
150 expect(classes, orderedEquals(['baz', 'qux', 'quux']));
151 });
152
145 test('isSubsetOf', () { 153 test('isSubsetOf', () {
146 final classes = makeClassSet(); 154 final classes = makeClassSet();
147 expect(classes.isSubsetOf(['foo', 'bar', 'baz'].toSet()), isTrue); 155 expect(classes.isSubsetOf(['foo', 'bar', 'baz'].toSet()), isTrue);
148 expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux'].toSet()), isTrue); 156 expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux'].toSet()), isTrue);
149 expect(classes.isSubsetOf(['foo', 'bar', 'qux'].toSet()), isFalse); 157 expect(classes.isSubsetOf(['foo', 'bar', 'qux'].toSet()), isFalse);
150 }); 158 });
151 159
152 test('containsAll', () { 160 test('containsAll', () {
153 final classes = makeClassSet(); 161 final classes = makeClassSet();
154 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue); 162 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue);
(...skipping 15 matching lines...) Expand all
170 test('order', () { 178 test('order', () {
171 var classes = makeClassSet(); 179 var classes = makeClassSet();
172 classes.add('aardvark'); 180 classes.add('aardvark');
173 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'aardvark'])); 181 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'aardvark']));
174 classes.toggle('baz'); 182 classes.toggle('baz');
175 expect(classes, orderedEquals(['foo', 'bar', 'aardvark'])); 183 expect(classes, orderedEquals(['foo', 'bar', 'aardvark']));
176 classes.toggle('baz'); 184 classes.toggle('baz');
177 expect(classes, orderedEquals(['foo', 'bar', 'aardvark', 'baz'])); 185 expect(classes, orderedEquals(['foo', 'bar', 'aardvark', 'baz']));
178 }); 186 });
179 } 187 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/CssClassSet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698