| 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(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 var callCount = 0; | 30 var callCount = 0; |
| 31 helper.stream.listen((Event e) { | 31 helper.stream.listen((Event e) { |
| 32 ++callCount; | 32 ++callCount; |
| 33 }); | 33 }); |
| 34 | 34 |
| 35 helper.pulse(); | 35 helper.pulse(); |
| 36 expect(callCount, 1); | 36 expect(callCount, 1); |
| 37 }); | 37 }); |
| 38 | 38 |
| 39 test('broadcast', () { |
| 40 var stream = new DivElement().onClick; |
| 41 expect(stream.asBroadcastStream(), stream); |
| 42 expect(stream.isBroadcast, isTrue); |
| 43 }); |
| 44 |
| 39 // Validates that capturing events fire on parent before child. | 45 // Validates that capturing events fire on parent before child. |
| 40 test('capture', () { | 46 test('capture', () { |
| 41 var parent = new DivElement(); | 47 var parent = new DivElement(); |
| 42 document.body.append(parent); | 48 document.body.append(parent); |
| 43 | 49 |
| 44 var helper = new StreamHelper(); | 50 var helper = new StreamHelper(); |
| 45 parent.append(helper.element); | 51 parent.append(helper.element); |
| 46 | 52 |
| 47 var childCallCount = 0; | 53 var childCallCount = 0; |
| 48 var parentCallCount = 0; | 54 var parentCallCount = 0; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 }); | 276 }); |
| 271 | 277 |
| 272 test('singleMatching', () { | 278 test('singleMatching', () { |
| 273 stream.singleMatching((_) => true).then((_) {}); | 279 stream.singleMatching((_) => true).then((_) {}); |
| 274 }); | 280 }); |
| 275 | 281 |
| 276 test('elementAt', () { | 282 test('elementAt', () { |
| 277 stream.elementAt(0).then((_) {}); | 283 stream.elementAt(0).then((_) {}); |
| 278 }); | 284 }); |
| 279 } | 285 } |
| OLD | NEW |