| 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 todos, marks some as done | 10 This test runs the TodoMVC app, adds a few todos, marks some as done |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 import 'dart:async'; | 22 import 'dart:async'; |
| 23 import 'dart:html'; | 23 import 'dart:html'; |
| 24 import 'package:mdv/mdv.dart' as mdv; | 24 import 'package:mdv/mdv.dart' as mdv; |
| 25 import 'package:observe/observe.dart'; | 25 import 'package:observe/observe.dart'; |
| 26 import 'package:unittest/unittest.dart'; | 26 import 'package:unittest/unittest.dart'; |
| 27 import 'package:polymer/polymer.dart'; | 27 import 'package:polymer/polymer.dart'; |
| 28 import '../web/model.dart'; | 28 import '../web/model.dart'; |
| 29 | 29 |
| 30 Node findWithText(Node node, String text) { | 30 Node findWithText(Node node, String text) { |
| 31 if (node.text == text) return node; | 31 if (node.text == text) return node; |
| 32 if (node is Element && node.shadowRoot != null) { | 32 if (node is Element && (node as Element).shadowRoot != null) { |
| 33 var r = findWithText(node.shadowRoot, text); | 33 var r = findWithText((node as Element).shadowRoot, text); |
| 34 if (r != null) return r; | 34 if (r != null) return r; |
| 35 } | 35 } |
| 36 for (var n in node.nodes) { | 36 for (var n in node.nodes) { |
| 37 var r = findWithText(n, text); | 37 var r = findWithText(n, text); |
| 38 if (r != null) return r; | 38 if (r != null) return r; |
| 39 } | 39 } |
| 40 return null; | 40 return null; |
| 41 } | 41 } |
| 42 | 42 |
| 43 Node findShadowHost(Node node, ShadowRoot root) { | 43 Node findShadowHost(Node node, ShadowRoot root) { |
| 44 if (node is Element) { | 44 if (node is Element) { |
| 45 var shadowRoot = node.shadowRoot; | 45 var shadowRoot = (node as Element).shadowRoot; |
| 46 if (shadowRoot == root) return node; | 46 if (shadowRoot == root) return node; |
| 47 if (shadowRoot != null) { | 47 if (shadowRoot != null) { |
| 48 var r = findShadowHost(shadowRoot, root); | 48 var r = findShadowHost(shadowRoot, root); |
| 49 if (r != null) return r; | 49 if (r != null) return r; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 for (var n in node.nodes) { | 52 for (var n in node.nodes) { |
| 53 var r = findShadowHost(n, root); | 53 var r = findShadowHost(n, root); |
| 54 if (r != null) return r; | 54 if (r != null) return r; |
| 55 } | 55 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 node.dispatchEvent(new MouseEvent('click', detail: 1)); | 81 node.dispatchEvent(new MouseEvent('click', detail: 1)); |
| 82 expect(node.checked, isTrue, reason: 'element is checked'); | 82 expect(node.checked, isTrue, reason: 'element is checked'); |
| 83 | 83 |
| 84 window.postMessage('done', '*'); | 84 window.postMessage('done', '*'); |
| 85 }); | 85 }); |
| 86 } | 86 } |
| 87 </script> | 87 </script> |
| 88 </body> | 88 </body> |
| 89 </html> | 89 </html> |
| OLD | NEW |