parentProps should not override argument based props

This commit is contained in:
Filipe Araujo
2015-06-16 14:05:41 -04:00
parent e8169ecef7
commit 898fe89077
2 changed files with 37 additions and 2 deletions

View File

@@ -277,7 +277,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
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);
@@ -304,4 +306,4 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
</script>
</script>

View File

@@ -21,6 +21,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<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() {
@@ -31,6 +59,11 @@ suite('<dom-template>', function() {
assert.equal(row.root.textContent.trim(), 'ohai');
});
test('stamps within an element', function() {
var template = document.querySelector('#testDom');
assert.equal(template.value, 'ohai');
});
});
</script>