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="import" href="../web/app.html"> | 19 <link rel="import" 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/polymer/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:html'; | 27 import 'dart:html'; |
| 28 import 'package:polymer/polymer.dart'; |
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/observe/html.dart'; | |
31 import '../web/model.dart'; | 30 import '../web/model.dart'; |
32 | 31 |
33 main() { | 32 main() { |
34 useShadowDom = false; | 33 appModel.todos.add(new Todo('one (unchecked)')); |
| 34 appModel.todos.add(new Todo('two (checked)')..done = true); |
| 35 appModel.todos.add(new Todo('three (unchecked)')); |
35 | 36 |
36 Timer.run(() { | 37 var root = query('todo-app').xtag.shadowRoot; |
37 app.todos.add(new Todo('one (unchecked)')); | |
38 app.todos.add(new Todo('two (checked)')..done = true); | |
39 app.todos.add(new Todo('three (unchecked)')); | |
40 locationHash = '#/'; | |
41 | 38 |
42 deliverChangesSync(); | 39 windowLocation.hash = '#/'; |
43 expect(queryAll('#todo-list li[is=todo-row]').length, 3); | 40 performMicrotaskCheckpoint(); |
44 | 41 |
45 locationHash = '#/active'; | 42 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); |
46 deliverChangesSync(); | 43 windowLocation.hash = '#/active'; |
47 expect(queryAll('#todo-list li[is=todo-row]').length, 2); | 44 performMicrotaskCheckpoint(); |
48 | 45 |
49 locationHash = '#/completed'; | 46 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); |
50 deliverChangesSync(); | 47 windowLocation.hash = '#/completed'; |
51 expect(queryAll('#todo-list li[is=todo-row]').length, 1); | 48 performMicrotaskCheckpoint(); |
52 | 49 |
53 locationHash = '#/'; | 50 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); |
54 deliverChangesSync(); | 51 windowLocation.hash = '#/'; |
55 window.postMessage('done', '*'); | 52 performMicrotaskCheckpoint(); |
56 }); | 53 |
| 54 window.postMessage('done', '*'); |
57 } | 55 } |
58 </script> | 56 </script> |
59 </body> | 57 </body> |
60 </html> | 58 </html> |
OLD | NEW |