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

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

Issue 18583004: Added boolean to toggle. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/html_common/css_class_set.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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 classes.remove('qux'); 124 classes.remove('qux');
125 expect(classes, orderedEquals(['foo', 'baz'])); 125 expect(classes, orderedEquals(['foo', 'baz']));
126 }); 126 });
127 127
128 test('toggle', () { 128 test('toggle', () {
129 final classes = makeClassSet(); 129 final classes = makeClassSet();
130 classes.toggle('bar'); 130 classes.toggle('bar');
131 expect(classes, orderedEquals(['foo', 'baz'])); 131 expect(classes, orderedEquals(['foo', 'baz']));
132 classes.toggle('qux'); 132 classes.toggle('qux');
133 expect(classes, orderedEquals(['foo', 'baz', 'qux'])); 133 expect(classes, orderedEquals(['foo', 'baz', 'qux']));
134
135 classes.toggle('qux', true);
136 expect(classes, orderedEquals(['foo', 'baz', 'qux']));
137 classes.toggle('qux', false);
138 expect(classes, orderedEquals(['foo', 'baz']));
139 classes.toggle('qux', false);
140 expect(classes, orderedEquals(['foo', 'baz']));
141 classes.toggle('qux', true);
142 expect(classes, orderedEquals(['foo', 'baz', 'qux']));
134 }); 143 });
135 144
136 test('addAll', () { 145 test('addAll', () {
137 final classes = makeClassSet(); 146 final classes = makeClassSet();
138 classes.addAll(['bar', 'qux', 'bip']); 147 classes.addAll(['bar', 'qux', 'bip']);
139 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'qux', 'bip'])); 148 expect(classes, orderedEquals(['foo', 'bar', 'baz', 'qux', 'bip']));
140 }); 149 });
141 150
142 test('removeAll', () { 151 test('removeAll', () {
143 final classes = makeClassSet(); 152 final classes = makeClassSet();
144 classes.removeAll(['bar', 'baz', 'qux']); 153 classes.removeAll(['bar', 'baz', 'qux']);
145 expect(classes, orderedEquals(['foo'])); 154 expect(classes, orderedEquals(['foo']));
146 }); 155 });
147 156
148 test('toggleAll', () { 157 test('toggleAll', () {
149 final classes = makeClassSet(); 158 final classes = makeClassSet();
150 classes.toggleAll(['bar', 'foo']); 159 classes.toggleAll(['bar', 'foo']);
151 expect(classes, orderedEquals(['baz'])); 160 expect(classes, orderedEquals(['baz']));
152 classes.toggleAll(['qux', 'quux']); 161 classes.toggleAll(['qux', 'quux']);
153 expect(classes, orderedEquals(['baz', 'qux', 'quux'])); 162 expect(classes, orderedEquals(['baz', 'qux', 'quux']));
163 classes.toggleAll(['bar', 'foo'], true);
164 expect(classes, orderedEquals(['baz', 'qux', 'quux', 'bar', 'foo']));
165 classes.toggleAll(['baz', 'quux'], false);
166 expect(classes, orderedEquals(['qux','bar', 'foo']));
154 }); 167 });
155 168
156 test('containsAll', () { 169 test('containsAll', () {
157 final classes = makeClassSet(); 170 final classes = makeClassSet();
158 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue); 171 expect(classes.containsAll(['foo', 'baz'].toSet()), isTrue);
159 expect(classes.containsAll(['foo', 'qux'].toSet()), isFalse); 172 expect(classes.containsAll(['foo', 'qux'].toSet()), isFalse);
160 }); 173 });
161 174
162 test('intersection', () { 175 test('intersection', () {
163 final classes = makeClassSet(); 176 final classes = makeClassSet();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 document.documentElement.children.remove(listElement); 324 document.documentElement.children.remove(listElement);
312 }); 325 });
313 326
314 test('listContainsAll', () { 327 test('listContainsAll', () {
315 var elements = listElementSetup(); 328 var elements = listElementSetup();
316 expect(elements.classes.containsAll(['qux', 'meta', 'mornin']), isFalse); 329 expect(elements.classes.containsAll(['qux', 'meta', 'mornin']), isFalse);
317 expect(elements.classes.containsAll(['qux', 'lassy', 'classy']), isTrue); 330 expect(elements.classes.containsAll(['qux', 'lassy', 'classy']), isTrue);
318 document.documentElement.children.remove(listElement); 331 document.documentElement.children.remove(listElement);
319 }); 332 });
320 } 333 }
OLDNEW
« no previous file with comments | « sdk/lib/html/html_common/css_class_set.dart ('k') | tools/dom/src/CssClassSet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698