Skip to content

Commit bd991f0

Browse files
committed
fix(columns): Column Grouping should re-render after cols reordering
1 parent 507b299 commit bd991f0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/app/modules/angular-slickgrid/services/__tests__/groupingAndColspan.service.spec.ts

+13
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const gridStub = {
3737
getSortColumns: jest.fn(),
3838
invalidate: jest.fn(),
3939
onColumnsResized: new Slick.Event(),
40+
onColumnsReordered: new Slick.Event(),
4041
onSort: new Slick.Event(),
4142
render: jest.fn(),
4243
setColumns: jest.fn(),
@@ -184,6 +185,18 @@ describe('GroupingAndColspanService', () => {
184185
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 50);
185186
});
186187

188+
it('should call the "renderPreHeaderRowGroupingTitles" after triggering a grid "onColumnsReordered"', () => {
189+
const spy = jest.spyOn(service, 'renderPreHeaderRowGroupingTitles');
190+
191+
service.init(gridStub, dataViewStub);
192+
gridStub.onColumnsReordered.notify({}, new Slick.EventData(), gridStub);
193+
jest.runAllTimers(); // fast-forward timer
194+
195+
expect(spy).toHaveBeenCalledTimes(2);
196+
expect(setTimeout).toHaveBeenCalledTimes(1);
197+
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 50);
198+
});
199+
187200
it('should call the "renderPreHeaderRowGroupingTitles" after triggering a dataView "onColumnsResized"', () => {
188201
const spy = jest.spyOn(service, 'renderPreHeaderRowGroupingTitles');
189202

src/app/modules/angular-slickgrid/services/groupingAndColspan.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class GroupingAndColspanService {
4444
// on all following events, call the
4545
this._eventHandler.subscribe(grid.onSort, () => this.renderPreHeaderRowGroupingTitles());
4646
this._eventHandler.subscribe(grid.onColumnsResized, () => this.renderPreHeaderRowGroupingTitles());
47+
this._eventHandler.subscribe(grid.onColumnsReordered, () => this.renderPreHeaderRowGroupingTitles());
4748
this._eventHandler.subscribe(dataView.onRowCountChanged, () => this.renderPreHeaderRowGroupingTitles());
4849
this.resizerService.onGridAfterResize.subscribe(() => this.renderPreHeaderRowGroupingTitles());
4950

0 commit comments

Comments
 (0)