| 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:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'package:unittest/html_config.dart'; | 7 import 'package:unittest/html_config.dart'; |
| 8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 9 | 9 |
| 10 @CustomTag('my-child-element') | 10 @CustomTag('my-child-element') |
| 11 class MyChildElement extends PolymerElement { | 11 class MyChildElement extends PolymerElement { |
| 12 @published int camelCase; | 12 @PublishedProperty(reflect: true) int camelCase; |
| 13 @published int lowercase; | 13 @PublishedProperty(reflect: true) int lowercase; |
| 14 | 14 |
| 15 // TODO(sigmund): remove once codegen in polymer is turned on. | 15 // TODO(sigmund): remove once codegen in polymer is turned on. |
| 16 @reflectable get attributes => super.attributes; | 16 @reflectable get attributes => super.attributes; |
| 17 | 17 |
| 18 MyChildElement.created() : super.created(); | 18 MyChildElement.created() : super.created(); |
| 19 | 19 |
| 20 // Make this a no-op, so we can verify the initial | 20 // Make this a no-op, so we can verify the initial |
| 21 // reflectPropertyToAttribute works. | 21 // reflectPropertyToAttribute works. |
| 22 observeAttributeProperty(name) { } | 22 @override |
| 23 openPropertyObserver() { } |
| 23 } | 24 } |
| 24 | 25 |
| 25 @CustomTag('my-element') | 26 @CustomTag('my-element') |
| 26 class MyElement extends PolymerElement { | 27 class MyElement extends PolymerElement { |
| 27 @observable int volume = 11; | 28 @observable int volume = 11; |
| 28 | 29 |
| 29 MyElement.created() : super.created(); | 30 MyElement.created() : super.created(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 main() => initPolymer().run(() { | 33 main() => initPolymer().run(() { |
| 33 useHtmlConfiguration(); | 34 useHtmlConfiguration(); |
| 34 | 35 |
| 35 setUp(() => Polymer.onReady); | 36 setUp(() => Polymer.onReady); |
| 36 | 37 |
| 37 test('attribute reflected to property name', () { | 38 test('attribute reflected to property name', () { |
| 38 var child = querySelector('my-element') | 39 var child = querySelector('my-element') |
| 39 .shadowRoot.querySelector('my-child-element'); | 40 .shadowRoot.querySelector('my-child-element'); |
| 40 expect(child.lowercase, 11); | 41 expect(child.lowercase, 11); |
| 41 expect(child.camelCase, 11); | 42 expect(child.camelCase, 11); |
| 42 | 43 |
| 43 expect('11', child.attributes['lowercase']); | 44 expect(child.attributes['lowercase'], '11'); |
| 44 expect('11', child.attributes['camelcase']); | 45 expect(child.attributes['camelcase'], '11'); |
| 45 }); | 46 }); |
| 46 }); | 47 }); |
| OLD | NEW |