| 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 <script src="packages/web_ui/testing/testing.js"></script> | 11 <script src="packages/web_ui/testing/testing.js"></script> |
| 12 </head> | 12 </head> |
| 13 <body> | 13 <body> |
| 14 <div id="one" class="{{value}}"></div> | 14 <div id="one" class="{{value}}"></div> |
| 15 <div id="two" class="{{value | final}}"></div> | 15 <div id="two" class="{{value | final}}"></div> |
| 16 <div id="three">{{value}}</div> | 16 <div id="three">{{value}}</div> |
| 17 <div id="four">{{value | final}}</div> | 17 <div id="four">{{value | final}}</div> |
| 18 <script type="application/dart"> | 18 <script type="application/dart"> |
| 19 import 'dart:html'; | 19 import 'dart:html'; |
| 20 import 'dart:async'; |
| 20 import 'package:web_ui/watcher.dart'; | 21 import 'package:web_ui/watcher.dart'; |
| 21 import 'package:unittest/unittest.dart'; | 22 import 'package:unittest/unittest.dart'; |
| 22 String value = 'foo'; | 23 String value = 'foo'; |
| 23 main() { | 24 main() { |
| 24 dispatch(); | 25 dispatch(); |
| 25 window.setImmediate(() { | 26 Timer.run(() { |
| 26 expect(query('#one').classes, unorderedEquals(['foo'])); | 27 expect(query('#one').classes, unorderedEquals(['foo'])); |
| 27 expect(query('#two').classes, unorderedEquals(['foo'])); | 28 expect(query('#two').classes, unorderedEquals(['foo'])); |
| 28 expect(query('#three').text, 'foo'); | 29 expect(query('#three').text, 'foo'); |
| 29 expect(query('#four').text, 'foo'); | 30 expect(query('#four').text, 'foo'); |
| 30 value = 'bar'; | 31 value = 'bar'; |
| 31 dispatch(); | 32 dispatch(); |
| 32 window.setImmediate(() { | 33 Timer.run(() { |
| 33 expect(query('#one').classes, unorderedEquals(['bar'])); | 34 expect(query('#one').classes, unorderedEquals(['bar'])); |
| 34 expect(query('#two').classes, unorderedEquals(['foo'])); | 35 expect(query('#two').classes, unorderedEquals(['foo'])); |
| 35 expect(query('#three').text, 'bar'); | 36 expect(query('#three').text, 'bar'); |
| 36 expect(query('#four').text, 'foo'); | 37 expect(query('#four').text, 'foo'); |
| 37 window.postMessage('done', '*'); | 38 window.postMessage('done', '*'); |
| 38 }); | 39 }); |
| 39 }); | 40 }); |
| 40 } | 41 } |
| 41 </script> | 42 </script> |
| 42 </body> | 43 </body> |
| 43 </html> | 44 </html> |
| OLD | NEW |