mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Add test for direct assignment to template.
This commit is contained in:
@@ -266,6 +266,26 @@ class SubNewTemplate extends window.MyElement {
|
||||
}
|
||||
|
||||
customElements.define('sub-new-template', SubNewTemplate);
|
||||
|
||||
/**
|
||||
* Instead of overriding the static getter, this element has its template
|
||||
* assigned directly to the constructor.
|
||||
*/
|
||||
class SubNewTemplateAssigned extends window.MyElement {
|
||||
static get properties() {
|
||||
return {
|
||||
prop2: {
|
||||
value: 'prop2',
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
SubNewTemplateAssigned.template = html`
|
||||
<h1>Sub template</h1>
|
||||
<div id="subContent">{{prop2}}</div>`;
|
||||
|
||||
customElements.define('sub-new-template-assigned', SubNewTemplateAssigned);
|
||||
</script>
|
||||
|
||||
<template id="no-dom-module">
|
||||
@@ -579,6 +599,25 @@ suite('subclass new template', function() {
|
||||
});
|
||||
});
|
||||
|
||||
suite('subclass new template assigned', function() {
|
||||
let el;
|
||||
|
||||
setup(function() {
|
||||
el = document.createElement('sub-new-template-assigned');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
document.body.removeChild(el);
|
||||
});
|
||||
|
||||
test('template', function() {
|
||||
assert.equal(el.prop2, 'prop2');
|
||||
assert.equal(el.$.subContent.textContent, el.prop2);
|
||||
assert.notOk(el.$.content);
|
||||
});
|
||||
});
|
||||
|
||||
suite('extend sub-class template', function() {
|
||||
let el, baseEl;
|
||||
setup(function() {
|
||||
|
||||
Reference in New Issue
Block a user