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

Unified Diff: test/iron_media_query_test.dart

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 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 | « test/iron_localstorage_basic_test.dart ('k') | test/iron_meta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/iron_media_query_test.dart
diff --git a/test/iron_media_query_test.dart b/test/iron_media_query_test.dart
index 84e511b65aa23fd8fdc4fde1d69079e7929e29c2..defd617fd649af003ac7e6e4119094b492ade63a 100644
--- a/test/iron_media_query_test.dart
+++ b/test/iron_media_query_test.dart
@@ -4,6 +4,7 @@
@TestOn('browser')
library polymer_elements.test.iron_media_query_test;
+import 'package:polymer_interop/polymer_interop.dart';
import 'package:polymer_elements/iron_media_query.dart';
import 'package:test/test.dart';
import 'package:web_components/web_components.dart';
@@ -39,6 +40,42 @@ main() async {
mq.mediaQuery = '(max-width: 10000px)';
expect(mq.queryMatches, true);
});
+
+ test('automatically wrap with parens', () {
+ mq.mediaQuery = 'min-width: 1px';
+ expect(mq.queryMatches, true);
+ });
+
+ group('query does not activate on empty string or null', () {
+
+ test('empty string', () {
+ mq.mediaQuery = '';
+ expect(mq.jsElement['_mq'], isNull);
+ });
+
+ test('null', () {
+ mq.mediaQuery = null;
+ expect(mq.jsElement['_mq'], isNull);
+ });
+
+ });
+
+ test('media query destroys on detach', () {
+ mq.mediaQuery = '(max-width: 800px)';
+ mq.remove();
+ PolymerDom.flush();
+ expect(mq.jsElement['_mq'], isNull);
+ });
+
+ test('media query re-enables on attach', () {
+ mq.mediaQuery = '(max-width: 800px)';
+ var parent = mq.parentNode;
+ mq.remove();
+ PolymerDom.flush();
+ parent.append(mq);
+ PolymerDom.flush();
+ expect(mq.jsElement['_mq'], isNotNull);
+ });
});
});
}
« no previous file with comments | « test/iron_localstorage_basic_test.dart ('k') | test/iron_meta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698