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

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

Issue 10868026: Adding .toggle method to Element.classes to match the JS element.classList.toggle method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporating review feedback. Created 8 years, 3 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/documentfragment_test.dart ('k') | no next file » | 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/unittest.dart'); 6 #import('../../pkg/unittest/unittest.dart');
7 #import('../../pkg/unittest/html_config.dart'); 7 #import('../../pkg/unittest/html_config.dart');
8 #import('dart:html'); 8 #import('dart:html');
9 9
10 main() { 10 main() {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 }); 116 });
117 117
118 test('remove', () { 118 test('remove', () {
119 final classes = makeClassSet(); 119 final classes = makeClassSet();
120 classes.remove('bar'); 120 classes.remove('bar');
121 Expect.setEquals(['foo', 'baz'], classes); 121 Expect.setEquals(['foo', 'baz'], classes);
122 classes.remove('qux'); 122 classes.remove('qux');
123 Expect.setEquals(['foo', 'baz'], classes); 123 Expect.setEquals(['foo', 'baz'], classes);
124 }); 124 });
125 125
126 test('toggle', () {
127 final classes = makeClassSet();
128 classes.toggle('bar');
129 Expect.setEquals(['foo', 'baz'], classes);
130 classes.toggle('qux');
131 Expect.setEquals(['foo', 'baz', 'qux'], classes);
132 });
133
126 test('addAll', () { 134 test('addAll', () {
127 final classes = makeClassSet(); 135 final classes = makeClassSet();
128 classes.addAll(['bar', 'qux', 'bip']); 136 classes.addAll(['bar', 'qux', 'bip']);
129 Expect.setEquals(['foo', 'bar', 'baz', 'qux', 'bip'], classes); 137 Expect.setEquals(['foo', 'bar', 'baz', 'qux', 'bip'], classes);
130 }); 138 });
131 139
132 test('removeAll', () { 140 test('removeAll', () {
133 final classes = makeClassSet(); 141 final classes = makeClassSet();
134 classes.removeAll(['bar', 'baz', 'qux']); 142 classes.removeAll(['bar', 'baz', 'qux']);
135 Expect.setEquals(['foo'], classes); 143 Expect.setEquals(['foo'], classes);
(...skipping 17 matching lines...) Expand all
153 Expect.setEquals(['foo', 'baz'], 161 Expect.setEquals(['foo', 'baz'],
154 classes.intersection(['foo', 'qux', 'baz'])); 162 classes.intersection(['foo', 'qux', 'baz']));
155 }); 163 });
156 164
157 test('clear', () { 165 test('clear', () {
158 final classes = makeClassSet(); 166 final classes = makeClassSet();
159 classes.clear(); 167 classes.clear();
160 Expect.setEquals([], classes); 168 Expect.setEquals([], classes);
161 }); 169 });
162 } 170 }
OLDNEW
« no previous file with comments | « tests/html/documentfragment_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698