| 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 import 'dart:html'; | 5 import 'dart:html'; |
| 6 import 'package:polymer/polymer.dart'; | 6 import 'package:polymer/polymer.dart'; |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:unittest/html_config.dart'; | 8 import 'package:unittest/html_config.dart'; |
| 9 | 9 |
| 10 @CustomTag('x-html') | 10 @CustomTag('x-html') |
| 11 class XHtmlElement extends PolymerElement { | 11 class XHtmlElement extends PolymerElement { |
| 12 XHtmlElement.created() : super.created(); | 12 XHtmlElement.created() : super.created(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 @CustomTag('x-html-two') | 15 @CustomTag('x-html-two') |
| 16 class XHtml2Element extends XHtmlElement { | 16 class XHtml2Element extends XHtmlElement { |
| 17 XHtml2Element.created() : super.created(); | 17 XHtml2Element.created() : super.created(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 @CustomTag('x-div') | 20 @CustomTag('x-div') |
| 21 class XDivElement extends DivElement with Polymer, Observable { | 21 class XDivElement extends DivElement with Polymer, Observable { |
| 22 XDivElement.created() : super.created(); | 22 XDivElement.created() : super.created() { |
| 23 polymerCreated(); |
| 24 } |
| 23 } | 25 } |
| 24 | 26 |
| 25 @CustomTag('x-div-two') | 27 @CustomTag('x-div-two') |
| 26 class XDiv2Element extends XDivElement { | 28 class XDiv2Element extends XDivElement { |
| 27 XDiv2Element.created() : super.created(); | 29 XDiv2Element.created() : super.created(); |
| 28 } | 30 } |
| 29 | 31 |
| 30 /// Dart-specific test: | 32 /// Dart-specific test: |
| 31 /// This element is registered from code without an associated polymer-element. | 33 /// This element is registered from code without an associated polymer-element. |
| 32 class XPolymerElement extends PolymerElement { | 34 class XPolymerElement extends PolymerElement { |
| 33 XPolymerElement.created() : super.created(); | 35 XPolymerElement.created() : super.created(); |
| 34 } | 36 } |
| 35 | 37 |
| 36 /// Dart-specific test: | 38 /// Dart-specific test: |
| 37 /// This element is registered from code without an associated polymer-element. | 39 /// This element is registered from code without an associated polymer-element. |
| 38 class XButtonElement extends ButtonElement with Polymer, Observable { | 40 class XButtonElement extends ButtonElement with Polymer, Observable { |
| 39 XButtonElement.created() : super.created(); | 41 XButtonElement.created() : super.created() { |
| 42 polymerCreated(); |
| 43 } |
| 40 } | 44 } |
| 41 | 45 |
| 42 | 46 |
| 43 main() => initPolymer().run(() { | 47 main() => initPolymer().run(() { |
| 44 useHtmlConfiguration(); | 48 useHtmlConfiguration(); |
| 45 | 49 |
| 46 setUp(() => Polymer.onReady); | 50 setUp(() => Polymer.onReady); |
| 47 | 51 |
| 48 test('elements upgraded', () { | 52 test('elements upgraded', () { |
| 49 expect(querySelector('x-html') is XHtmlElement, isTrue); | 53 expect(querySelector('x-html') is XHtmlElement, isTrue); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 test('type extension', () { | 75 test('type extension', () { |
| 72 Polymer.registerSync('x-button', XButtonElement, extendsTag: 'button'); | 76 Polymer.registerSync('x-button', XButtonElement, extendsTag: 'button'); |
| 73 | 77 |
| 74 expect(document.createElement('button', 'x-button') is XButtonElement, | 78 expect(document.createElement('button', 'x-button') is XButtonElement, |
| 75 isTrue, reason: 'should have been registered'); | 79 isTrue, reason: 'should have been registered'); |
| 76 expect(document.querySelector('[is=x-button]') is XButtonElement, isTrue, | 80 expect(document.querySelector('[is=x-button]') is XButtonElement, isTrue, |
| 77 reason: 'elements on page should be upgraded'); | 81 reason: 'elements on page should be upgraded'); |
| 78 }); | 82 }); |
| 79 }); | 83 }); |
| 80 }); | 84 }); |
| OLD | NEW |