Skip to content

Commit

Permalink
Add test case for applying multiple scoped styles to a DOM tree
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmorr committed May 29, 2020
1 parent 621eb2f commit dfe58e3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/specs/scoped.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,29 @@ describe('scoped', () => {

div.remove();
});

it('should support multiple scoped styles', () => {
const element = document.createElement('div');
element.classList.add('foo');
document.body.appendChild(element);

const width = scoped(`
.foo {
width: 41px;
}
`);

const height = scoped(`
.foo {
height: 26px;
}
`);

width(height(element));

expect(window.getComputedStyle(element).getPropertyValue('width')).to.equal('41px');
expect(window.getComputedStyle(element).getPropertyValue('height')).to.equal('26px');

element.remove();
});
});

0 comments on commit dfe58e3

Please sign in to comment.