Index: samples/third_party/todomvc/test/listorder_test.dart |
diff --git a/samples/third_party/todomvc/test/listorder_test.dart b/samples/third_party/todomvc/test/listorder_test.dart |
index 0d70dfadf4c516ad6189dd816cca576ce17434cf..99f684462e4a28ea36d0b55e9b8811221597d23b 100644 |
--- a/samples/third_party/todomvc/test/listorder_test.dart |
+++ b/samples/third_party/todomvc/test/listorder_test.dart |
@@ -19,9 +19,12 @@ import '../web/model.dart'; |
_main() { |
useHtmlConfiguration(); |
- final root = query('todo-app').shadowRoot; |
- setUp(() => Polymer.onReady); |
+ ShadowRoot root; |
+ |
+ setUp(() => Polymer.onReady.then((_) { |
+ root = query('todo-app').shadowRoot; |
+ })); |
test('programmatically add items to model', () { |
appModel.todos.addAll([ |
@@ -29,32 +32,36 @@ _main() { |
new Todo('two (checked)')..done = true, |
new Todo('three (unchecked)') |
]); |
- performMicrotaskCheckpoint(); |
- expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
- |
- // TODO(jmesserly): HTML Imports breaks relative hash links when the |
- // component is at a different path from the main HTML document. For now we |
- // fix it programmatically. |
- for (var a in root.queryAll('#filters > li > a')) { |
- a.href = '#${Uri.parse(a.href).fragment}'; |
- } |
+ endOfMicrotask(expectAsync0(() { |
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
+ |
+ // TODO(jmesserly): HTML Imports breaks relative hash links when the |
+ // component is at a different path from the main HTML document. For now |
+ // fix it programmatically. |
+ for (var a in root.queryAll('#filters > li > a')) { |
+ a.href = '#${Uri.parse(a.href).fragment}'; |
+ } |
+ })); |
}); |
test('navigate to #/active', () { |
windowLocation.hash = '#/active'; |
- performMicrotaskCheckpoint(); |
- expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); |
+ endOfMicrotask(expectAsync0(() { |
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); |
+ })); |
}); |
test('navigate to #/completed', () { |
windowLocation.hash = '#/completed'; |
- performMicrotaskCheckpoint(); |
- expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
+ endOfMicrotask(expectAsync0(() { |
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
+ })); |
}); |
test('navigate back to #/', () { |
windowLocation.hash = '#/'; |
- performMicrotaskCheckpoint(); |
- expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
+ endOfMicrotask(expectAsync0(() { |
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
+ })); |
}); |
} |