File tree 4 files changed +95
-1
lines changed
4 files changed +95
-1
lines changed Original file line number Diff line number Diff line change 45
45
46
46
// storage for configuration
47
47
_setupConfigure : function ( initialConfig ) {
48
- this . _config = initialConfig || { } ;
48
+ this . _config = { } ;
49
+ // don't accept undefined values in intialConfig
50
+ for ( var i in initialConfig ) {
51
+ if ( initialConfig [ i ] !== undefined ) {
52
+ this . _config [ i ] = initialConfig [ i ] ;
53
+ }
54
+ }
49
55
this . _handlers = [ ] ;
50
56
} ,
51
57
92
98
_configureProperties : function ( properties , config ) {
93
99
for ( var i in properties ) {
94
100
var c = properties [ i ] ;
101
+ // don't accept undefined values
95
102
if ( c . value !== undefined ) {
96
103
var value = c . value ;
97
104
if ( typeof value == 'function' ) {
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ <!--
3
+ @license
4
+ Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
5
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8
+ Code distributed by Google as part of the polymer project is also
9
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10
+ -->
11
+ < link rel ="import " href ="../../polymer.html ">
12
+
13
+ < body >
14
+
15
+ < dom-module is ="data-source ">
16
+ < template >
17
+ < span > {{prop}}</ span >
18
+ < span > {{data.length}}</ span > : length
19
+ < br >
20
+
21
+ < template is ="dom-repeat " items ="{{data}} ">
22
+ < span > {{item}}</ span >
23
+ </ template > :items
24
+ </ template >
25
+ </ dom-module >
26
+
27
+
28
+ < script >
29
+ Polymer ( {
30
+ is : 'data-source' ,
31
+
32
+ properties : {
33
+ data : {
34
+ //readOnly: true,
35
+ notify : true ,
36
+ type : Array ,
37
+ value : [ 1 , 2 , 3 ]
38
+ } ,
39
+
40
+ prop : {
41
+ readOnly : true ,
42
+ notify : true ,
43
+ type : String ,
44
+ value : 'foo'
45
+ }
46
+ }
47
+ } ) ;
48
+ </ script >
49
+
50
+
51
+ < template is ="dom-bind ">
52
+
53
+ < h1 > Element</ h1 >
54
+ < data-source data ="{{data}} " prop ="{{prop}} "> </ data-source >
55
+
56
+ < h1 > Databound</ h1 >
57
+
58
+ < span > {{prop}}</ span >
59
+
60
+ < template is ="dom-repeat " items ="{{data}} ">
61
+ < span > {{item}}</ span >
62
+ </ template >
63
+
64
+ </ template >
65
+
66
+
67
+
68
+ </ body >
Original file line number Diff line number Diff line change 7
7
}
8
8
}
9
9
} ) ;
10
+ </ script >
11
+
12
+ < script >
13
+ Polymer ( {
14
+ is : 'x-produce-a' ,
15
+ properties : {
16
+ a : {
17
+ notify : true ,
18
+ value : 'a'
19
+ }
20
+ }
21
+ } ) ;
10
22
</ script >
Original file line number Diff line number Diff line change 30
30
< template is ="dom-bind " id ="decDomBind ">
31
31
< x-basic id ="decEl1 " value ="{{value}} " notifyingvalue ="{{nvalue}} " on-custom ="handleEvent " computed ="{{compute(dep)}} "> </ x-basic >
32
32
< x-basic id ="decEl2 " value ="{{value}} " notifyingvalue ="{{nvalue}} "> </ x-basic >
33
+ < x-produce-a a ={{z}} > </ x-produce-a >
34
+ < div id ="z "> {{z}}</ div >
33
35
</ template >
34
36
35
37
< div id ="container ">
90
92
assert . equal ( el1 . computed , 50 ) ;
91
93
} ) ;
92
94
95
+ test ( 'initial value notifies to dom-bind' , function ( ) {
96
+ assert . equal ( domBind . z , 'a' ) ;
97
+ assert . equal ( z . textContent , 'a' ) ;
98
+ } ) ;
99
+
93
100
} ) ;
94
101
95
102
suite ( 'imperative dom-bind' , function ( ) {
You can’t perform that action at this time.
0 commit comments