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

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

Issue 2312183003: Removed Polymer from Observatory deps (Closed)
Patch Set: Created 4 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 unified diff | Download patch
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 XFoo.created() : super.created();
16
17 @observable var Foo;
18 @observable var baz;
19 }
20
21 @CustomTag('x-bar')
22 class XBar extends XFoo {
23 XBar.created() : super.created();
24
25 @observable var Bar;
26 }
27
28 @CustomTag('x-zot')
29 class XZot extends XBar {
30 XZot.created() : super.created();
31
32 @published int zot = 3;
33 }
34
35 @CustomTag('x-squid')
36 class XSquid extends XZot {
37 XSquid.created() : super.created();
38
39 @published int baz = 13;
40 @published int zot = 3;
41 @published int squid = 7;
42 }
43
44 // Test inherited "attriubtes"
45 class XBaz extends PolymerElement {
46 XBaz.created() : super.created();
47 @observable int qux = 13;
48 }
49
50 @CustomTag('x-qux')
51 class XQux extends XBaz {
52 XQux.created() : super.created();
53 }
54
55 main() => initPolymer().then((zone) => zone.run(() {
56 useHtmlConfiguration();
57
58 setUp(() => Polymer.onReady);
59
60 test('published properties', () {
61 published(tag) =>
62 (new Element.tag(tag) as PolymerElement).element.publishedProperties;
63
64 expect(published('x-foo'), ['Foo', 'baz']);
65 expect(published('x-bar'), ['Foo', 'baz', 'Bar']);
66 expect(published('x-zot'), ['Foo', 'baz', 'Bar', 'zot']);
67 expect(published('x-squid'), ['Foo', 'baz', 'Bar', 'zot', 'squid']);
68 expect(published('x-qux'), ['qux']);
69 });
70 }));
OLDNEW
« no previous file with comments | « packages/polymer/test/property_observe_test.html ('k') | packages/polymer/test/publish_attributes_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698