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

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

Issue 26051002: Updating Polymer to derive from custom elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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:html'; 5 import 'dart:html';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 7 import 'package:unittest/html_config.dart';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 9
10 @CustomTag('x-foo') 10 @CustomTag('x-foo')
11 class XFoo extends PolymerElement { 11 class XFoo extends PolymerElement {
12 XFoo.created() : super.created();
13
12 @published bool boolean = false; 14 @published bool boolean = false;
13 @published num number = 42; 15 @published num number = 42;
14 @published String str = "don't panic"; 16 @published String str = "don't panic";
15 } 17 }
16 18
17 @CustomTag('x-bar') 19 @CustomTag('x-bar')
18 class XBar extends PolymerElement { 20 class XBar extends PolymerElement {
21 XBar.created() : super.created();
22
19 @observable bool boolean = false; 23 @observable bool boolean = false;
20 @observable num number = 42; 24 @observable num number = 42;
21 @observable String str = "don't panic"; 25 @observable String str = "don't panic";
22 } 26 }
23 27
24 @CustomTag('x-zot') 28 @CustomTag('x-zot')
25 class XZot extends XBar { 29 class XZot extends XBar {
30 XZot.created() : super.created();
26 @observable num number = 84; 31 @observable num number = 84;
27 } 32 }
28 33
29 @CustomTag('x-date') 34 @CustomTag('x-date')
30 class XDate extends PolymerElement { 35 class XDate extends PolymerElement {
36 XDate.created() : super.created();
31 @observable var value = new DateTime(2013, 9, 25); 37 @observable var value = new DateTime(2013, 9, 25);
32 } 38 }
33 39
34 @CustomTag('x-array') 40 @CustomTag('x-array')
35 class XArray extends PolymerElement { 41 class XArray extends PolymerElement {
42 XArray.created() : super.created();
36 @observable List values; 43 @observable List values;
37 } 44 }
38 45
39 @CustomTag('x-obj') 46 @CustomTag('x-obj')
40 class XObj extends PolymerElement { 47 class XObj extends PolymerElement {
48 XObj.created() : super.created();
41 @observable var values = {}; 49 @observable var values = {};
42 } 50 }
43 51
44 main() { 52 main() {
45 useHtmlConfiguration(); 53 useHtmlConfiguration();
46 54
47 test('take attributes', () { 55 test('take attributes', () {
48 queryXTag(x) => document.query(x).xtag; 56 queryXTag(x) => document.query(x).xtag;
49 57
50 expect(queryXTag("#foo0").boolean, true); 58 expect(queryXTag("#foo0").boolean, true);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 expect(queryXTag("#arr1").values, [0, 1, 2]); 108 expect(queryXTag("#arr1").values, [0, 1, 2]);
101 expect(queryXTag("#arr2").values, [33]); 109 expect(queryXTag("#arr2").values, [33]);
102 // Object deserialization tests 110 // Object deserialization tests
103 expect(queryXTag("#obj1").values, { 'name': 'Brandon', 111 expect(queryXTag("#obj1").values, { 'name': 'Brandon',
104 'nums': [1, 22, 33] }); 112 'nums': [1, 22, 33] });
105 expect(queryXTag("#obj2").values, { "color": "Red" }); 113 expect(queryXTag("#obj2").values, { "color": "Red" });
106 expect(queryXTag("#obj3").values, { 'movie': 'Buckaroo Banzai', 114 expect(queryXTag("#obj3").values, { 'movie': 'Buckaroo Banzai',
107 'DOB': '07/31/1978' }); 115 'DOB': '07/31/1978' });
108 }); 116 });
109 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698