mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Add test that late resolved functions don't warn
This commit is contained in:
parent
b6abf26fda
commit
0037c535c8
@ -621,3 +621,34 @@
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
|
|
||||||
|
<dom-module id="x-bind-computed-property-late-translator">
|
||||||
|
<template>
|
||||||
|
<div id="check">[[translate(message)]]</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
Polymer({
|
||||||
|
is: 'x-bind-computed-property-late-translator',
|
||||||
|
properties: {
|
||||||
|
message: {
|
||||||
|
type: String,
|
||||||
|
value: 'Hello'
|
||||||
|
},
|
||||||
|
translate: {
|
||||||
|
type: Function,
|
||||||
|
computed: '_computeTranslateFn(translator)'
|
||||||
|
},
|
||||||
|
translator: {
|
||||||
|
type: Function,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeTranslateFn: function(translator) {
|
||||||
|
return function(message) {
|
||||||
|
return translator(message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</dom-module>
|
@ -310,6 +310,19 @@ suite('computed bindings with dynamic functions', function() {
|
|||||||
assert.equal(el.$.check.textContent, 'changed: Hello World.');
|
assert.equal(el.$.check.textContent, 'changed: Hello World.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('annotated computation / late resolved dynamic function', function() {
|
||||||
|
el = document.createElement('x-bind-computed-property-late-translator');
|
||||||
|
document.body.appendChild(el);
|
||||||
|
|
||||||
|
assert.equal(el.$.check.textContent.trim(), '');
|
||||||
|
|
||||||
|
el.translator = function(message) {
|
||||||
|
return 'translated: ' + message;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.equal(el.$.check.textContent, 'translated: Hello');
|
||||||
|
});
|
||||||
|
|
||||||
test('observer with dynamic function', function() {
|
test('observer with dynamic function', function() {
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'x-observer-with-dynamic-function',
|
is: 'x-observer-with-dynamic-function',
|
||||||
|
Loading…
Reference in New Issue
Block a user