mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Add test for comp values to same method
The test fails without the other change in this branch.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div id="boundChild" value="{{value}}" negvalue="{{!bool}}" attrvalue$="{{attrvalue}}" computedvalue="{{computedvalue}}" camel-case="{{value}}"></div>
|
||||
<div id="boundChild" value="{{value}}" negvalue="{{!bool}}" attrvalue$="{{attrvalue}}"
|
||||
computedvalue="{{computedvalue}}" computedvaluetwo="{{computedvaluetwo}}" camel-case="{{value}}"></div>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
@@ -29,12 +30,14 @@
|
||||
},
|
||||
computed: {
|
||||
computedvalue: 'computeValue(value)',
|
||||
computedvaluetwo: 'computeValue(valuetwo)',
|
||||
computednotifyingvalue: 'computeNotifyingValue(notifyingvalue)',
|
||||
computedFromMultipleValues: 'computeFromMultipleValues(sum1, sum2, divide)'
|
||||
},
|
||||
bind: {
|
||||
value: 'valueChanged',
|
||||
computedvalue: 'computedvalueChanged',
|
||||
computedvaluetwo: 'computedvaluetwoChanged',
|
||||
notifyingvalue: 'notifyingvalueChanged',
|
||||
readonlyvalue: 'readonlyvalueChanged',
|
||||
computedFromMultipleValues: 'computedFromMultipleValuesChanged'
|
||||
@@ -44,6 +47,7 @@
|
||||
return val + 1;
|
||||
},
|
||||
computedvalueChanged: function() {},
|
||||
computedvaluetwoChanged: function() {},
|
||||
notifyingvalueChanged: function() {},
|
||||
readonlyvalueChanged: function() {},
|
||||
computeNotifyingValue: function(val) {
|
||||
@@ -121,4 +125,4 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -70,6 +70,17 @@ suite('single-element binding effects', function() {
|
||||
});
|
||||
});
|
||||
|
||||
test('computed values to same method updates', function(done) {
|
||||
el.value = 44;
|
||||
el.valuetwo = 144;
|
||||
setTimeout(function() {
|
||||
assert.equal(el.computedvalue, 45, 'Computed value not correct');
|
||||
assert.equal(el.computedvaluetwo, 145, 'Computed value not correct');
|
||||
assert.equal(el.$.boundChild.computedvalue, 45, 'Computed value not propagated to bound child');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('notification sent', function() {
|
||||
var notified = 0;
|
||||
el.addEventListener('notifyingvalue-changed', function(e) {
|
||||
|
||||
Reference in New Issue
Block a user