Skip to content

Commit

Permalink
Ensure Annotator recognizes dynamic fn as dependency for parent props.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Mar 18, 2016
1 parent 223aa34 commit 15ff463
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/standard/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@
pp[model] = true;
}
}
if (p.signature.dynamicFn) {
pp[p.signature.method] = true;
}
} else {
if (p.model) {
pp[p.model] = true;
Expand Down
28 changes: 28 additions & 0 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -685,3 +685,31 @@
});
</script>
</dom-module>

<dom-module id="x-child-template-with-dynamic-fn">
<template>
<template is="dom-if" if="[[visible]]">
<p>[[translate('text')]]</p>
</template>
</template>
<script>
Polymer({
is: 'x-child-template-with-dynamic-fn',

properties: {
translate: {
type: Function,
value: function () {
return function(str) {
return str;
}
}
},
visible: {
type: Boolean,
value: true
}
}
});
</script>
</dom-module>
12 changes: 12 additions & 0 deletions test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,18 @@

});

test('ensure annotator can pass dynamic fn to parent props', function(done) {
el = document.createElement('x-child-template-with-dynamic-fn');
document.body.appendChild(el);

setTimeout(function() {
var check = Polymer.dom(el.root).querySelector('p');
assert.equal(check.textContent, 'text');
done();
});

});

});

</script>
Expand Down

0 comments on commit 15ff463

Please sign in to comment.