Skip to content

Commit

Permalink
fix: allow to override included modules (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Nov 24, 2020
1 parent ff8408f commit 4b5aad6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion register-styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

themeModuleElement.innerHTML = `
<template>
${styles.map(style => `<style include=${styleMap[style]}></style>`)}
${moduleIncludes.map(include => `<style include=${include}></style>`)}
${styles.map(style => `<style include=${styleMap[style]}></style>`)}
</template>
`;

Expand Down
13 changes: 13 additions & 0 deletions test/register-styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@
expect(window.getComputedStyle(instance).color).to.equal('rgb(255, 0, 0)');
});

it('should include style modules before the component styles', () => {
registerStyles(undefined, css`:host {
color: rgb(255, 0, 0);
}`, {moduleId: unique('id')});

registerStyles(unique('component'), css`:host {
color: rgb(0, 0, 255);
}`, {include: [unique('id')]});

const instance = defineAndInstantiate(unique('component'));
expect(window.getComputedStyle(instance).color).to.equal('rgb(0, 0, 255)');
});

it('should not add a theme-for attribute to the module with id', () => {
registerStyles(undefined, css`:host {
color: rgb(255, 0, 0);
Expand Down

0 comments on commit 4b5aad6

Please sign in to comment.