Revert fromAbove in applyEffectValue. Add test. Fixes #3077.

This commit is contained in:
Kevin Schaaf 2015-11-24 12:25:07 -05:00
parent e5fb166c50
commit 156122c510
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

@ -369,6 +369,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() {