@@ -197,6 +197,10 @@ describe('withEvents extension with overrides', () => {
197
197
expect ( userComponentWillMount ) . to . have . been . calledBefore ( callbackWill ) ;
198
198
} ) ;
199
199
200
+ it ( 'runs user code in override on mount with "this" context of component' , ( ) => {
201
+ expect ( userComponentWillMount ) . to . have . been . calledOn ( component . instance ( ) ) ;
202
+ } ) ;
203
+
200
204
it ( 'runs on props update' , ( ) => {
201
205
component . setProps ( getUniqueProps ( ) ) ;
202
206
expect ( callbackWill ) . to . have . been . calledTwice ( ) ;
@@ -207,6 +211,11 @@ describe('withEvents extension with overrides', () => {
207
211
expect ( userComponentWillReceiveProps ) . to . have . been . calledBefore ( callbackWill . secondCall ) ;
208
212
} ) ;
209
213
214
+ it ( 'runs user code in override on props update with "this" context of component' , ( ) => {
215
+ component . setProps ( getUniqueProps ( ) ) ;
216
+ expect ( userComponentWillReceiveProps ) . to . have . been . calledOn ( component . instance ( ) ) ;
217
+ } ) ;
218
+
210
219
it ( 'does not run on state update' , ( ) => {
211
220
component . setState ( getUniqueState ( ) ) ;
212
221
expect ( callbackWill ) . to . have . been . calledOnce ( ) ;
@@ -222,6 +231,10 @@ describe('withEvents extension with overrides', () => {
222
231
expect ( userComponentDidMount ) . to . have . been . calledBefore ( callbackDid ) ;
223
232
} ) ;
224
233
234
+ it ( 'runs user code in override on mount with "this" context of component' , ( ) => {
235
+ expect ( userComponentDidMount ) . to . have . been . calledOn ( component . instance ( ) ) ;
236
+ } ) ;
237
+
225
238
it ( 'runs on props update' , ( ) => {
226
239
component . setProps ( getUniqueProps ( ) ) ;
227
240
expect ( callbackDid ) . to . have . been . calledTwice ( ) ;
@@ -232,6 +245,11 @@ describe('withEvents extension with overrides', () => {
232
245
expect ( userComponentDidUpdate ) . to . have . been . calledBefore ( callbackDid . secondCall ) ;
233
246
} ) ;
234
247
248
+ it ( 'runs user code in override on props update with "this" context of component' , ( ) => {
249
+ component . setProps ( getUniqueProps ( ) ) ;
250
+ expect ( userComponentDidUpdate ) . to . have . been . calledOn ( component . instance ( ) ) ;
251
+ } ) ;
252
+
235
253
it ( 'runs on state update' , ( ) => {
236
254
component . setState ( getUniqueState ( ) ) ;
237
255
expect ( callbackDid ) . to . have . been . calledTwice ( ) ;
@@ -241,5 +259,10 @@ describe('withEvents extension with overrides', () => {
241
259
component . setState ( getUniqueState ( ) ) ;
242
260
expect ( userComponentDidUpdate ) . to . have . been . calledBefore ( callbackDid . secondCall ) ;
243
261
} ) ;
262
+
263
+ it ( 'runs user code in override on state update with "this" context of component' , ( ) => {
264
+ component . setState ( getUniqueState ( ) ) ;
265
+ expect ( userComponentDidUpdate ) . to . have . been . calledOn ( component . instance ( ) ) ;
266
+ } ) ;
244
267
} ) ;
245
268
} ) ;
0 commit comments