Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: pkg/polymer/test/publish_attributes_test.dart

Issue 24149003: Port of github.com/polymer/polymer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/prop_attr_reflection_test.html ('k') | pkg/polymer/test/publish_attributes_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698