Merge pull request #3373 from Polymer/filaraujo-feature/domTemplate

dom-template: parentProps should not override argument based props
This commit is contained in:
Kevin Schaaf 2016-02-04 12:56:15 -08:00
commit a6d948553a
3 changed files with 44 additions and 4 deletions

View File

@ -416,9 +416,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (this._parentProps) {
var templatized = this._templatized;
for (var prop in this._parentProps) {
if (model[prop] === undefined) {
model[prop] = templatized[this._parentPropPrefix + prop];
}
}
}
return new this.ctor(model, this);
},

View File

@ -66,6 +66,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'unit/templatizer.html',
'unit/dom-repeat.html',
'unit/dom-if.html',
'unit/dom-template.html',
'unit/dom-bind.html',
'unit/script-after-import-in-head.html',
'unit/globals.html'

View File

@ -11,9 +11,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<html>
<head>
<meta charset="utf-8">
<script src="../../../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../../../web-component-tester/browser.js"></script>
<link rel="import" href="../../../polymer.html">
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer.html">
</head>
<body>
@ -21,6 +21,38 @@ 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>
HTMLImports.whenReady(function() {
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 +63,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>