| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library custom_elements_test; | 5 library custom_elements_test; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:unittest/html_individual_config.dart'; | 8 import 'package:unittest/html_individual_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 int customCreatedCount = 0; | 32 int customCreatedCount = 0; |
| 33 | 33 |
| 34 int nextTagId = 0; | 34 int nextTagId = 0; |
| 35 String get nextTag => 'x-type${nextTagId++}'; | 35 String get nextTag => 'x-type${nextTagId++}'; |
| 36 | 36 |
| 37 class NotAnElement {} | 37 class NotAnElement {} |
| 38 | 38 |
| 39 loadPolyfills() { | 39 loadPolyfills() { |
| 40 if (!document.supportsRegister) { | 40 if (!document.supportsRegister) { |
| 41 // Cache blocker is a workaround for: |
| 42 // https://code.google.com/p/dart/issues/detail?id=11834 |
| 43 var cacheBlocker = new DateTime.now().millisecondsSinceEpoch; |
| 41 return HttpRequest.getString('/root_dart/pkg/custom_element/lib/' | 44 return HttpRequest.getString('/root_dart/pkg/custom_element/lib/' |
| 42 'custom-elements.debug.js').then((code) { | 45 'custom-elements.debug.js?cacheBlock=$cacheBlocker').then((code) { |
| 43 document.head.children.add(new ScriptElement()..text = code); | 46 document.head.children.add(new ScriptElement()..text = code); |
| 44 }); | 47 }); |
| 45 } | 48 } |
| 46 } | 49 } |
| 47 | 50 |
| 48 main() { | 51 main() { |
| 49 useHtmlIndividualConfiguration(); | 52 useHtmlIndividualConfiguration(); |
| 50 | 53 |
| 51 setUp(loadPolyfills); | 54 setUp(loadPolyfills); |
| 52 | 55 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 test('can invoke mixin methods', () { | 183 test('can invoke mixin methods', () { |
| 181 var tag = nextTag; | 184 var tag = nextTag; |
| 182 document.register(tag, CustomType); | 185 document.register(tag, CustomType); |
| 183 | 186 |
| 184 var element = new Element.tag(tag); | 187 var element = new Element.tag(tag); |
| 185 element.invokeMixinMethod(); | 188 element.invokeMixinMethod(); |
| 186 expect(element.mixinMethodCalled, isTrue); | 189 expect(element.mixinMethodCalled, isTrue); |
| 187 }); | 190 }); |
| 188 }); | 191 }); |
| 189 } | 192 } |
| OLD | NEW |