@@ -3,6 +3,11 @@ import React from 'react'
33import { stripIndent } from 'common-tags'
44import { mount } from 'enzyme'
55
6+ import {
7+ getCss ,
8+ removeWhitespace
9+ } from './utils'
10+
611import CreateApp from './App'
712
813let Styled
@@ -18,6 +23,7 @@ const mockNameGenerators = () => {
1823 const generateTagName = require ( '../utils/generateTagName' ) . default
1924 const generateClassName = require ( 'jss/lib/utils/generateClassName' ) . default
2025
26+ // $FlowIgnore
2127 generateTagName . mockImplementation ( ( tagName : string ) => `${ tagName } -${ ++ styledCounter } ` )
2228 generateClassName . mockImplementation ( rule => `${ rule . name } -${ ++ jssCounter } ` )
2329}
@@ -30,6 +36,10 @@ describe('functional tests', () => {
3036 styled = Styled ( )
3137 } )
3238
39+ afterEach ( ( ) => {
40+ styled . mountSheet ( ) . detach ( )
41+ } )
42+
3343 it ( 'should update props and unmount' , ( ) => {
3444 const App = CreateApp ( styled )
3545 const wrapper = mount ( < App /> )
@@ -146,6 +156,8 @@ describe('functional tests', () => {
146156 }
147157 ` )
148158
159+ expect ( getCss ( sheet ) ) . toBe ( removeWhitespace ( sheet . toString ( ) ) )
160+
149161 wrapper . setProps ( { primary : true } )
150162
151163 expect ( sheet . toString ( ) ) . toBe ( stripIndent `
@@ -166,6 +178,8 @@ describe('functional tests', () => {
166178 }
167179 ` )
168180
181+ expect ( getCss ( sheet ) ) . toBe ( removeWhitespace ( sheet . toString ( ) ) )
182+
169183 wrapper . unmount ( )
170184 } )
171185} )
0 commit comments