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