OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
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 | |
5 BSD-style license that can be found in the LICENSE file. | |
6 --> | |
7 <html lang="en"> | |
8 <head> | |
9 <!-- | |
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 | |
12 nodes to be hidden and readded to the page. | |
13 | |
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. | |
16 --> | |
17 <meta charset="utf-8"> | |
18 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
19 <link rel="import" href="../web/app.html"> | |
20 <link rel="stylesheet" href="../web/base.css"> | |
21 <script src="packages/web_ui/testing/testing.js"></script> | |
22 <title>Dart • TodoMVC</title> | |
23 </head> | |
24 <body> | |
25 <todo-app></todo-app> | |
26 <script type="application/dart"> | |
27 import 'dart:async'; | |
28 import 'dart:html'; | |
29 import 'package:unittest/unittest.dart'; | |
30 import 'package:web_ui/web_ui.dart'; | |
31 import 'package:web_ui/observe/html.dart'; | |
32 import '../web/model.dart'; | |
33 | |
34 main() { | |
35 useShadowDom = true; | |
36 | |
37 Timer.run(() { | |
38 app.todos.add(new Todo('one (unchecked)')); | |
39 app.todos.add(new Todo('two (checked)')..done = true); | |
40 app.todos.add(new Todo('three (unchecked)')); | |
41 locationHash = '#/'; | |
42 | |
43 var root = query('span[is=todo-app]').xtag.shadowRoot; | |
44 | |
45 deliverChangesSync(); | |
46 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); | |
47 | |
48 locationHash = '#/active'; | |
49 deliverChangesSync(); | |
50 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); | |
51 | |
52 locationHash = '#/completed'; | |
53 deliverChangesSync(); | |
54 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); | |
55 | |
56 locationHash = '#/'; | |
57 deliverChangesSync(); | |
58 window.postMessage('done', '*'); | |
59 }); | |
60 } | |
61 </script> | |
62 </body> | |
63 </html> | |
OLD | NEW |