| 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() { |
| 83 useShadowDom = true; |
| 82 todomvc_main.main(); | 84 todomvc_main.main(); |
| 83 | 85 |
| 84 window.setTimeout(() { | 86 window.setTimeout(() { |
| 85 app.todos.add(new Todo('one (unchecked)')); | 87 app.todos.add(new Todo('one (unchecked)')); |
| 86 app.todos.add(new Todo('two (checked)')..done = true); | 88 app.todos.add(new Todo('two (checked)')..done = true); |
| 87 app.todos.add(new Todo('three (unchecked)')); | 89 app.todos.add(new Todo('three (unchecked)')); |
| 88 viewModel.showIncomplete = true; | 90 locationHash = '#/'; |
| 89 viewModel.showDone = true; | |
| 90 dispatch(); | |
| 91 | 91 |
| 92 window.setTimeout(() { | 92 deliverChangesSync(); |
| 93 viewModel.showIncomplete = true; | 93 expect(queryAll('#todo-list x-todo-row').length, 3); |
| 94 viewModel.showDone = false; | 94 |
| 95 dispatch(); | 95 locationHash = '#/active'; |
| 96 window.setTimeout(() { | 96 deliverChangesSync(); |
| 97 viewModel.showIncomplete = true; | 97 expect(queryAll('#todo-list x-todo-row').length, 2); |
| 98 viewModel.showDone = true; | 98 |
| 99 dispatch(); | 99 locationHash = '#/completed'; |
| 100 window.setTimeout(() => window.postMessage('done', '*'), 0); | 100 deliverChangesSync(); |
| 101 }, 0); | 101 expect(queryAll('#todo-list x-todo-row').length, 1); |
| 102 }, 0); | 102 |
| 103 locationHash = '#/'; |
| 104 deliverChangesSync(); |
| 105 window.postMessage('done', '*'); |
| 103 }, 0); | 106 }, 0); |
| 104 } | 107 } |
| 105 </script> | 108 </script> |
| 106 </body> | 109 </body> |
| 107 </html> | 110 </html> |
| OLD | NEW |