mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3447 from Polymer/config-noeffect
Make sure to configure properties on polymer elements that do not have property effects
This commit is contained in:
commit
d1ee1423cb
@ -149,14 +149,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
var node = this._nodes[x.effect.index];
|
||||
var name = x.effect.propertyName;
|
||||
// seeding configuration only
|
||||
if (node._propertyEffects && node._propertyEffects[name]) {
|
||||
var isAttr = (x.effect.kind == 'attribute');
|
||||
var hasEffect = (node._propertyEffects &&
|
||||
node._propertyEffects[name]);
|
||||
if (node._configValue && (hasEffect || !isAttr)) {
|
||||
var value = (p === x.effect.value) ? config[p] :
|
||||
this._get(x.effect.value, config);
|
||||
if (x.effect.kind == 'attribute') {
|
||||
if (isAttr) {
|
||||
// For attribute bindings, flow through the same ser/deser
|
||||
// process to ensure the value is the same as if it were
|
||||
// bound through the attribute
|
||||
value = node.deserialize(node.serialize(value),
|
||||
value = node.deserialize(this.serialize(value),
|
||||
node._propertyInfo[name].type);
|
||||
}
|
||||
node._configValue(name, value);
|
||||
|
@ -146,9 +146,28 @@
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id="x-configure-simple-child">
|
||||
<script>
|
||||
Polymer({
|
||||
|
||||
is: 'x-configure-simple-child',
|
||||
|
||||
properties: {
|
||||
noeffect: String
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
this.hasPropertyAtReadyTime = (this.noeffect !== undefined);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id="x-configure-host">
|
||||
<template>
|
||||
<x-configure-child id="child" content="{{content}}" object="{{object.goo}}" attr$="{{attrValue}}" attr-dash$="{{attrValue}}" attr-number$="{{attrNumber}}" attr-boolean$="{{attrBoolean}}"></x-configure-child>
|
||||
<x-configure-simple-child id="simple" noeffect="{{simple}}"></x-configure-simple-child>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
@ -185,6 +204,9 @@
|
||||
},
|
||||
attrBoolean: {
|
||||
value: false
|
||||
},
|
||||
simple: {
|
||||
value: 'simple'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
assert.strictEqual(e.$.child.attrBooleanChanged.getCall(0).args[0], false);
|
||||
});
|
||||
|
||||
test('bindings to properties without effects configured', function() {
|
||||
var e = document.createElement('x-configure-host');
|
||||
assert.isTrue(e.$.simple.hasPropertyAtReadyTime, 'property value not configured and therefore not set at ready time');
|
||||
});
|
||||
|
||||
test('pre-register property assignment does not break getters and setters', function() {
|
||||
// don't test if __proto__ is polyfilled (IE10); cannot be fixed in this case.
|
||||
if (Polymer.Settings.usePolyfillProto) {
|
||||
|
Loading…
Reference in New Issue
Block a user