Skip to content

Commit 4ebaee9

Browse files
committed
Fix sheet.update() .toString() test, add test for addRule with function value
1 parent 353b91c commit 4ebaee9

1 file changed

Lines changed: 38 additions & 1 deletion

File tree

tests/functional/sheet.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,36 @@ describe('Functional: sheet', () => {
247247
})
248248
})
249249

250+
/*
251+
describe('.addRule() with just function values and attached sheet', () => {
252+
let style
253+
let sheet
254+
255+
beforeEach(() => {
256+
sheet = jss.createStyleSheet().attach().link()
257+
sheet.addRule('a', {color: ({color}) => color})
258+
style = getStyle()
259+
})
260+
261+
afterEach(() => {
262+
sheet.detach()
263+
})
264+
265+
it('should render an empty rule', () => {
266+
expect(getCss(style)).to.be(removeWhitespace(sheet.toString()))
267+
})
268+
269+
it('should render rule with updated color', () => {
270+
sheet.update({color: 'red'})
271+
expect(sheet.toString()).to.be(stripIndent`
272+
.a-id {
273+
color: red;
274+
}
275+
`)
276+
})
277+
})
278+
*/
279+
250280
describe('.addRule() with empty styles', () => {
251281
let sheet
252282
let style
@@ -449,7 +479,14 @@ describe('Functional: sheet', () => {
449479
})
450480

451481
it('should return correct .toString()', () => {
452-
expect(sheet.toString()).to.be('')
482+
expect(sheet.toString()).to.be(stripIndent`
483+
.a-id {
484+
}
485+
@media all {
486+
.b-id {
487+
}
488+
}
489+
`)
453490

454491
sheet.update({
455492
color: 'green'

0 commit comments

Comments
 (0)