mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Returning null in template should nullify parent template
This commit is contained in:
@@ -113,6 +113,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id="parent-element-template-overriding">
|
||||
<script>
|
||||
HTMLImports.whenReady(function() {
|
||||
class ParentElementWithTemplate extends Polymer.Element {
|
||||
static get template() {
|
||||
return Polymer.html`This template should not exist`;
|
||||
}
|
||||
}
|
||||
class ChildWithNoTemplate extends ParentElementWithTemplate {
|
||||
static get template() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
customElements.define('child-with-no-template', ChildWithNoTemplate);
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<test-fixture id="basic">
|
||||
<template>
|
||||
<base-el></base-el>
|
||||
@@ -237,6 +255,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
assert.equal(child.handleCustomEvent.callCount, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('child overriding a template', function() {
|
||||
let el;
|
||||
|
||||
setup(function() {
|
||||
el = document.createElement('child-with-no-template');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
document.body.removeChild(el);
|
||||
});
|
||||
|
||||
test('returning null nullifies the parent template', function() {
|
||||
assert.isNotOk(el.shadowRoot);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user