| 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 <element name="x-my-input" extends="input"> | 15 <element name="x-my-input" extends="input"> |
| 16 <template></template> | 16 <template></template> |
| 17 <script type="application/dart"> | 17 <script type="application/dart"> |
| 18 import 'package:web_components/web_components.dart'; | 18 import 'package:web_ui/web_ui.dart'; |
| 19 class MyInput extends WebComponent { | 19 class MyInput extends WebComponent { |
| 20 int clicked; | 20 int clicked; |
| 21 created() { | 21 created() { |
| 22 clicked = 0; | 22 clicked = 0; |
| 23 } | 23 } |
| 24 inserted() { | 24 inserted() { |
| 25 on.click.add((e) { clicked++; }); | 25 on.click.add((e) { clicked++; }); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 </script> | 28 </script> |
| 29 </element> | 29 </element> |
| 30 <form> | 30 <form> |
| 31 <!-- TODO(jmesserly): if fix #82 we can use <x-my-input> tags. --> | 31 <!-- TODO(jmesserly): if fix #82 we can use <x-my-input> tags. --> |
| 32 <input is="x-my-input" name="a" type="radio" value="Foo" bind-value="name"> | 32 <input is="x-my-input" name="a" type="radio" value="Foo" bind-value="name"> |
| 33 Foo! | 33 Foo! |
| 34 <input is="x-my-input" name="a" type="radio" value="Bar" bind-value="name"> | 34 <input is="x-my-input" name="a" type="radio" value="Bar" bind-value="name"> |
| 35 Bar! | 35 Bar! |
| 36 </form> | 36 </form> |
| 37 <pre>You picked {{name}}. Final value should be 'Bar'</pre> | 37 <pre>You picked {{name}}. Final value should be 'Bar'</pre> |
| 38 <script type="application/dart"> | 38 <script type="application/dart"> |
| 39 import 'dart:html'; | 39 import 'dart:html'; |
| 40 import 'package:web_components/web_components.dart'; | 40 import 'package:web_ui/web_ui.dart'; |
| 41 import 'package:unittest/unittest.dart'; | 41 import 'package:unittest/unittest.dart'; |
| 42 | 42 |
| 43 var name = 'Bar'; | 43 var name = 'Bar'; |
| 44 var foo = queryAll('input')[0]; | 44 var foo = queryAll('input')[0]; |
| 45 var bar = queryAll('input')[1]; | 45 var bar = queryAll('input')[1]; |
| 46 | 46 |
| 47 main() { | 47 main() { |
| 48 useShadowDom = false; | 48 useShadowDom = false; |
| 49 | 49 |
| 50 expect(foo.checked, false, reason: 'watchers not run yet.'); | 50 expect(foo.checked, false, reason: 'watchers not run yet.'); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 expect(foo.checked, true, reason: 'explicitly set this.'); | 82 expect(foo.checked, true, reason: 'explicitly set this.'); |
| 83 // It would be nice if this was "Foo". | 83 // It would be nice if this was "Foo". |
| 84 expect(name, 'Bar', reason: 'DOM checked does not fire event.'); | 84 expect(name, 'Bar', reason: 'DOM checked does not fire event.'); |
| 85 | 85 |
| 86 window.setTimeout(() => window.postMessage('done', '*'), 0); | 86 window.setTimeout(() => window.postMessage('done', '*'), 0); |
| 87 }, 0); | 87 }, 0); |
| 88 } | 88 } |
| 89 </script> | 89 </script> |
| 90 </body> | 90 </body> |
| 91 </html> | 91 </html> |
| OLD | NEW |