Skip to content

Commit

Permalink
test: repro issue with important styles and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Apr 5, 2024
1 parent 8a0f98f commit 8136599
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createElement } from 'lwc';
import Component from 'x/component';

it('should render !important styles correctly', async () => {
const elm = createElement('x-component', { is: Component });
document.body.appendChild(elm);

await Promise.resolve();

for (const div of elm.shadowRoot.querySelectorAll('div')) {
expect(div.style.getPropertyValue('color')).toBe('red');
expect(div.style.getPropertyPriority('color')).toBe('important');
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<div style="color: red !important "></div>
<div style="color: red !important ;"></div>
<div style="color: red !important "></div>
<div style="color: red !important ;"></div>
<div style="color: red ! important;"></div>
<div style="color: red ! important"></div>
<div style=" color : red ! important ; "></div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {}

0 comments on commit 8136599

Please sign in to comment.