| Index: samples/third_party/todomvc/test/mainpage_test.dart
|
| diff --git a/samples/third_party/todomvc/test/mainpage_test.dart b/samples/third_party/todomvc/test/mainpage_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e1f4dde4f4d5712b52517b52b4f25cdb32df9fe0
|
| --- /dev/null
|
| +++ b/samples/third_party/todomvc/test/mainpage_test.dart
|
| @@ -0,0 +1,38 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +library todomvc.test.mainpage_test;
|
| +
|
| +import 'dart:async';
|
| +import 'dart:html';
|
| +import 'package:polymer/polymer.dart';
|
| +import 'package:unittest/unittest.dart';
|
| +import 'package:unittest/html_config.dart';
|
| +import '../web/app.dart';
|
| +import '../web/model.dart';
|
| +
|
| +/**
|
| + * This test runs the TodoMVC app and checks the state of the initial page.
|
| + */
|
| +// TODO(jmesserly): verify some styles (colors, fonts, relative size) as well.
|
| +main() {
|
| + useHtmlConfiguration();
|
| +
|
| + test('initial state', () {
|
| + final todoApp = query('todo-app');
|
| + expect(appModel.todos.length, 0);
|
| + expect(todoApp.xtag is TodoApp, true, reason: 'TodoApp should bee created');
|
| +
|
| + final root = todoApp.shadowRoot;
|
| + final newTodo = root.query('#new-todo');
|
| + expect(newTodo.placeholder, "What needs to be done?");
|
| +
|
| + // Wait for setTimeout 0 for focus to activate.
|
| + Timer.run(expectAsync0(() {
|
| + expect(document.activeElement, todoApp, reason: 'app should have focus');
|
| + expect(root.activeElement, newTodo, reason: 'New todo should have focus');
|
| + expect(root.queryAll('[is=todo-row]').length, 0, reason: 'no items yet');
|
| + }));
|
| + });
|
| +}
|
|
|