OLD | NEW |
1 library streams_test; | 1 library streams_test; |
| 2 |
2 import 'package:unittest/unittest.dart'; | 3 import 'package:unittest/unittest.dart'; |
3 import 'package:unittest/html_config.dart'; | 4 import 'package:unittest/html_config.dart'; |
4 import 'dart:async'; | 5 import 'dart:async'; |
5 import 'dart:html'; | 6 import 'dart:html'; |
6 | 7 |
7 class StreamHelper { | 8 class StreamHelper { |
8 var _a; | 9 var _a; |
9 StreamHelper() { | 10 StreamHelper() { |
10 _a = new TextInputElement(); | 11 _a = new TextInputElement(); |
11 document.body.append(_a); | 12 document.body.append(_a); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 var helper = new StreamHelper(); | 51 var helper = new StreamHelper(); |
51 parent.append(helper.element); | 52 parent.append(helper.element); |
52 | 53 |
53 var childCallCount = 0; | 54 var childCallCount = 0; |
54 var parentCallCount = 0; | 55 var parentCallCount = 0; |
55 Element.focusEvent.forTarget(parent, useCapture: true).listen((Event e) { | 56 Element.focusEvent.forTarget(parent, useCapture: true).listen((Event e) { |
56 ++parentCallCount; | 57 ++parentCallCount; |
57 expect(childCallCount, 0); | 58 expect(childCallCount, 0); |
58 }); | 59 }); |
59 | 60 |
60 Element.focusEvent.forTarget(helper.element, useCapture: true).listen( | 61 Element.focusEvent |
61 (Event e) { | 62 .forTarget(helper.element, useCapture: true) |
62 ++childCallCount; | 63 .listen((Event e) { |
63 expect(parentCallCount, 1); | 64 ++childCallCount; |
64 }); | 65 expect(parentCallCount, 1); |
| 66 }); |
65 | 67 |
66 helper.pulse(); | 68 helper.pulse(); |
67 expect(childCallCount, 1); | 69 expect(childCallCount, 1); |
68 expect(parentCallCount, 1); | 70 expect(parentCallCount, 1); |
69 }); | 71 }); |
70 | 72 |
71 test('cancel', () { | 73 test('cancel', () { |
72 var helper = new StreamHelper(); | 74 var helper = new StreamHelper(); |
73 | 75 |
74 var callCount = 0; | 76 var callCount = 0; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 }); | 269 }); |
268 | 270 |
269 test('singleWhere', () { | 271 test('singleWhere', () { |
270 stream.singleWhere((_) => true).then((_) {}); | 272 stream.singleWhere((_) => true).then((_) {}); |
271 }); | 273 }); |
272 | 274 |
273 test('elementAt', () { | 275 test('elementAt', () { |
274 stream.elementAt(0).then((_) {}); | 276 stream.elementAt(0).then((_) {}); |
275 }); | 277 }); |
276 } | 278 } |
OLD | NEW |