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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user