File tree 4 files changed +21
-6
lines changed
4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 193
193
break ;
194
194
195
195
case Boolean :
196
- value = ( value !== null ) ;
196
+ value = ( value != null ) ;
197
197
break ;
198
198
199
199
case Object :
Original file line number Diff line number Diff line change 116
116
_configureProperties : function ( properties , config ) {
117
117
for ( var i in properties ) {
118
118
var c = properties [ i ] ;
119
- // Allow properties set before upgrade on the instance
119
+ // Allow properties set before upgrade on the instance
120
120
// to override default values. This allows late upgrade + an early set
121
121
// to not b0rk accessors on the prototype.
122
122
// Perf testing has shown `hasOwnProperty` to be ok here.
153
153
var value = ( p === x . effect . value ) ? config [ p ] :
154
154
this . _get ( x . effect . value , config ) ;
155
155
if ( x . effect . kind == 'attribute' ) {
156
- value = node . deserialize ( value ,
156
+ value = node . deserialize ( node . serialize ( value ) ,
157
157
node . _propertyInfo [ name ] . type ) ;
158
158
}
159
159
node . _configValue ( name , value ) ;
Original file line number Diff line number Diff line change 128
128
type : Number ,
129
129
observer : 'attrNumberChanged' ,
130
130
value : 0
131
+ } ,
132
+ attrBoolean : {
133
+ type : Boolean ,
134
+ observer : 'attrBooleanChanged' ,
135
+ // value: true
131
136
}
132
137
} ,
133
138
134
139
created : function ( ) {
135
140
this . attrDashChanged = sinon . spy ( ) ;
136
141
this . attrNumberChanged = sinon . spy ( ) ;
142
+ this . attrBooleanChanged = sinon . spy ( ) ;
137
143
}
138
144
139
145
} ) ;
142
148
143
149
< dom-module id ="x-configure-host ">
144
150
< template >
145
- < x-configure-child id ="child " content ="{{content}} " object ="{{object.goo}} " attr$ ="{{attrValue}} " attr-dash$ ="{{attrValue}} " attr-number$ ="{{attrNumber}} "> </ x-configure-child >
151
+ < x-configure-child id ="child " content ="{{content}} " object ="{{object.goo}} " attr$ ="{{attrValue}} " attr-dash$ ="{{attrValue}} " attr-number$ ="{{attrNumber}} " attr-boolean$ =" {{attrBoolean}} " > </ x-configure-child >
146
152
</ template >
147
153
< script >
148
154
Polymer ( {
175
181
value : 'attrValue'
176
182
} ,
177
183
attrNumber : {
178
- value : '42'
184
+ value : 42
185
+ } ,
186
+ attrBoolean : {
187
+ value : false
179
188
}
180
189
}
181
190
Original file line number Diff line number Diff line change 100
100
assert . notProperty ( e . $ . child , 'attr-number' ) ;
101
101
assert . strictEqual ( e . $ . child . attrNumber , 42 ) ;
102
102
assert . isTrue ( e . $ . child . attrNumberChanged . calledOnce ) ;
103
- assert . equal ( e . $ . child . attrNumberChanged . getCall ( 0 ) . args [ 0 ] , 42 ) ;
103
+ assert . strictEqual ( e . $ . child . attrNumberChanged . getCall ( 0 ) . args [ 0 ] , 42 ) ;
104
+
105
+ assert . equal ( e . $ . child . hasAttribute ( 'attr-boolean' ) , false ) ;
106
+ assert . notProperty ( e . $ . child , 'attr-boolean' ) ;
107
+ assert . strictEqual ( e . $ . child . attrBoolean , false ) ;
108
+ assert . isTrue ( e . $ . child . attrBooleanChanged . calledOnce ) ;
109
+ assert . strictEqual ( e . $ . child . attrBooleanChanged . getCall ( 0 ) . args [ 0 ] , false ) ;
104
110
} ) ;
105
111
106
112
test ( 'pre-register property assignment does not break getters and setters' , function ( ) {
You can’t perform that action at this time.
0 commit comments