@@ -262,35 +262,39 @@ describe('SlickRowDetailView', () => {
262
262
expect ( onRowBackViewSpy ) . not . toHaveBeenCalled ( ) ;
263
263
} ) ;
264
264
265
- it ( 'should call internal event handler subscribe and expect the "onAsyncEndUpdate" option to be called when addon notify is called' , ( ) => {
266
- // const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
267
- const renderSpy = vi . spyOn ( plugin , 'renderViewModel' ) ;
265
+ it ( 'should call internal event handler subscribe and expect the "onAsyncEndUpdate" option to be called when addon notify is called' , ( ) =>
266
+ new Promise ( ( done : any ) => {
267
+ // const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
268
+ const renderSpy = vi . spyOn ( plugin , 'renderViewModel' ) ;
268
269
269
- const onAsyncRespSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAsyncResponse' ) ;
270
- const onAsyncEndSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAsyncEndUpdate' ) ;
271
- const onAfterRowSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAfterRowDetailToggle' ) ;
272
- const onBeforeRowSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onBeforeRowDetailToggle' ) ;
273
- const onRowOutViewSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onRowOutOfViewportRange' ) ;
274
- const onRowBackViewSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onRowBackToViewportRange' ) ;
270
+ const onAsyncRespSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAsyncResponse' ) ;
271
+ const onAsyncEndSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAsyncEndUpdate' ) ;
272
+ const onAfterRowSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onAfterRowDetailToggle' ) ;
273
+ const onBeforeRowSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onBeforeRowDetailToggle' ) ;
274
+ const onRowOutViewSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onRowOutOfViewportRange' ) ;
275
+ const onRowBackViewSpy = vi . spyOn ( gridOptionsMock . rowDetailView as RowDetailView , 'onRowBackToViewportRange' ) ;
275
276
276
- plugin . init ( gridStub ) ;
277
- plugin . onAsyncEndUpdate = new SlickEvent ( ) ;
278
- plugin . register ( ) ;
279
- plugin . onAsyncEndUpdate . notify ( { item : columnsMock [ 0 ] , itemDetail : columnsMock [ 0 ] , grid : gridStub } , new SlickEventData ( ) , gridStub ) ;
277
+ plugin . init ( gridStub ) ;
278
+ plugin . onAsyncEndUpdate = new SlickEvent ( ) ;
279
+ plugin . register ( ) ;
280
+ plugin . onAsyncEndUpdate . notify ( { item : columnsMock [ 0 ] , itemDetail : columnsMock [ 0 ] , grid : gridStub } , new SlickEventData ( ) , gridStub ) ;
280
281
281
- // expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
282
- // expect(handlerSpy).toHaveBeenCalledWith(
283
- // { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
284
- // expect.anything()
285
- // );
286
- expect ( onAsyncRespSpy ) . not . toHaveBeenCalled ( ) ;
287
- expect ( onAsyncEndSpy ) . toHaveBeenCalledWith ( expect . anything ( ) , { item : columnsMock [ 0 ] , itemDetail : columnsMock [ 0 ] , grid : gridStub } ) ;
288
- expect ( renderSpy ) . toHaveBeenCalledWith ( { cssClass : 'red' , field : 'field1' , id : 'field1' , width : 100 } ) ;
289
- expect ( onAfterRowSpy ) . not . toHaveBeenCalled ( ) ;
290
- expect ( onBeforeRowSpy ) . not . toHaveBeenCalled ( ) ;
291
- expect ( onRowOutViewSpy ) . not . toHaveBeenCalled ( ) ;
292
- expect ( onRowBackViewSpy ) . not . toHaveBeenCalled ( ) ;
293
- } ) ;
282
+ // expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
283
+ // expect(handlerSpy).toHaveBeenCalledWith(
284
+ // { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
285
+ // expect.anything()
286
+ // );
287
+ setTimeout ( ( ) => {
288
+ expect ( onAsyncRespSpy ) . not . toHaveBeenCalled ( ) ;
289
+ expect ( onAsyncEndSpy ) . toHaveBeenCalledWith ( expect . anything ( ) , { item : columnsMock [ 0 ] , itemDetail : columnsMock [ 0 ] , grid : gridStub } ) ;
290
+ expect ( renderSpy ) . toHaveBeenCalledWith ( { cssClass : 'red' , field : 'field1' , id : 'field1' , width : 100 } ) ;
291
+ expect ( onAfterRowSpy ) . not . toHaveBeenCalled ( ) ;
292
+ expect ( onBeforeRowSpy ) . not . toHaveBeenCalled ( ) ;
293
+ expect ( onRowOutViewSpy ) . not . toHaveBeenCalled ( ) ;
294
+ expect ( onRowBackViewSpy ) . not . toHaveBeenCalled ( ) ;
295
+ done ( ) ;
296
+ } ) ;
297
+ } ) ) ;
294
298
295
299
it ( 'should call internal event handler subscribe and expect the "onAfterRowDetailToggle" option to be called when addon notify is called' , ( ) => {
296
300
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
0 commit comments