OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html lang="en"> | 7 <html lang="en"> |
8 <head> | 8 <head> |
9 <!-- | 9 <!-- |
10 This test runs the TodoMVC app, adds a few elements, marks some as done, and | 10 This test runs the TodoMVC app, adds a few elements, marks some as done, and |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 <a href="https://www.dartlang.org/articles/dart-web-components/">Dart + We
b Components</a> | 66 <a href="https://www.dartlang.org/articles/dart-web-components/">Dart + We
b Components</a> |
67 or | 67 or |
68 <a href="https://github.com/dart-lang/web-ui/tree/master/example/todomvc">
view the source</a>. | 68 <a href="https://github.com/dart-lang/web-ui/tree/master/example/todomvc">
view the source</a>. |
69 </p> | 69 </p> |
70 <p>Part of <a href="http://todomvc.com">TodoMVC</a>.</p> | 70 <p>Part of <a href="http://todomvc.com">TodoMVC</a>.</p> |
71 </footer> | 71 </footer> |
72 <script type="application/dart"> | 72 <script type="application/dart"> |
73 import 'dart:html'; | 73 import 'dart:html'; |
74 import 'package:unittest/unittest.dart'; | 74 import 'package:unittest/unittest.dart'; |
75 import 'package:web_ui/web_ui.dart'; | 75 import 'package:web_ui/web_ui.dart'; |
| 76 import 'package:web_ui/observe/html.dart'; |
76 import 'example/todomvc/main.dart' as todomvc_main; | 77 import 'example/todomvc/main.dart' as todomvc_main; |
77 import 'example/todomvc/model.dart'; | 78 import 'example/todomvc/model.dart'; |
78 | 79 |
79 final addTodo = todomvc_main.addTodo; | 80 final addTodo = todomvc_main.addTodo; |
80 | 81 |
81 main() { | 82 main() { |
82 useShadowDom = true; | 83 useShadowDom = true; |
83 todomvc_main.main(); | 84 todomvc_main.main(); |
84 | 85 |
85 window.setTimeout(() { | 86 window.setTimeout(() { |
86 app.todos.add(new Todo('one (unchecked)')); | 87 app.todos.add(new Todo('one (unchecked)')); |
87 app.todos.add(new Todo('two (checked)')..done = true); | 88 app.todos.add(new Todo('two (checked)')..done = true); |
88 app.todos.add(new Todo('three (unchecked)')); | 89 app.todos.add(new Todo('three (unchecked)')); |
89 viewModel.showIncomplete = true; | 90 locationHash = '#/'; |
90 viewModel.showDone = true; | |
91 dispatch(); | |
92 | 91 |
93 window.setTimeout(() { | 92 deliverChangesSync(); |
94 viewModel.showIncomplete = true; | 93 expect(queryAll('#todo-list x-todo-row').length, 3); |
95 viewModel.showDone = false; | 94 |
96 dispatch(); | 95 locationHash = '#/active'; |
97 window.setTimeout(() { | 96 deliverChangesSync(); |
98 viewModel.showIncomplete = true; | 97 expect(queryAll('#todo-list x-todo-row').length, 2); |
99 viewModel.showDone = true; | 98 |
100 dispatch(); | 99 locationHash = '#/completed'; |
101 window.setTimeout(() => window.postMessage('done', '*'), 0); | 100 deliverChangesSync(); |
102 }, 0); | 101 expect(queryAll('#todo-list x-todo-row').length, 1); |
103 }, 0); | 102 |
| 103 locationHash = '#/'; |
| 104 deliverChangesSync(); |
| 105 window.postMessage('done', '*'); |
104 }, 0); | 106 }, 0); |
105 } | 107 } |
106 </script> | 108 </script> |
107 </body> | 109 </body> |
108 </html> | 110 </html> |
OLD | NEW |