@@ -5,12 +5,6 @@ import { shallow } from 'enzyme';
5
5
import SizePerPageOption from '../src/size-per-page-option' ;
6
6
import SizePerPageDropDown from '../src/size-per-page-dropdown' ;
7
7
8
- const shallowWithContext = ( elem , context = { } ) => {
9
- const wrapper = shallow ( elem ) ;
10
- const Children = wrapper . props ( ) . children ( context ) ;
11
- return shallow ( Children ) ;
12
- } ;
13
-
14
8
describe ( 'SizePerPageDropDown' , ( ) => {
15
9
let wrapper ;
16
10
const currSizePerPage = '25' ;
@@ -34,9 +28,8 @@ describe('SizePerPageDropDown', () => {
34
28
35
29
describe ( 'default SizePerPageDropDown component' , ( ) => {
36
30
beforeEach ( ( ) => {
37
- wrapper = shallowWithContext (
38
- < SizePerPageDropDown { ...props } /> ,
39
- { bootstrap4 : false }
31
+ wrapper = shallow (
32
+ < SizePerPageDropDown { ...props } />
40
33
) ;
41
34
} ) ;
42
35
@@ -71,9 +64,8 @@ describe('SizePerPageDropDown', () => {
71
64
72
65
describe ( 'when bootstrap4 context is true' , ( ) => {
73
66
beforeEach ( ( ) => {
74
- wrapper = shallowWithContext (
75
- < SizePerPageDropDown { ...props } /> ,
76
- { bootstrap4 : true }
67
+ wrapper = shallow (
68
+ < SizePerPageDropDown { ...props } bootstrap4 />
77
69
) ;
78
70
} ) ;
79
71
@@ -112,9 +104,8 @@ describe('SizePerPageDropDown', () => {
112
104
113
105
describe ( 'when open prop is true' , ( ) => {
114
106
beforeEach ( ( ) => {
115
- wrapper = shallowWithContext (
116
- < SizePerPageDropDown { ...props } open /> ,
117
- { bootstrap4 : false }
107
+ wrapper = shallow (
108
+ < SizePerPageDropDown { ...props } open />
118
109
) ;
119
110
} ) ;
120
111
@@ -126,9 +117,8 @@ describe('SizePerPageDropDown', () => {
126
117
127
118
describe ( 'when hidden prop is true' , ( ) => {
128
119
beforeEach ( ( ) => {
129
- wrapper = shallowWithContext (
130
- < SizePerPageDropDown { ...props } hidden /> ,
131
- { bootstrap4 : false }
120
+ wrapper = shallow (
121
+ < SizePerPageDropDown { ...props } hidden />
132
122
) ;
133
123
} ) ;
134
124
@@ -140,9 +130,8 @@ describe('SizePerPageDropDown', () => {
140
130
describe ( 'when btnContextual prop is defined' , ( ) => {
141
131
const contextual = 'btn-warning' ;
142
132
beforeEach ( ( ) => {
143
- wrapper = shallowWithContext (
144
- < SizePerPageDropDown { ...props } btnContextual = { contextual } /> ,
145
- { bootstrap4 : false }
133
+ wrapper = shallow (
134
+ < SizePerPageDropDown { ...props } btnContextual = { contextual } />
146
135
) ;
147
136
} ) ;
148
137
@@ -154,9 +143,8 @@ describe('SizePerPageDropDown', () => {
154
143
describe ( 'when variation prop is defined' , ( ) => {
155
144
const variation = 'dropup' ;
156
145
beforeEach ( ( ) => {
157
- wrapper = shallowWithContext (
158
- < SizePerPageDropDown { ...props } variation = { variation } /> ,
159
- { bootstrap4 : false }
146
+ wrapper = shallow (
147
+ < SizePerPageDropDown { ...props } variation = { variation } />
160
148
) ;
161
149
} ) ;
162
150
@@ -168,9 +156,8 @@ describe('SizePerPageDropDown', () => {
168
156
describe ( 'when className prop is defined' , ( ) => {
169
157
const className = 'custom-class' ;
170
158
beforeEach ( ( ) => {
171
- wrapper = shallowWithContext (
172
- < SizePerPageDropDown { ...props } className = { className } /> ,
173
- { bootstrap4 : false }
159
+ wrapper = shallow (
160
+ < SizePerPageDropDown { ...props } className = { className } />
174
161
) ;
175
162
} ) ;
176
163
@@ -183,9 +170,8 @@ describe('SizePerPageDropDown', () => {
183
170
const optionRenderer = jest . fn ( ) ;
184
171
beforeEach ( ( ) => {
185
172
optionRenderer . mockReset ( ) ;
186
- wrapper = shallowWithContext (
187
- < SizePerPageDropDown { ...props } optionRenderer = { optionRenderer } /> ,
188
- { bootstrap4 : false }
173
+ wrapper = shallow (
174
+ < SizePerPageDropDown { ...props } optionRenderer = { optionRenderer } />
189
175
) ;
190
176
} ) ;
191
177
0 commit comments