Ensure _template from behaviors takes precedence over is in legacy.

This commit is contained in:
Kevin Schaaf
2018-11-01 15:46:32 -07:00
parent fb5a7e32b8
commit 08b267f338
2 changed files with 11 additions and 2 deletions
+9
View File
@@ -351,6 +351,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
Polymer.LegacyElementMixin(HTMLElement));
// decorate klass with registration info
klass.is = info.is;
// To match 1.x behavior, `_template` supplied on a behavior should take
// precedence over dom-module lookup for `is`; this also prevents
// dom-module injection under strictTemplatePolicy for an element that
// would normally get its template from a behavior.
// TODO(sorvell): Remove once "flattened behaviors" lands, since both
// `_template` and `is` will be on the same class after that change
if (klass.prototype._template !== undefined) {
klass.prototype._template = klass.prototype._template;
}
return klass;
};
+2 -2
View File
@@ -602,8 +602,8 @@ suite('templates from behaviors', function() {
test('template from base', function() {
var el = fixture('from-base');
assert.ok(el.shadowRoot.querySelector('#from-base'));
assert.notOk(el.shadowRoot.querySelector('#from-behavior1'));
assert.notOk(el.shadowRoot.querySelector('#from-base'));
assert.ok(el.shadowRoot.querySelector('#from-behavior1'));
});
test('template from behavior', function() {