Index: pkg/polymer/test/noscript_test.dart |
diff --git a/pkg/polymer/test/noscript_test.dart b/pkg/polymer/test/noscript_test.dart |
index d6387138bd306688caa43a716f7a7d01f2f387d1..bdbcb6f99b1d88c1b387cad7d3257c72ce5833f2 100644 |
--- a/pkg/polymer/test/noscript_test.dart |
+++ b/pkg/polymer/test/noscript_test.dart |
@@ -2,18 +2,32 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+import 'dart:async'; |
import 'dart:html'; |
import 'package:unittest/unittest.dart'; |
import 'package:unittest/html_config.dart'; |
import 'package:polymer/polymer.dart'; |
import 'package:template_binding/template_binding.dart'; |
-main() { |
- initPolymer(); |
+Future<List<MutationRecord>> onMutation(Node node) { |
+ var completer = new Completer(); |
+ new MutationObserver((mutations, observer) { |
+ observer.disconnect(); |
+ completer.complete(mutations); |
+ })..observe(node, childList: true, subtree: true); |
+ return completer.future; |
+} |
+ |
+main() => initPolymer().run(() { |
useHtmlConfiguration(); |
- templateBind(querySelector("#a")).model = "foo"; |
Jennifer Messerly
2014/02/08 01:13:29
this test was crazy before--no synchronization. I'
|
- setUp(() => Polymer.onReady); |
+ var ready = Polymer.onReady.then((_) { |
+ var a = querySelector("#a"); |
+ templateBind(a).model = "foo"; |
+ return onMutation(a.parent); |
+ }); |
+ |
+ setUp(() => ready); |
test('template found with multiple noscript declarations', () { |
expect(querySelector('x-a') is PolymerElement, isTrue); |
@@ -28,4 +42,4 @@ main() { |
expect(querySelector('x-d') is PolymerElement, isTrue); |
expect(querySelector('x-d').shadowRoot.nodes.first.text, 'd'); |
}); |
-} |
+}); |