Skip to content

Commit 5b44d27

Browse files
committed
Add tests for added nested rules order
1 parent 2018cba commit 5b44d27

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

tests/integration/plugins.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import expect from 'expect.js'
22
import {stripIndent} from 'common-tags'
3+
import jssNested from 'jss-nested'
34
import {create} from '../../src'
45
import StyleSheet from '../../src/StyleSheet'
5-
import {createGenerateClassName} from '../utils'
66
import PluginsRegistry from '../../src/PluginsRegistry'
7+
import {
8+
createGenerateClassName,
9+
getCssFromSheet,
10+
removeWhitespace
11+
} from '../utils'
712

813
describe('Integration: plugins', () => {
914
let jss
@@ -416,4 +421,31 @@ describe('Integration: plugins', () => {
416421
`)
417422
})
418423
})
424+
425+
describe('jss-nested', () => {
426+
let sheet
427+
428+
beforeEach(() => {
429+
jss.use(jssNested())
430+
431+
sheet = jss.createStyleSheet({}, {
432+
link: true,
433+
}).attach()
434+
435+
sheet.addRule('b', {color: 'green'})
436+
sheet.addRule('a', {
437+
'&:hover': {
438+
'& $b': {
439+
color: () => 'red',
440+
},
441+
},
442+
})
443+
})
444+
445+
it('should save the added nested rules order', () => {
446+
sheet.update()
447+
448+
expect(getCssFromSheet(sheet)).to.be(removeWhitespace(sheet.toString()))
449+
})
450+
})
419451
})

0 commit comments

Comments
 (0)