Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: tests/html/streams_test.dart

Issue 11875022: Fixing the DOM event streams test to work on FF and IE. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/streams_test.dart
diff --git a/tests/html/streams_test.dart b/tests/html/streams_test.dart
index 8d76320ad039a6e40061894a0e8376a76cafd1da..a0f3a7183777be706d9b4f6293b3c83e6d5b1291 100644
--- a/tests/html/streams_test.dart
+++ b/tests/html/streams_test.dart
@@ -6,20 +6,18 @@ import 'dart:html';
class StreamHelper {
var _a;
- var _b;
StreamHelper() {
_a = new TextInputElement();
document.body.append(_a);
- _b = new TextInputElement();
- document.body.append(_b);
}
+ Element get element => _a;
Stream<Event> get stream => _a.onFocus;
// Causes an event on a to be fired.
void pulse() {
- _b.focus();
- _a.focus();
+ var event = new Event('focus');
+ _a.$dom_dispatchEvent(event);
Jennifer Messerly 2013/01/14 21:56:51 is there a way to do this without $dom_?
blois 2013/01/14 22:00:05 Currently it's on the old events API, but I need t
}
}
@@ -27,15 +25,14 @@ main() {
useHtmlConfiguration();
test('simple', () {
- var a = new TextInputElement();
- document.body.append(a);
+ var helper = new StreamHelper();
var callCount = 0;
- a.onFocus.listen((Event e) {
+ helper.stream.listen((Event e) {
++callCount;
});
- a.focus();
+ helper.pulse();
expect(callCount, 1);
});
@@ -44,8 +41,8 @@ main() {
var parent = new DivElement();
document.body.append(parent);
- var child = new TextInputElement();
- parent.append(child);
+ var helper = new StreamHelper();
+ parent.append(helper.element);
var childCallCount = 0;
var parentCallCount = 0;
@@ -54,12 +51,13 @@ main() {
expect(childCallCount, 0);
});
- Element.focusEvent.forTarget(child, useCapture: true).listen((Event e) {
- ++childCallCount;
- expect(parentCallCount, 1);
- });
+ Element.focusEvent.forTarget(helper.element, useCapture: true).listen(
+ (Event e) {
+ ++childCallCount;
+ expect(parentCallCount, 1);
+ });
- child.focus();
+ helper.pulse();
expect(childCallCount, 1);
expect(parentCallCount, 1);
});
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698