| 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:async' show Completer; | 5 import 'dart:async' show Completer; |
| 6 import 'dart:html'; | 6 import 'dart:html'; |
| 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 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 10 | 10 |
| 11 @CustomTag('my-child-element') | 11 @CustomTag('my-child-element') |
| 12 class MyChildElement extends PolymerElement { | 12 class MyChildElement extends PolymerElement { |
| 13 @published int camelCase; | 13 @published int camelCase; |
| 14 @published int lowercase; | 14 @published int lowercase; |
| 15 | 15 |
| 16 MyChildElement.created() : super.created(); | 16 MyChildElement.created() : super.created(); |
| 17 | 17 |
| 18 // Make this a no-op, so we can verify the initial | 18 // Make this a no-op, so we can verify the initial |
| 19 // reflectPropertyToAttribute works. | 19 // reflectPropertyToAttribute works. |
| 20 observeAttributeProperty(name) { } | 20 observeAttributeProperty(name) { } |
| 21 } | 21 } |
| 22 | 22 |
| 23 @CustomTag('my-element') | 23 @CustomTag('my-element') |
| 24 class MyElement extends PolymerElement { | 24 class MyElement extends PolymerElement { |
| 25 @observable int volume = 11; | 25 @observable int volume = 11; |
| 26 | 26 |
| 27 MyElement.created() : super.created(); | 27 MyElement.created() : super.created(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 main() { | 30 @initMethod _main() { |
| 31 useHtmlConfiguration(); | 31 useHtmlConfiguration(); |
| 32 | 32 |
| 33 setUp(() => Polymer.onReady); | 33 setUp(() => Polymer.onReady); |
| 34 | 34 |
| 35 test('attribute reflected to property name', () { | 35 test('attribute reflected to property name', () { |
| 36 var child = query('my-element').shadowRoot.query('my-child-element'); | 36 var child = query('my-element').shadowRoot.query('my-child-element'); |
| 37 expect(child.lowercase, 11); | 37 expect(child.lowercase, 11); |
| 38 expect(child.camelCase, 11); | 38 expect(child.camelCase, 11); |
| 39 | 39 |
| 40 expect('11', child.attributes['lowercase']); | 40 expect('11', child.attributes['lowercase']); |
| 41 expect('11', child.attributes['camelcase']); | 41 expect('11', child.attributes['camelcase']); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| OLD | NEW |