OLD | NEW |
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_collapse_test; | 5 library polymer_elements.test.iron_collapse_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'package:polymer_elements/iron_collapse.dart'; | 8 import 'package:polymer_elements/iron_collapse.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:web_components/web_components.dart'; | 10 import 'package:web_components/web_components.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return new Future.delayed(delay, () { | 53 return new Future.delayed(delay, () { |
54 var h = collapse.getComputedStyle().height; | 54 var h = collapse.getComputedStyle().height; |
55 // verify height | 55 // verify height |
56 expect(h, collapseHeight); | 56 expect(h, collapseHeight); |
57 }); | 57 }); |
58 }); | 58 }); |
59 }); | 59 }); |
60 | 60 |
61 group('horizontal', () { | 61 group('horizontal', () { |
62 IronCollapse collapse; | 62 IronCollapse collapse; |
63 var delay = new Duration(milliseconds: 500); | 63 var delay = 500; |
64 var width; | 64 var width; |
65 | 65 |
66 setUp(() { | 66 setUp(() { |
67 collapse = fixture('horizontal'); | 67 collapse = fixture('horizontal'); |
68 }); | 68 }); |
69 | 69 |
70 test('opened attribute', () { | 70 test('opened attribute', () { |
71 expect(collapse.opened, true); | 71 expect(collapse.opened, true); |
72 }); | 72 }); |
73 | 73 |
74 test('horizontal attribute', () { | 74 test('horizontal attribute', () { |
75 expect(collapse.horizontal, true); | 75 expect(collapse.horizontal, true); |
76 }); | 76 }); |
77 | 77 |
78 test('default opened width', () { | 78 test('default opened width', () async { |
79 return new Future.delayed(delay, () { | 79 await wait(delay); |
80 // store height | 80 // store height |
81 width = collapse.getComputedStyle().width; | 81 width = collapse.getComputedStyle().width; |
82 // verify height not 0px | 82 // verify height not 0px |
83 expect(width, isNot('0px')); | 83 expect(width, isNot('0px')); |
84 }); | |
85 }); | 84 }); |
86 | 85 |
87 test('set opened to false', () { | 86 test('set opened to false', () async { |
88 collapse.opened = false; | 87 collapse.opened = false; |
89 return new Future.delayed(delay, () { | 88 await wait(delay); |
90 var w = collapse.getComputedStyle().width; | 89 var w = collapse.getComputedStyle().width; |
91 // verify height is 0px | 90 // verify height is 0px |
92 expect(w, '0px'); | 91 expect(w, '0px'); |
93 }); | |
94 }); | 92 }); |
95 | 93 |
96 test('set opened to true', () { | 94 test('set opened to true', () async { |
97 collapse.opened = true; | 95 collapse.opened = true; |
98 return new Future.delayed(delay, () { | 96 await wait(delay); |
99 var w = collapse.getComputedStyle().width; | 97 var w = collapse.getComputedStyle().width; |
100 // verify height | 98 // verify height |
101 expect(w, width); | 99 expect(w, width); |
102 }); | |
103 }); | 100 }); |
104 }); | 101 }); |
105 } | 102 } |
OLD | NEW |