| 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_a11y_announcer_test; | 5 library polymer_elements.test.iron_a11y_announcer_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:js'; |
| 9 import 'package:polymer_elements/iron_a11y_announcer.dart'; | 10 import 'package:polymer_elements/iron_a11y_announcer.dart'; |
| 10 import 'package:web_components/web_components.dart'; | 11 import 'package:web_components/web_components.dart'; |
| 11 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
| 12 | 13 |
| 13 main() async { | 14 main() async { |
| 14 await initWebComponents(); | 15 await initWebComponents(); |
| 15 | 16 |
| 16 group('<iron-a11y-announcer', () { | 17 group('<iron-a11y-announcer', () { |
| 17 IronA11yAnnouncer announcer; | 18 IronA11yAnnouncer announcer; |
| 18 | 19 |
| 19 setUp(() { | 20 setUp(() { |
| 20 announcer = new IronA11yAnnouncer(); | 21 announcer = new IronA11yAnnouncer(); |
| 21 }); | 22 }); |
| 22 | 23 |
| 23 test('announces when there is an iron-announce event', () async { | 24 test('announces when there is an iron-announce event', () async { |
| 24 var event = new CustomEvent('iron-announce', | 25 announcer.fire('iron-announce', |
| 25 canBubble: true, detail: {'text': 'foo'}); | 26 detail: {'text': 'foo'}, node: document.body); |
| 26 document.body.dispatchEvent(event); | |
| 27 // Text isn't set for 100ms | 27 // Text isn't set for 100ms |
| 28 await new Future.delayed(new Duration(milliseconds: 200), () {}); | 28 await new Future.delayed(new Duration(milliseconds: 200), () {}); |
| 29 expect(announcer.jsElement['_text'], 'foo'); | 29 expect(announcer.jsElement['_text'], 'foo'); |
| 30 }); | 30 }); |
| 31 }); | 31 }); |
| 32 } | 32 } |
| OLD | NEW |