Merge pull request #3082 from Polymer/3077-kschaaf-fromabove-false

Revert fromAbove in applyEffectValue. Add test. Fixes #3077.
This commit is contained in:
Steve Orvell 2015-11-30 11:29:24 -08:00
commit 06898da605
2 changed files with 15 additions and 4 deletions

View File

@ -161,7 +161,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} else {
for (var i=0, arg; (i<sig.args.length) && (arg=sig.args[i]); i++) {
if (!arg.literal) {
this.__addAnnotatedComputationEffect(arg.model, index, note, part,
this.__addAnnotatedComputationEffect(arg.model, index, note, part,
arg);
}
}
@ -289,11 +289,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
(node.localName == 'input' && property == 'value')) {
value = value == undefined ? '' : value;
}
// setProperty using fromAbove to avoid spinning the wheel needlessly.
// Ideally we would call setProperty using fromAbove: true to avoid
// spinning the wheel needlessly, but we found that users were listening
// for change events outside of bindings
var pinfo;
if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) ||
if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) ||
!pinfo.readOnly) {
this.__setProperty(property, value, true, node);
this.__setProperty(property, value, false, node);
}
}
},

View File

@ -375,6 +375,15 @@ suite('2-way binding effects between elements', function() {
assert.equal(el.boundreadonlyvalue, 46, 'property bound to read-only property should change from change to bound value');
});
test('listener for value-changed fires when value changed from host', function() {
var listener = sinon.spy();
el.$.basic1.addEventListener('notifyingvalue-changed', listener);
el.boundnotifyingvalue = 678;
assert.equal(el.$.basic1.notifyingvalue, 678);
assert.isTrue(listener.calledOnce);
assert.equal(listener.getCalls()[0].args[0].detail.value, 678);
});
});
suite('1-way binding effects between elements', function() {