| OLD | NEW |
| 1 library streams_test; | 1 library streams_test; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:async'; | 4 import 'dart:async'; |
| 5 import 'dart:html'; | 5 import 'dart:html'; |
| 6 | 6 |
| 7 class StreamHelper { | 7 class StreamHelper { |
| 8 var _a; | 8 var _a; |
| 9 StreamHelper() { | 9 StreamHelper() { |
| 10 _a = new TextInputElement(); | 10 _a = new TextInputElement(); |
| 11 document.body.append(_a); | 11 document.body.append(_a); |
| 12 } | 12 } |
| 13 | 13 |
| 14 Element get element => _a; | 14 Element get element => _a; |
| 15 Stream<Event> get stream => _a.onFocus; | 15 Stream<Event> get stream => _a.onFocus; |
| 16 | 16 |
| 17 // Causes an event on a to be fired. | 17 // Causes an event on a to be fired. |
| 18 void pulse() { | 18 void pulse() { |
| 19 var event = new Event('focus'); | 19 var event = new Event('focus'); |
| 20 _a.$dom_dispatchEvent(event); | 20 _a.dispatchEvent(event); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 main() { | 24 main() { |
| 25 useHtmlConfiguration(); | 25 useHtmlConfiguration(); |
| 26 | 26 |
| 27 test('simple', () { | 27 test('simple', () { |
| 28 var helper = new StreamHelper(); | 28 var helper = new StreamHelper(); |
| 29 | 29 |
| 30 var callCount = 0; | 30 var callCount = 0; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 ++callCountOne; | 163 ++callCountOne; |
| 164 }); | 164 }); |
| 165 helper.pulse(); | 165 helper.pulse(); |
| 166 expect(callCountOne, 1); | 166 expect(callCountOne, 1); |
| 167 | 167 |
| 168 subscription.onData(null); | 168 subscription.onData(null); |
| 169 helper.pulse(); | 169 helper.pulse(); |
| 170 expect(callCountOne, 1); | 170 expect(callCountOne, 1); |
| 171 }); | 171 }); |
| 172 } | 172 } |
| OLD | NEW |