11import React from 'react'
2- import { shallow } from 'enzyme'
3- import styled , { ThemeProvider } from 'styled-components'
2+ import { mount } from 'enzyme'
3+ import styled from 'styled-components'
44import {
55 DEFAULT_BREAKPOINTS ,
66 getBreakpoints ,
@@ -16,7 +16,6 @@ import {
1616
1717describe ( 'breakpoints utils' , ( ) => {
1818 let props
19- let shallowWithTheme
2019
2120 beforeEach ( ( ) => {
2221 props = {
@@ -29,13 +28,6 @@ describe('breakpoints utils', () => {
2928 } ,
3029 } ,
3130 }
32-
33- shallowWithTheme = ( tree , theme = props . theme ) => {
34- const context = shallow ( < ThemeProvider theme = { theme } /> )
35- . instance ( )
36- . getChildContext ( )
37- return shallow ( tree , { context } )
38- }
3931 } )
4032
4133 describe ( '#getBreakpoints' , ( ) => {
@@ -110,7 +102,7 @@ describe('breakpoints utils', () => {
110102 ${ up ( 'lg' , { color : 'yellow' } ) } ;
111103 `
112104
113- const wrapper = shallowWithTheme ( < Dummy /> )
105+ const wrapper = mount ( < Dummy { ... props } /> )
114106 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'blue' )
115107 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' , {
116108 media : '(min-width:10px)' ,
@@ -126,7 +118,7 @@ describe('breakpoints utils', () => {
126118 ${ up ( 'xs' , 'color: red' ) } ;
127119 `
128120
129- const wrapper = shallowWithTheme ( < Dummy /> )
121+ const wrapper = mount ( < Dummy { ... props } /> )
130122 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' )
131123 } )
132124 } )
@@ -139,7 +131,7 @@ describe('breakpoints utils', () => {
139131 ${ down ( 'sm' , { color : 'yellow' } ) } ;
140132 `
141133
142- const wrapper = shallowWithTheme ( < Dummy /> )
134+ const wrapper = mount ( < Dummy { ... props } /> )
143135 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'blue' )
144136 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' , {
145137 media : '(max-width:9.98px)' ,
@@ -155,7 +147,7 @@ describe('breakpoints utils', () => {
155147 ${ down ( 'lg' , 'color: red' ) } ;
156148 `
157149
158- const wrapper = shallowWithTheme ( < Dummy /> )
150+ const wrapper = mount ( < Dummy { ... props } /> )
159151 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' )
160152 } )
161153 } )
@@ -168,7 +160,7 @@ describe('breakpoints utils', () => {
168160 ${ between ( 'xs' , 'sm' , { background : 'yellow' } ) } ;
169161 `
170162
171- const wrapper = shallowWithTheme ( < Dummy /> )
163+ const wrapper = mount ( < Dummy { ... props } /> )
172164 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'blue' )
173165 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' , {
174166 media : '(max-width:4.98px)' ,
@@ -184,7 +176,7 @@ describe('breakpoints utils', () => {
184176 ${ between ( 'md' , 'lg' , 'color: red' ) } ;
185177 `
186178
187- const wrapper = shallowWithTheme ( < Dummy /> )
179+ const wrapper = mount ( < Dummy { ... props } /> )
188180 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'blue' )
189181 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' , {
190182 media : '(min-width:10px)' ,
@@ -197,7 +189,7 @@ describe('breakpoints utils', () => {
197189 ${ between ( 'sm' , 'md' , 'color: red' ) } ;
198190 `
199191
200- const wrapper = shallowWithTheme ( < Dummy /> )
192+ const wrapper = mount ( < Dummy { ... props } /> )
201193 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'blue' )
202194 expect ( wrapper ) . toHaveStyleRule ( 'color' , 'red' , {
203195 media : '(min-width:5px) and (max-width:9.98px)' ,
0 commit comments