@@ -22,12 +22,12 @@ const mockAddon = jest.fn().mockImplementation(() => ({
22
22
onColumnsChanged : new Slick . Event ( ) ,
23
23
} ) ) ;
24
24
25
- jest . mock ( 'slickgrid/controls/slick.columnpicker' , ( ) => mockAddon ) ;
26
- Slick . Controls = {
27
- ColumnPicker : mockAddon
28
- } ;
29
-
30
25
describe ( 'columnPickerExtension' , ( ) => {
26
+ jest . mock ( 'slickgrid/controls/slick.columnpicker' , ( ) => mockAddon ) ;
27
+ Slick . Controls = {
28
+ ColumnPicker : mockAddon
29
+ } ;
30
+
31
31
const columnsMock : Column [ ] = [ { id : 'field1' , field : 'field1' , width : 100 , nameKey : 'TITLE' } , { id : 'field2' , field : 'field2' , width : 75 } ] ;
32
32
let extensionUtility : ExtensionUtility ;
33
33
let translate : TranslateService ;
@@ -103,21 +103,21 @@ describe('columnPickerExtension', () => {
103
103
104
104
it ( `should call internal event handler subscribe and expect the "onColumnsChanged" grid option to be called when addon notify is called
105
105
and it should override "visibleColumns" when array passed as arguments is bigger than previous visible columns` , ( ) => {
106
- const handlerSpy = jest . spyOn ( extension . eventHandler , 'subscribe' ) ;
107
- const onColumnSpy = jest . spyOn ( SharedService . prototype . gridOptions . columnPicker , 'onColumnsChanged' ) ;
108
- const visibleColsSpy = jest . spyOn ( SharedService . prototype , 'visibleColumns' , 'set' ) ;
109
-
110
- const instance = extension . register ( ) ;
111
- instance . onColumnsChanged . notify ( { columnId : 'field1' , showing : true , columns : columnsMock , grid : gridStub } , new Slick . EventData ( ) , gridStub ) ;
112
-
113
- expect ( handlerSpy ) . toHaveBeenCalledTimes ( 1 ) ;
114
- expect ( handlerSpy ) . toHaveBeenCalledWith (
115
- { notify : expect . anything ( ) , subscribe : expect . anything ( ) , unsubscribe : expect . anything ( ) , } ,
116
- expect . anything ( )
117
- ) ;
118
- expect ( onColumnSpy ) . toHaveBeenCalledWith ( expect . anything ( ) , { columnId : 'field1' , showing : true , columns : columnsMock , grid : gridStub } ) ;
119
- expect ( visibleColsSpy ) . toHaveBeenCalledWith ( columnsMock ) ;
120
- } ) ;
106
+ const handlerSpy = jest . spyOn ( extension . eventHandler , 'subscribe' ) ;
107
+ const onColumnSpy = jest . spyOn ( SharedService . prototype . gridOptions . columnPicker , 'onColumnsChanged' ) ;
108
+ const visibleColsSpy = jest . spyOn ( SharedService . prototype , 'visibleColumns' , 'set' ) ;
109
+
110
+ const instance = extension . register ( ) ;
111
+ instance . onColumnsChanged . notify ( { columnId : 'field1' , showing : true , columns : columnsMock , grid : gridStub } , new Slick . EventData ( ) , gridStub ) ;
112
+
113
+ expect ( handlerSpy ) . toHaveBeenCalledTimes ( 1 ) ;
114
+ expect ( handlerSpy ) . toHaveBeenCalledWith (
115
+ { notify : expect . anything ( ) , subscribe : expect . anything ( ) , unsubscribe : expect . anything ( ) , } ,
116
+ expect . anything ( )
117
+ ) ;
118
+ expect ( onColumnSpy ) . toHaveBeenCalledWith ( expect . anything ( ) , { columnId : 'field1' , showing : true , columns : columnsMock , grid : gridStub } ) ;
119
+ expect ( visibleColsSpy ) . toHaveBeenCalledWith ( columnsMock ) ;
120
+ } ) ;
121
121
122
122
it ( 'should call internal "onColumnsChanged" event and expect "readjustFrozenColumnIndexWhenNeeded" method to be called when the grid is detected to be a frozen grid' , ( ) => {
123
123
gridOptionsMock . frozenColumn = 0 ;
0 commit comments