Chromium Code Reviews| 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..1e8f8db251c837fcb017be086090e5bbc787ad1a 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(() { |
|
Siggi Cherem (dart-lang)
2013/10/21 21:07:42
... it would be nice to have a future for endOfMic
Jennifer Messerly
2013/10/21 21:42:56
agree. this is covered by another bug.
|
| + 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 |
|
Siggi Cherem (dart-lang)
2013/10/21 21:07:42
80
Jennifer Messerly
2013/10/21 21:42:56
Done.
|
| + // 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); |
| + })); |
| }); |
| } |