File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -247,6 +247,34 @@ describe('Functional: sheet', () => {
247247 } )
248248 } )
249249
250+ describe ( '.addRule() with just function values and attached sheet' , ( ) => {
251+ let style
252+ let sheet
253+
254+ beforeEach ( ( ) => {
255+ sheet = jss . createStyleSheet ( ) . attach ( ) . link ( )
256+ sheet . addRule ( 'a' , { color : ( { color} ) => color } )
257+ style = getStyle ( )
258+ } )
259+
260+ afterEach ( ( ) => {
261+ sheet . detach ( )
262+ } )
263+
264+ it ( 'should render an empty rule' , ( ) => {
265+ expect ( getCss ( style ) ) . to . be ( removeWhitespace ( sheet . toString ( ) ) )
266+ } )
267+
268+ it ( 'should render rule with updated color' , ( ) => {
269+ sheet . update ( { color : 'red' } )
270+ expect ( sheet . toString ( ) ) . to . be ( stripIndent `
271+ .a-id {
272+ color: red;
273+ }
274+ ` )
275+ } )
276+ } )
277+
250278 describe ( '.addRule() with empty styles' , ( ) => {
251279 let sheet
252280 let style
@@ -449,7 +477,14 @@ describe('Functional: sheet', () => {
449477 } )
450478
451479 it ( 'should return correct .toString()' , ( ) => {
452- expect ( sheet . toString ( ) ) . to . be ( '' )
480+ expect ( sheet . toString ( ) ) . to . be ( stripIndent `
481+ .a-id {
482+ }
483+ @media all {
484+ .b-id {
485+ }
486+ }
487+ ` )
453488
454489 sheet . update ( {
455490 color : 'green'
You can’t perform that action at this time.
0 commit comments