| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2013, 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 |
| 11 switches from back and forth between "Active" and "All". This will make some | 11 switches from back and forth between "Active" and "All". This will make some |
| 12 nodes to be hidden and readded to the page. | 12 nodes to be hidden and readded to the page. |
| 13 | 13 |
| 14 This is a regression test for a bug in dwc that made the nodes appear in the | 14 This is a regression test for a bug in dwc that made the nodes appear in the |
| 15 wrong order when using lists and ifs together. | 15 wrong order when using lists and ifs together. |
| 16 --> | 16 --> |
| 17 <meta charset="utf-8"> | 17 <meta charset="utf-8"> |
| 18 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 18 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 19 <link rel="components" href="../web/app.html"> | 19 <link rel="components" href="../web/app.html"> |
| 20 <link rel="stylesheet" href="../web/base.css"> | 20 <link rel="stylesheet" href="../web/base.css"> |
| 21 <script src="packages/web_ui/testing/testing.js"></script> | 21 <script src="packages/web_ui/testing/testing.js"></script> |
| 22 <title>Dart • TodoMVC</title> | 22 <title>Dart • TodoMVC</title> |
| 23 </head><body> | 23 </head> |
| 24 <body> |
| 24 <todo-app></todo-app> | 25 <todo-app></todo-app> |
| 25 <script type="application/dart"> | 26 <script type="application/dart"> |
| 26 import 'dart:async'; | 27 import 'dart:async'; |
| 27 import 'dart:html'; | 28 import 'dart:html'; |
| 28 import 'package:unittest/unittest.dart'; | 29 import 'package:unittest/unittest.dart'; |
| 29 import 'package:web_ui/web_ui.dart'; | 30 import 'package:web_ui/web_ui.dart'; |
| 30 import 'package:web_ui/observe/html.dart'; | 31 import 'package:web_ui/observe/html.dart'; |
| 31 import '../web/model.dart'; | 32 import '../web/model.dart'; |
| 32 | 33 |
| 33 main() { | 34 main() { |
| 34 useShadowDom = true; | 35 useShadowDom = true; |
| 35 | 36 |
| 36 Timer.run(() { | 37 Timer.run(() { |
| 37 app.todos.add(new Todo('one (unchecked)')); | 38 app.todos.add(new Todo('one (unchecked)')); |
| 38 app.todos.add(new Todo('two (checked)')..done = true); | 39 app.todos.add(new Todo('two (checked)')..done = true); |
| 39 app.todos.add(new Todo('three (unchecked)')); | 40 app.todos.add(new Todo('three (unchecked)')); |
| 40 locationHash = '#/'; | 41 locationHash = '#/'; |
| 41 | 42 |
| 42 var root = query('todo-app').xtag.shadowRoot; | 43 var root = query('span[is=todo-app]').xtag.shadowRoot; |
| 43 | 44 |
| 44 deliverChangesSync(); | 45 deliverChangesSync(); |
| 45 expect(root.queryAll('#todo-list todo-row').length, 3); | 46 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
| 46 | 47 |
| 47 locationHash = '#/active'; | 48 locationHash = '#/active'; |
| 48 deliverChangesSync(); | 49 deliverChangesSync(); |
| 49 expect(root.queryAll('#todo-list todo-row').length, 2); | 50 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); |
| 50 | 51 |
| 51 locationHash = '#/completed'; | 52 locationHash = '#/completed'; |
| 52 deliverChangesSync(); | 53 deliverChangesSync(); |
| 53 expect(root.queryAll('#todo-list todo-row').length, 1); | 54 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
| 54 | 55 |
| 55 locationHash = '#/'; | 56 locationHash = '#/'; |
| 56 deliverChangesSync(); | 57 deliverChangesSync(); |
| 57 window.postMessage('done', '*'); | 58 window.postMessage('done', '*'); |
| 58 }); | 59 }); |
| 59 } | 60 } |
| 60 </script> | 61 </script> |
| 61 </body> | 62 </body> |
| 62 </html> | 63 </html> |
| OLD | NEW |