| OLD | NEW |
| 1 library TestUtils; | 1 library TestUtils; |
| 2 | 2 |
| 3 import 'dart:async'; | 3 import 'dart:async'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:js' as js; | 5 import 'dart:js' as js; |
| 6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Verifies that [actual] has the same graph structure as [expected]. | 10 * Verifies that [actual] has the same graph structure as [expected]. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 reason: '$path attribute [$key] values differ'); | 156 reason: '$path attribute [$key] values differ'); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 for (var i = 0; i < a.nodes.length; ++i) { | 159 for (var i = 0; i < a.nodes.length; ++i) { |
| 160 validateNodeTree(a.nodes[i], b.nodes[i], '$path[$i].'); | 160 validateNodeTree(a.nodes[i], b.nodes[i], '$path[$i].'); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 Future loadCustomElementPolyfill() { | 164 Future loadCustomElementPolyfill() { |
| 165 if (!document.supportsRegister) { | 165 if (!document.supportsRegister) { |
| 166 if (!MutationObserver.supported) { |
| 167 var script = new ScriptElement() |
| 168 ..src = '/packages/mutation_observer/mutation_observer.js'; |
| 169 document.head.append(script); |
| 170 } |
| 166 var script = new ScriptElement() | 171 var script = new ScriptElement() |
| 167 ..src = '/packages/custom_element/custom-elements.debug.js'; | 172 ..src = '/packages/custom_element/custom-elements.debug.js'; |
| 168 document.head.append(script); | 173 document.head.append(script); |
| 169 return document.body.on['WebComponentsReady'].first; | 174 return document.on['WebComponentsReady'].first; |
| 170 } | 175 } |
| 171 return new Future.value(); | 176 return new Future.value(); |
| 172 } | 177 } |
| 173 | 178 |
| 174 Future loadPolyfills() { | 179 Future loadPolyfills() { |
| 175 return loadCustomElementPolyfill(); | 180 return loadCustomElementPolyfill(); |
| 176 } | 181 } |
| 177 | 182 |
| 178 /** | 183 /** |
| 179 * Upgrade all custom elements in the subtree which have not been upgraded. | 184 * Upgrade all custom elements in the subtree which have not been upgraded. |
| 180 * | 185 * |
| 181 * This is needed to cover timing scenarios which the custom element polyfill | 186 * This is needed to cover timing scenarios which the custom element polyfill |
| 182 * does not cover. | 187 * does not cover. |
| 183 */ | 188 */ |
| 184 void upgradeCustomElements(Node node) { | 189 void upgradeCustomElements(Node node) { |
| 185 if (js.context.hasProperty('CustomElements') && | 190 if (js.context.hasProperty('CustomElements') && |
| 186 js.context['CustomElements'].hasProperty('upgradeAll')) { | 191 js.context['CustomElements'].hasProperty('upgradeAll')) { |
| 187 js.context['CustomElements'].callMethod('upgradeAll', [node]); | 192 js.context['CustomElements'].callMethod('upgradeAll', [node]); |
| 188 } | 193 } |
| 189 } | 194 } |
| OLD | NEW |