| 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'; |
| 7 import 'dart:html'; | 8 import 'dart:html'; |
| 8 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 10 import 'package:unittest/html_config.dart'; | 11 import 'package:unittest/html_config.dart'; |
| 11 import '../web/model.dart'; | 12 import '../web/model.dart'; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * This test runs the TodoMVC app, adds a few elements, marks some as done, and | 15 * This test runs the TodoMVC app, adds a few elements, marks some as done, and |
| 15 * switches from back and forth between "Active" and "All". This will make some | 16 * switches from back and forth between "Active" and "All". This will make some |
| 16 * nodes to be hidden and readded to the page. | 17 * nodes to be hidden and readded to the page. |
| 17 */ | 18 */ |
| 18 main() { | 19 main() { |
| 19 useHtmlConfiguration(); | 20 useHtmlConfiguration(); |
| 20 | 21 |
| 21 final root = query('todo-app').shadowRoot; | 22 final root = query('todo-app').shadowRoot; |
| 22 | 23 |
| 24 setUp(() => new Future.delayed(Duration.ZERO)); |
| 25 |
| 23 test('programmatically add items to model', () { | 26 test('programmatically add items to model', () { |
| 24 appModel.todos.addAll([ | 27 appModel.todos.addAll([ |
| 25 new Todo('one (unchecked)'), | 28 new Todo('one (unchecked)'), |
| 26 new Todo('two (checked)')..done = true, | 29 new Todo('two (checked)')..done = true, |
| 27 new Todo('three (unchecked)') | 30 new Todo('three (unchecked)') |
| 28 ]); | 31 ]); |
| 29 performMicrotaskCheckpoint(); | 32 performMicrotaskCheckpoint(); |
| 30 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); | 33 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
| 31 | 34 |
| 32 // TODO(jmesserly): HTML Imports breaks relative hash links when the | 35 // TODO(jmesserly): HTML Imports breaks relative hash links when the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 48 performMicrotaskCheckpoint(); | 51 performMicrotaskCheckpoint(); |
| 49 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); | 52 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
| 50 }); | 53 }); |
| 51 | 54 |
| 52 test('navigate back to #/', () { | 55 test('navigate back to #/', () { |
| 53 windowLocation.hash = '#/'; | 56 windowLocation.hash = '#/'; |
| 54 performMicrotaskCheckpoint(); | 57 performMicrotaskCheckpoint(); |
| 55 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); | 58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
| 56 }); | 59 }); |
| 57 } | 60 } |
| OLD | NEW |