mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3373 from Polymer/filaraujo-feature/domTemplate
dom-template: parentProps should not override argument based props
This commit is contained in:
commit
a6d948553a
@ -416,9 +416,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
if (this._parentProps) {
|
if (this._parentProps) {
|
||||||
var templatized = this._templatized;
|
var templatized = this._templatized;
|
||||||
for (var prop in this._parentProps) {
|
for (var prop in this._parentProps) {
|
||||||
|
if (model[prop] === undefined) {
|
||||||
model[prop] = templatized[this._parentPropPrefix + prop];
|
model[prop] = templatized[this._parentPropPrefix + prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new this.ctor(model, this);
|
return new this.ctor(model, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
'unit/templatizer.html',
|
'unit/templatizer.html',
|
||||||
'unit/dom-repeat.html',
|
'unit/dom-repeat.html',
|
||||||
'unit/dom-if.html',
|
'unit/dom-if.html',
|
||||||
|
'unit/dom-template.html',
|
||||||
'unit/dom-bind.html',
|
'unit/dom-bind.html',
|
||||||
'unit/script-after-import-in-head.html',
|
'unit/script-after-import-in-head.html',
|
||||||
'unit/globals.html'
|
'unit/globals.html'
|
||||||
|
@ -11,9 +11,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="../../../../webcomponentsjs/webcomponents-lite.js"></script>
|
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||||
<script src="../../../../web-component-tester/browser.js"></script>
|
<script src="../../../web-component-tester/browser.js"></script>
|
||||||
<link rel="import" href="../../../polymer.html">
|
<link rel="import" href="../../polymer.html">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -21,6 +21,38 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
<span>{{text}}</span>
|
<span>{{text}}</span>
|
||||||
</template>
|
</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>
|
<script>
|
||||||
|
|
||||||
suite('<dom-template>', function() {
|
suite('<dom-template>', function() {
|
||||||
@ -31,6 +63,11 @@ suite('<dom-template>', function() {
|
|||||||
assert.equal(row.root.textContent.trim(), 'ohai');
|
assert.equal(row.root.textContent.trim(), 'ohai');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('stamps within an element', function() {
|
||||||
|
var template = document.querySelector('#testDom');
|
||||||
|
assert.equal(template.value, 'ohai');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user