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

Unified Diff: pkg/polymer/test/js_interop_test.dart

Issue 372193003: fix js_interop_test for browsers without Object.observe (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/js_interop_test.dart
diff --git a/pkg/polymer/test/js_interop_test.dart b/pkg/polymer/test/js_interop_test.dart
index e4bc6aa530781cb1ea2e2997f272713378c012d4..154cd01d8a232b6882738281d1f6fee22d93af41 100644
--- a/pkg/polymer/test/js_interop_test.dart
+++ b/pkg/polymer/test/js_interop_test.dart
@@ -95,13 +95,22 @@ main() => initPolymer().run(() {
// Text will update asynchronously
expect(jsElem.shadowRoot.text, 'FOOBAR:40');
- return new Future(() {
+ return _onTextChanged(jsElem.shadowRoot).then((_) {
Siggi Cherem (dart-lang) 2014/07/08 16:50:38 could we replace this with: jsElem.onMutation(js
Jennifer Messerly 2014/07/08 18:39:18 no, for two reasons: * jsElem is a JS element so
expect(jsElem.shadowRoot.text, 'FOOBAR:42');
});
});
});
});
+Future<List<MutationRecord>> _onTextChanged(Node node) {
+ var completer = new Completer();
+ new MutationObserver((mutations, observer) {
+ observer.disconnect();
+ completer.complete(mutations);
+ })..observe(node, characterData: true, subtree: true);
+ return completer.future;
+}
+
testInterop(jsElem) {
expect(jsElem.shadowRoot.text, 'FOOBAR');
var interop = new JsObject.fromBrowserObject(jsElem);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698