@@ -306,40 +306,10 @@ describe('SlickRowDetailView plugin', () => {
306306 expect ( stopPropagationSpy ) . not . toHaveBeenCalled ( ) ;
307307 } ) ;
308308
309- it ( 'should trigger onClick and NOT expect Row Detail to be toggled when onBeforeRowDetailToggle returns false' , ( ) => {
310- const mockProcess = jest . fn ( ) ;
311- const expandDetailViewSpy = jest . spyOn ( plugin , 'expandDetailView' ) ;
312- const onBeforeSlickEventData = new Slick . EventData ( ) ;
313- jest . spyOn ( onBeforeSlickEventData , 'getReturnValue' ) . mockReturnValue ( false ) ;
314- const beforeRowDetailToggleSpy = jest . spyOn ( plugin . onBeforeRowDetailToggle , 'notify' ) . mockReturnValueOnce ( onBeforeSlickEventData ) ;
315- const afterRowDetailToggleSpy = jest . spyOn ( plugin . onAfterRowDetailToggle , 'notify' ) ;
316- const itemMock = { id : 123 , firstName : 'John' , lastName : 'Doe' , _collapsed : true } ;
317- const detailView = `<span>loading...</span>` ;
318- jest . spyOn ( gridStub . getEditorLock ( ) , 'isActive' ) . mockReturnValue ( false ) ;
319- jest . spyOn ( gridStub . getEditorLock ( ) , 'commitCurrentEdit' ) . mockReturnValue ( true ) ;
320- jest . spyOn ( gridStub , 'getDataItem' ) . mockReturnValue ( itemMock ) ;
321- jest . spyOn ( gridStub , 'getColumns' ) . mockReturnValue ( mockColumns ) ;
322- jest . spyOn ( gridStub , 'getOptions' ) . mockReturnValue ( { ...gridOptionsMock , rowDetailView : { process : mockProcess , columnIndexPosition : 0 , useRowClick : true , maxRows : 2 , panelRows : 2 } as any } ) ;
323-
324- plugin . init ( gridStub ) ;
325- plugin . onAsyncResponse . notify ( { item : itemMock , itemDetail : itemMock , detailView, } , new Slick . EventData ( ) ) ;
326-
327- const clickEvent = new Event ( 'click' ) ;
328- Object . defineProperty ( clickEvent , 'target' , { writable : true , configurable : true , value : document . createElement ( 'div' ) } ) ;
329- Object . defineProperty ( clickEvent , 'isPropagationStopped' , { writable : true , configurable : true , value : jest . fn ( ) } ) ;
330- Object . defineProperty ( clickEvent , 'isImmediatePropagationStopped' , { writable : true , configurable : true , value : jest . fn ( ) } ) ;
331- gridStub . onClick . notify ( { row : 0 , cell : 1 , grid : gridStub } , clickEvent ) ;
332-
333- expect ( beforeRowDetailToggleSpy ) . toHaveBeenCalled ( ) ;
334- expect ( afterRowDetailToggleSpy ) . not . toHaveBeenCalled ( ) ;
335- expect ( expandDetailViewSpy ) . not . toHaveBeenCalled ( ) ;
336- } ) ;
337-
338- it ( 'should trigger onClick and expect Row Detail to be toggled' , ( ) => {
309+ it ( 'should trigger onClick and ' , ( ) => {
339310 const mockProcess = jest . fn ( ) ;
340311 const expandDetailViewSpy = jest . spyOn ( plugin , 'expandDetailView' ) ;
341312 const beforeRowDetailToggleSpy = jest . spyOn ( plugin . onBeforeRowDetailToggle , 'notify' ) ;
342- const afterRowDetailToggleSpy = jest . spyOn ( plugin . onAfterRowDetailToggle , 'notify' ) ;
343313 const itemMock = { id : 123 , firstName : 'John' , lastName : 'Doe' , _collapsed : true } ;
344314 const detailView = `<span>loading...</span>` ;
345315 jest . spyOn ( gridStub . getEditorLock ( ) , 'isActive' ) . mockReturnValue ( false ) ;
@@ -358,7 +328,6 @@ describe('SlickRowDetailView plugin', () => {
358328 gridStub . onClick . notify ( { row : 0 , cell : 1 , grid : gridStub } , clickEvent ) ;
359329
360330 expect ( beforeRowDetailToggleSpy ) . toHaveBeenCalled ( ) ;
361- expect ( afterRowDetailToggleSpy ) . toHaveBeenCalled ( ) ;
362331 expect ( expandDetailViewSpy ) . toHaveBeenCalledWith ( {
363332 _collapsed : false , _detailContent : undefined , _detailViewLoaded : true ,
364333 _height : 75 , _sizePadding : 3 , firstName : 'John' , id : 123 , lastName : 'Doe'
@@ -441,7 +410,7 @@ describe('SlickRowDetailView plugin', () => {
441410 _collapsed : true , _detailViewLoaded : true , _sizePadding : 0 , _height : 150 , _detailContent : '<span>loading...</span>' ,
442411 id : 123 , firstName : 'John' , lastName : 'Doe' ,
443412 }
444- } , expect . anything ( ) , expect . anything ( ) ) ;
413+ } ) ;
445414 expect ( afterRowDetailToggleSpy ) . toHaveBeenCalledWith ( {
446415 grid : gridStub ,
447416 item : {
0 commit comments