fix js_interop_test for browsers without Object.observe

the test assumed Dart timing, which would be next microtask, but since this is a JS element it is updated later.

Review URL: https://codereview.chromium.org//372193003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38054 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
jmesserly@google.com
2014-07-08 08:37:14 +00:00
parent 6c25ff971f
commit 665ba650bb
+10 -1
View File
@@ -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((_) {
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);