@@ -31,6 +31,10 @@ const {
3131 ReactCurrentDispatcher
3232} = ( React : any ) . __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
3333
34+ const {
35+ StyleSheet
36+ } = require ( 'styled-components' ) . __DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS
37+
3438let prevDispatcher = null
3539
3640beforeEach ( ( ) => {
@@ -48,6 +52,10 @@ afterEach(() => {
4852const Noop = ( ) => null
4953
5054describe ( 'visitElement' , ( ) => {
55+ beforeEach ( ( ) => {
56+ StyleSheet . reset ( true )
57+ } )
58+
5159 it ( 'walks Fragments' , ( ) => {
5260 const element = (
5361 < Fragment >
@@ -115,14 +123,32 @@ describe('visitElement', () => {
115123 [ ] ,
116124 ( ) => { }
117125 )
126+
118127 expect ( children . length ) . toBe ( 1 )
119128 expect ( children [ 0 ] . type ) . toBe ( Noop )
129+ expect ( StyleSheet . master . tags . length ) . toBe ( 1 )
130+
131+ const tag = StyleSheet . master . tags [ 0 ]
132+ expect ( tag . css ( ) . trim ( ) ) . toBe ( '' )
133+
134+ expect ( Object . keys ( StyleSheet . master . deferred ) ) . toEqual ( [
135+ expect . any ( String )
136+ ] )
120137 } )
121138
122139 it ( 'walks StyledComponent wrapper elements' , ( ) => {
123140 const Comp = styled ( Noop ) ``
124141 const children = visitElement ( < Comp /> , [ ] , ( ) => { } )
142+
125143 expect ( children . length ) . toBe ( 1 )
144+ expect ( StyleSheet . master . tags . length ) . toBe ( 1 )
145+
146+ const tag = StyleSheet . master . tags [ 0 ]
147+ expect ( tag . css ( ) . trim ( ) ) . toBe ( '' )
148+
149+ expect ( Object . keys ( StyleSheet . master . deferred ) ) . toEqual ( [
150+ expect . any ( String )
151+ ] )
126152 } )
127153
128154 it ( 'walks Providers and Consumers' , ( ) => {
0 commit comments