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

Unified Diff: tests/html/svgelement_test.dart

Issue 1077203004: Enforce token syntax for CssClassSet arguments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix --checked contains test Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/element_classes_test.dart ('k') | tools/dom/src/CssClassSet.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/svgelement_test.dart
diff --git a/tests/html/svgelement_test.dart b/tests/html/svgelement_test.dart
index 776ecf8745ad7c8b88f376de0f78c8a86d0528c4..2b573ca97cc477ed5afd8970af1c701ed970164e 100644
--- a/tests/html/svgelement_test.dart
+++ b/tests/html/svgelement_test.dart
@@ -424,6 +424,33 @@ main() {
classes.toggle('foo');
expect(el.classes.length, 0);
});
+
+ test('classes-add-bad', () {
+ var el = new svg.CircleElement();
+ expect(() => el.classes.add(''), throws);
+ expect(() => el.classes.add('foo bar'), throws);
+ });
+ test('classes-remove-bad', () {
+ var el = new svg.CircleElement();
+ expect(() => el.classes.remove(''), throws);
+ expect(() => el.classes.remove('foo bar'), throws);
+ });
+ test('classes-toggle-token', () {
+ var el = new svg.CircleElement();
+ expect(() => el.classes.toggle(''), throws);
+ expect(() => el.classes.toggle('', true), throws);
+ expect(() => el.classes.toggle('', false), throws);
+ expect(() => el.classes.toggle('foo bar'), throws);
+ expect(() => el.classes.toggle('foo bar', true), throws);
+ expect(() => el.classes.toggle('foo bar', false), throws);
+ });
+ test('classes-contains-bad', () {
+ var el = new svg.CircleElement();
+ // Non-strings => false, strings must be valid tokens.
+ expect(el.classes.contains(1), isFalse);
+ expect(() => el.classes.contains(''), throws);
+ expect(() => el.classes.contains('foo bar'), throws);
+ });
});
group('getBoundingClientRect', () {
« no previous file with comments | « tests/html/element_classes_test.dart ('k') | tools/dom/src/CssClassSet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698