mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Actually make computed readOnly:true. Add more tests.
This commit is contained in:
@@ -248,6 +248,10 @@
|
||||
computedvalue="[[boundcomputedvalue]]"
|
||||
computednotifyingvalue="[[boundcomputednotifyingvalue]]">
|
||||
</x-basic>
|
||||
<x-basic id="basic3"
|
||||
notifyingvalue="{{computedValue}}"
|
||||
computedvalue="{{value}}">
|
||||
</x-basic>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
@@ -259,6 +263,17 @@
|
||||
'boundcomputednotifyingvalueChanged(boundcomputednotifyingvalue)',
|
||||
'boundreadonlyvalueChanged(boundreadonlyvalue)'
|
||||
],
|
||||
properties: {
|
||||
a: {
|
||||
value: 10
|
||||
},
|
||||
b: {
|
||||
value: 20
|
||||
},
|
||||
computedValue: {
|
||||
computed: 'computeComputedValue(a, b)'
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
this.observerCounts = {
|
||||
boundvalueChanged: 0,
|
||||
@@ -268,6 +283,9 @@
|
||||
boundreadonlyvalueChanged: 0
|
||||
};
|
||||
},
|
||||
computeComputedValue: function(a, b) {
|
||||
return a + b;
|
||||
},
|
||||
clearObserverCounts: function() {
|
||||
for (var i in this.observerCounts) {
|
||||
this.observerCounts[i] = 0;
|
||||
|
||||
Reference in New Issue
Block a user