Skip to content

Commit

Permalink
parentProps should not override argument based props
Browse files Browse the repository at this point in the history
  • Loading branch information
filaraujo committed Jun 16, 2015
1 parent e8169ec commit 898fe89
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/template/templatizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@
model = model || {};
if (this._parentProps) {
for (var prop in this._parentProps) {
model[prop] = this['_parent_' + prop];
if (!model[prop]) {
model[prop] = this['_parent_' + prop];
}
}
}
return new this.ctor(model, this);
Expand All @@ -304,4 +306,4 @@

};

</script>
</script>
33 changes: 33 additions & 0 deletions test/unit/template/dom-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@
<span>{{text}}</span>
</template>

<dom-module id="test-dom-template">
<template>
<template is="dom-template" id="tmpl">
<span>{{text}}</span>
</template>
</template>
<script>
Polymer({
is: 'test-dom-template',

properties: {
value: String
},

ready: function() {

var tmpl = this.$.tmpl.stamp({
text: 'ohai'
});

this.value = tmpl.root.textContent.trim();
}
});
</script>
</dom-module>

<test-dom-template id="testDom"></test-dom-template>

<script>

suite('<dom-template>', function() {
Expand All @@ -31,6 +59,11 @@
assert.equal(row.root.textContent.trim(), 'ohai');
});

test('stamps within an element', function() {
var template = document.querySelector('#testDom');
assert.equal(template.value, 'ohai');
});

});

</script>
Expand Down

0 comments on commit 898fe89

Please sign in to comment.