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

Side by Side 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, 1 month 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
« no previous file with comments | « test/iron_localstorage_basic_test.dart ('k') | test/iron_meta_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @TestOn('browser') 4 @TestOn('browser')
5 library polymer_elements.test.iron_media_query_test; 5 library polymer_elements.test.iron_media_query_test;
6 6
7 import 'package:polymer_interop/polymer_interop.dart';
7 import 'package:polymer_elements/iron_media_query.dart'; 8 import 'package:polymer_elements/iron_media_query.dart';
8 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
9 import 'package:web_components/web_components.dart'; 10 import 'package:web_components/web_components.dart';
10 import 'common.dart'; 11 import 'common.dart';
11 12
12 main() async { 13 main() async {
13 await initWebComponents(); 14 await initWebComponents();
14 15
15 group('basic', () { 16 group('basic', () {
16 IronMediaQuery mq; 17 IronMediaQuery mq;
(...skipping 15 matching lines...) Expand all
32 33
33 test('small max-width value', () { 34 test('small max-width value', () {
34 mq.mediaQuery = '(max-width: 1px)'; 35 mq.mediaQuery = '(max-width: 1px)';
35 expect(mq.queryMatches, false); 36 expect(mq.queryMatches, false);
36 }); 37 });
37 38
38 test('large max-width value', () { 39 test('large max-width value', () {
39 mq.mediaQuery = '(max-width: 10000px)'; 40 mq.mediaQuery = '(max-width: 10000px)';
40 expect(mq.queryMatches, true); 41 expect(mq.queryMatches, true);
41 }); 42 });
43
44 test('automatically wrap with parens', () {
45 mq.mediaQuery = 'min-width: 1px';
46 expect(mq.queryMatches, true);
47 });
48
49 group('query does not activate on empty string or null', () {
50
51 test('empty string', () {
52 mq.mediaQuery = '';
53 expect(mq.jsElement['_mq'], isNull);
54 });
55
56 test('null', () {
57 mq.mediaQuery = null;
58 expect(mq.jsElement['_mq'], isNull);
59 });
60
61 });
62
63 test('media query destroys on detach', () {
64 mq.mediaQuery = '(max-width: 800px)';
65 mq.remove();
66 PolymerDom.flush();
67 expect(mq.jsElement['_mq'], isNull);
68 });
69
70 test('media query re-enables on attach', () {
71 mq.mediaQuery = '(max-width: 800px)';
72 var parent = mq.parentNode;
73 mq.remove();
74 PolymerDom.flush();
75 parent.append(mq);
76 PolymerDom.flush();
77 expect(mq.jsElement['_mq'], isNotNull);
78 });
42 }); 79 });
43 }); 80 });
44 } 81 }
OLDNEW
« 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