Skip to content

Commit b119248

Browse files
authored
fix: always apply inherited styles
vaadin/vaadin-themable-mixin#81
1 parent 02c13f6 commit b119248

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/vaadin-themable-mixin/test/themable-mixin.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ describe('ThemableMixin', () => {
316316
expect(getComputedStyle(components[2].$.text).width).to.equal('100px');
317317
});
318318

319-
it('should not inherit parent themes to own custom template', () => {
320-
expect(getComputedStyle(components[4].$.text).backgroundColor).not.to.equal('rgb(255, 0, 0)');
319+
it('should inherit parent themes to own custom template', () => {
320+
expect(getComputedStyle(components[4].$.text).backgroundColor).to.equal('rgb(255, 0, 0)');
321321
});
322322

323323
it('should override vaadin module styles', () => {

packages/vaadin-themable-mixin/vaadin-themable-mixin.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ export const ThemableMixin = (superClass) =>
1313

1414
const template = this.prototype._template;
1515

16-
const hasOwnTemplate = Object.prototype.hasOwnProperty.call(this, 'template');
1716
const inheritedTemplate = Object.getPrototypeOf(this.prototype)._template;
18-
if (inheritedTemplate && !hasOwnTemplate) {
19-
// The element doesn't define its own template -> include the theme modules from the inherited template
17+
if (inheritedTemplate) {
18+
// Include the theme modules from the inherited template
2019
Array.from(inheritedTemplate.content.querySelectorAll('style[include]')).forEach((s) => {
2120
this._includeStyle(s.getAttribute('include'), template);
2221
});

0 commit comments

Comments
 (0)