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_selector_basic_test; | 5 library polymer_elements.test.iron_selector_basic_test; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:polymer_interop/polymer_interop.dart'; |
8 import 'package:polymer_elements/iron_selector.dart'; | 9 import 'package:polymer_elements/iron_selector.dart'; |
9 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
10 import 'package:web_components/web_components.dart'; | 11 import 'package:web_components/web_components.dart'; |
11 import 'common.dart'; | 12 import 'common.dart'; |
12 | 13 |
13 main() async { | 14 main() async { |
14 await initWebComponents(); | 15 await initWebComponents(); |
15 | 16 |
16 group('defaults', () { | 17 group('defaults', () { |
17 IronSelector s1; | 18 IronSelector s1; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 await wait(1); | 107 await wait(1); |
107 s2.children.remove(newItem); | 108 s2.children.remove(newItem); |
108 | 109 |
109 await wait(1); | 110 await wait(1); |
110 expect(changeCount, 2); | 111 expect(changeCount, 2); |
111 | 112 |
112 sub.cancel(); | 113 sub.cancel(); |
113 }); | 114 }); |
114 }); | 115 }); |
| 116 |
| 117 group('dynamic selector', () { |
| 118 test('selects dynamically added child automatically', () async { |
| 119 var selector = document.createElement('iron-selector'); |
| 120 var child = document.createElement('div'); |
| 121 |
| 122 selector.selected = '0'; |
| 123 child.text = 'Item 0'; |
| 124 |
| 125 Polymer.dom(selector).append(child); |
| 126 document.body.append(selector); |
| 127 |
| 128 await wait(1); |
| 129 expect(child.className, 'iron-selected'); |
| 130 selector.remove(); |
| 131 }); |
| 132 }); |
115 }); | 133 }); |
116 } | 134 } |
OLD | NEW |