| 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.mainpage_test; | 5 library todomvc.test.mainpage_test; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 9 import 'package:unittest/html_config.dart'; | 9 import 'package:unittest/html_config.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 import '../web/app.dart'; | 11 import '../web/app.dart'; |
| 12 import '../web/model.dart'; | 12 import '../web/model.dart'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * This test runs the TodoMVC app and checks the state of the initial page. | 15 * This test runs the TodoMVC app and checks the state of the initial page. |
| 16 */ | 16 */ |
| 17 // TODO(jmesserly): verify some styles (colors, fonts, relative size) as well. | 17 // TODO(jmesserly): verify some styles (colors, fonts, relative size) as well. |
| 18 main() { | 18 main() { |
| 19 initPolymer(); | 19 initPolymer(); |
| 20 useHtmlConfiguration(); | 20 useHtmlConfiguration(); |
| 21 | 21 |
| 22 setUp(() => Polymer.onReady); | 22 setUp(() => Polymer.onReady); |
| 23 | 23 |
| 24 test('initial state', () { | 24 test('initial state', () { |
| 25 final todoApp = query('todo-app'); | 25 final todoApp = querySelector('todo-app'); |
| 26 expect(appModel.todos.length, 0); | 26 expect(appModel.todos.length, 0); |
| 27 expect(todoApp.xtag is TodoApp, true, reason: 'TodoApp should be created'); | 27 expect(todoApp.xtag is TodoApp, true, reason: 'TodoApp should be created'); |
| 28 | 28 |
| 29 final root = todoApp.shadowRoot; | 29 final root = todoApp.shadowRoot; |
| 30 final newTodo = root.query('#new-todo'); | 30 final newTodo = root.querySelector('#new-todo'); |
| 31 expect(newTodo.placeholder, "What needs to be done?"); | 31 expect(newTodo.placeholder, "What needs to be done?"); |
| 32 | 32 |
| 33 // TODO(jmesserly): re-enable this. It fails on Firefox with ShadowDOM. | 33 // TODO(jmesserly): re-enable this. It fails on Firefox with ShadowDOM. |
| 34 // The issue appears to be that | 34 // The issue appears to be that |
| 35 // Wait for setTimeout 0 for focus to activate. | 35 // Wait for setTimeout 0 for focus to activate. |
| 36 /*Timer.run(expectAsync0(() { | 36 /*Timer.run(expectAsync0(() { |
| 37 expect(document.activeElement, todoApp, reason: 'app should have focus'); | 37 expect(document.activeElement, todoApp, reason: 'app should have focus'); |
| 38 expect(root.activeElement, newTodo, reason: 'New todo should have focus'); | 38 expect(root.activeElement, newTodo, reason: 'New todo should have focus'); |
| 39 expect(root.queryAll('[is=todo-row]').length, 0, reason: 'no items yet'); | 39 expect(root.querySelectorAll('[is=todo-row]').length, 0, reason: 'no items
yet'); |
| 40 }));*/ | 40 }));*/ |
| 41 }); | 41 }); |
| 42 } | 42 } |
| OLD | NEW |