@@ -5,12 +5,6 @@ import { shallow } from 'enzyme';
55import SizePerPageOption from '../src/size-per-page-option' ;
66import SizePerPageDropDown from '../src/size-per-page-dropdown' ;
77
8- const shallowWithContext = ( elem , context = { } ) => {
9- const wrapper = shallow ( elem ) ;
10- const Children = wrapper . props ( ) . children ( context ) ;
11- return shallow ( Children ) ;
12- } ;
13-
148describe ( 'SizePerPageDropDown' , ( ) => {
159 let wrapper ;
1610 const currSizePerPage = '25' ;
@@ -34,9 +28,8 @@ describe('SizePerPageDropDown', () => {
3428
3529 describe ( 'default SizePerPageDropDown component' , ( ) => {
3630 beforeEach ( ( ) => {
37- wrapper = shallowWithContext (
38- < SizePerPageDropDown { ...props } /> ,
39- { bootstrap4 : false }
31+ wrapper = shallow (
32+ < SizePerPageDropDown { ...props } />
4033 ) ;
4134 } ) ;
4235
@@ -71,9 +64,8 @@ describe('SizePerPageDropDown', () => {
7164
7265 describe ( 'when bootstrap4 context is true' , ( ) => {
7366 beforeEach ( ( ) => {
74- wrapper = shallowWithContext (
75- < SizePerPageDropDown { ...props } /> ,
76- { bootstrap4 : true }
67+ wrapper = shallow (
68+ < SizePerPageDropDown { ...props } bootstrap4 />
7769 ) ;
7870 } ) ;
7971
@@ -112,9 +104,8 @@ describe('SizePerPageDropDown', () => {
112104
113105 describe ( 'when open prop is true' , ( ) => {
114106 beforeEach ( ( ) => {
115- wrapper = shallowWithContext (
116- < SizePerPageDropDown { ...props } open /> ,
117- { bootstrap4 : false }
107+ wrapper = shallow (
108+ < SizePerPageDropDown { ...props } open />
118109 ) ;
119110 } ) ;
120111
@@ -126,9 +117,8 @@ describe('SizePerPageDropDown', () => {
126117
127118 describe ( 'when hidden prop is true' , ( ) => {
128119 beforeEach ( ( ) => {
129- wrapper = shallowWithContext (
130- < SizePerPageDropDown { ...props } hidden /> ,
131- { bootstrap4 : false }
120+ wrapper = shallow (
121+ < SizePerPageDropDown { ...props } hidden />
132122 ) ;
133123 } ) ;
134124
@@ -140,9 +130,8 @@ describe('SizePerPageDropDown', () => {
140130 describe ( 'when btnContextual prop is defined' , ( ) => {
141131 const contextual = 'btn-warning' ;
142132 beforeEach ( ( ) => {
143- wrapper = shallowWithContext (
144- < SizePerPageDropDown { ...props } btnContextual = { contextual } /> ,
145- { bootstrap4 : false }
133+ wrapper = shallow (
134+ < SizePerPageDropDown { ...props } btnContextual = { contextual } />
146135 ) ;
147136 } ) ;
148137
@@ -154,9 +143,8 @@ describe('SizePerPageDropDown', () => {
154143 describe ( 'when variation prop is defined' , ( ) => {
155144 const variation = 'dropup' ;
156145 beforeEach ( ( ) => {
157- wrapper = shallowWithContext (
158- < SizePerPageDropDown { ...props } variation = { variation } /> ,
159- { bootstrap4 : false }
146+ wrapper = shallow (
147+ < SizePerPageDropDown { ...props } variation = { variation } />
160148 ) ;
161149 } ) ;
162150
@@ -168,9 +156,8 @@ describe('SizePerPageDropDown', () => {
168156 describe ( 'when className prop is defined' , ( ) => {
169157 const className = 'custom-class' ;
170158 beforeEach ( ( ) => {
171- wrapper = shallowWithContext (
172- < SizePerPageDropDown { ...props } className = { className } /> ,
173- { bootstrap4 : false }
159+ wrapper = shallow (
160+ < SizePerPageDropDown { ...props } className = { className } />
174161 ) ;
175162 } ) ;
176163
@@ -183,9 +170,8 @@ describe('SizePerPageDropDown', () => {
183170 const optionRenderer = jest . fn ( ) ;
184171 beforeEach ( ( ) => {
185172 optionRenderer . mockReset ( ) ;
186- wrapper = shallowWithContext (
187- < SizePerPageDropDown { ...props } optionRenderer = { optionRenderer } /> ,
188- { bootstrap4 : false }
173+ wrapper = shallow (
174+ < SizePerPageDropDown { ...props } optionRenderer = { optionRenderer } />
189175 ) ;
190176 } ) ;
191177
0 commit comments