OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:html'; |
| 6 import 'package:unittest/unittest.dart'; |
| 7 import 'package:unittest/html_config.dart'; |
| 8 import 'package:polymer/polymer.dart'; |
| 9 |
| 10 // Dart note: unlike JS, you can't publish something that doesn't |
| 11 // have a corresponding field because we can't dynamically add properties. |
| 12 // So we define XFoo and XBar types here. |
| 13 @CustomTag('x-foo') |
| 14 class XFoo extends PolymerElement { |
| 15 @observable var Foo; |
| 16 @observable var baz; |
| 17 } |
| 18 |
| 19 @CustomTag('x-bar') |
| 20 class XBar extends XFoo { |
| 21 @observable var Bar; |
| 22 } |
| 23 |
| 24 @CustomTag('x-zot') |
| 25 class XZot extends XBar { |
| 26 @published int zot = 3; |
| 27 } |
| 28 |
| 29 @CustomTag('x-squid') |
| 30 class XSquid extends XZot { |
| 31 @published int baz = 13; |
| 32 @published int zot = 5; |
| 33 @published int squid = 7; |
| 34 } |
| 35 |
| 36 main() { |
| 37 useHtmlConfiguration(); |
| 38 |
| 39 test('published properties', () { |
| 40 published(tag) => |
| 41 query('polymer-element[name=$tag]').xtag.publishedProperties; |
| 42 |
| 43 print(published('x-foo')); |
| 44 print(published('x-bar')); |
| 45 print(published('x-zot')); |
| 46 print(published('x-squid')); |
| 47 |
| 48 expect(published('x-foo'), ['Foo', 'baz']); |
| 49 expect(published('x-bar'), ['Foo', 'baz', 'Bar']); |
| 50 expect(published('x-zot'), ['Foo', 'baz', 'Bar', 'zot']); |
| 51 expect(published('x-squid'), ['Foo', 'baz', 'Bar', 'zot', 'squid']); |
| 52 }); |
| 53 } |
OLD | NEW |