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_activate_event_test; | 5 library polymer_elements.test.iron_selector_activate_event_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:polymer_interop/polymer_interop.dart'; | 9 import 'package:polymer_interop/polymer_interop.dart'; |
10 import 'package:polymer_elements/iron_selector.dart'; | 10 import 'package:polymer_elements/iron_selector.dart'; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // attach iron-activate listener | 105 // attach iron-activate listener |
106 s.on['iron-activate'].take(1).listen((event) { | 106 s.on['iron-activate'].take(1).listen((event) { |
107 event = convertToDart(event); | 107 event = convertToDart(event); |
108 event.preventDefault(); | 108 event.preventDefault(); |
109 }); | 109 }); |
110 // select Item 2 | 110 // select Item 2 |
111 s.children[2].dispatchEvent(new CustomEvent('tap', canBubble: true)); | 111 s.children[2].dispatchEvent(new CustomEvent('tap', canBubble: true)); |
112 // shouldn't got selected since we preventDefault in iron-activate | 112 // shouldn't got selected since we preventDefault in iron-activate |
113 expect(s.selected, '0'); | 113 expect(s.selected, '0'); |
114 }); | 114 }); |
| 115 |
| 116 test('activates after detach and re-attach', () { |
| 117 // Detach and re-attach |
| 118 var parent = s.parentNode; |
| 119 s.remove(); |
| 120 parent.append(s); |
| 121 |
| 122 // select Item 2 |
| 123 s.children[2].dispatchEvent(new CustomEvent('tap', canBubble: true)); |
| 124 expect(s.selected, 2); |
| 125 }); |
115 }); | 126 }); |
116 } | 127 } |
OLD | NEW |