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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/publish_attributes_test.dart
diff --git a/pkg/polymer/test/publish_attributes_test.dart b/pkg/polymer/test/publish_attributes_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e31b74f92ad27ce26092874fc5d6b5e7355cf0fb
--- /dev/null
+++ b/pkg/polymer/test/publish_attributes_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:polymer/polymer.dart';
+
+// Dart note: unlike JS, you can't publish something that doesn't
+// have a corresponding field because we can't dynamically add properties.
+// So we define XFoo and XBar types here.
+@CustomTag('x-foo')
+class XFoo extends PolymerElement {
+ @observable var Foo;
+ @observable var baz;
+}
+
+@CustomTag('x-bar')
+class XBar extends XFoo {
+ @observable var Bar;
+}
+
+@CustomTag('x-zot')
+class XZot extends XBar {
+ @published int zot = 3;
+}
+
+@CustomTag('x-squid')
+class XSquid extends XZot {
+ @published int baz = 13;
+ @published int zot = 5;
+ @published int squid = 7;
+}
+
+main() {
+ useHtmlConfiguration();
+
+ test('published properties', () {
+ published(tag) =>
+ query('polymer-element[name=$tag]').xtag.publishedProperties;
+
+ print(published('x-foo'));
+ print(published('x-bar'));
+ print(published('x-zot'));
+ print(published('x-squid'));
+
+ expect(published('x-foo'), ['Foo', 'baz']);
+ expect(published('x-bar'), ['Foo', 'baz', 'Bar']);
+ expect(published('x-zot'), ['Foo', 'baz', 'Bar', 'zot']);
+ expect(published('x-squid'), ['Foo', 'baz', 'Bar', 'zot', 'squid']);
+ });
+}
« 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