| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library todomvc.test.listorder_test; | 5 library todomvc.test.listorder_test; |
| 6 | 6 |
| 7 import 'dart:async'; | |
| 8 import 'dart:html'; | 7 import 'dart:html'; |
| 9 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 11 import 'package:unittest/html_config.dart'; | 10 import 'package:unittest/html_config.dart'; |
| 12 import '../web/model.dart'; | 11 import '../web/model.dart'; |
| 13 | 12 |
| 14 /** | 13 /** |
| 15 * This test runs the TodoMVC app, adds a few elements, marks some as done, and | 14 * This test runs the TodoMVC app, adds a few elements, marks some as done, and |
| 16 * switches from back and forth between "Active" and "All". This will make some | 15 * switches from back and forth between "Active" and "All". This will make some |
| 17 * nodes to be hidden and readded to the page. | 16 * nodes to be hidden and readded to the page. |
| 18 */ | 17 */ |
| 19 main() { | 18 main() { |
| 20 useHtmlConfiguration(); | 19 useHtmlConfiguration(); |
| 21 | 20 |
| 22 final root = query('todo-app').shadowRoot; | 21 final root = query('todo-app').shadowRoot; |
| 23 | 22 |
| 24 setUp(() => new Future.delayed(Duration.ZERO)); | 23 setUp(() => Polymer.onReady); |
| 25 | 24 |
| 26 test('programmatically add items to model', () { | 25 test('programmatically add items to model', () { |
| 27 appModel.todos.addAll([ | 26 appModel.todos.addAll([ |
| 28 new Todo('one (unchecked)'), | 27 new Todo('one (unchecked)'), |
| 29 new Todo('two (checked)')..done = true, | 28 new Todo('two (checked)')..done = true, |
| 30 new Todo('three (unchecked)') | 29 new Todo('three (unchecked)') |
| 31 ]); | 30 ]); |
| 32 performMicrotaskCheckpoint(); | 31 performMicrotaskCheckpoint(); |
| 33 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); | 32 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
| 34 | 33 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 performMicrotaskCheckpoint(); | 50 performMicrotaskCheckpoint(); |
| 52 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); | 51 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
| 53 }); | 52 }); |
| 54 | 53 |
| 55 test('navigate back to #/', () { | 54 test('navigate back to #/', () { |
| 56 windowLocation.hash = '#/'; | 55 windowLocation.hash = '#/'; |
| 57 performMicrotaskCheckpoint(); | 56 performMicrotaskCheckpoint(); |
| 58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); | 57 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
| 59 }); | 58 }); |
| 60 } | 59 } |
| OLD | NEW |