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 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
11 <title>watch_global_var_test</title> | 11 <title>watch_global_var_test</title> |
12 <script type='application/javascript' src="testing.js"></script> | 12 <script type='application/javascript' src="testing.js"></script> |
13 </head> | 13 </head> |
14 <body> | 14 <body> |
15 <p>These two sentences should match:</p> | 15 <p>These two sentences should match:</p> |
16 <pre id="expected">The quick brown [fox, jumps] over the {lazy: dog}.</pre> | 16 <pre id="expected">The quick brown [fox, jumps] over the {lazy: dog}.</pre> |
17 <pre id="actual">The quick brown {{list}} over the {{map}}.</pre> | 17 <pre id="actual">The quick brown {{list}} over the {{map}}.</pre> |
18 <script type="application/dart"> | 18 <script type="application/dart"> |
19 import 'dart:html'; | 19 import 'dart:html'; |
20 import 'package:unittest/unittest.dart'; | 20 import 'package:unittest/unittest.dart'; |
21 import 'package:web_components/watcher.dart'; | 21 import 'package:web_ui/watcher.dart'; |
22 | 22 |
23 List list = ['initial', 'list state']; | 23 List list = ['initial', 'list state']; |
24 Map map = {'initial': 'map', 'state': '!'}; | 24 Map map = {'initial': 'map', 'state': '!'}; |
25 final expected = query('#expected'); | 25 final expected = query('#expected'); |
26 final actual = query('#actual'); | 26 final actual = query('#actual'); |
27 | 27 |
28 main() { | 28 main() { |
29 window.setTimeout(() { | 29 window.setTimeout(() { |
30 expect(actual.innerHtml, 'The quick brown [initial, list state] over ' | 30 expect(actual.innerHtml, 'The quick brown [initial, list state] over ' |
31 'the {initial: map, state: !}.'); | 31 'the {initial: map, state: !}.'); |
32 | 32 |
33 list[0] = 'fox'; | 33 list[0] = 'fox'; |
34 list[1] = 'jumps'; | 34 list[1] = 'jumps'; |
35 map.clear(); | 35 map.clear(); |
36 map['lazy'] = 'dog'; | 36 map['lazy'] = 'dog'; |
37 | 37 |
38 dispatch(); | 38 dispatch(); |
39 | 39 |
40 expect(actual.innerHtml, expected.innerHtml); | 40 expect(actual.innerHtml, expected.innerHtml); |
41 | 41 |
42 window.setTimeout(() => window.postMessage('done', '*'), 0); | 42 window.setTimeout(() => window.postMessage('done', '*'), 0); |
43 }, 0); | 43 }, 0); |
44 } | 44 } |
45 </script> | 45 </script> |
46 </body> | 46 </body> |
47 </html> | 47 </html> |
OLD | NEW |