Skip to content

Commit f725049

Browse files
committed
test(IgxGrid): copied data should be correct when there is paging enabled #7801
1 parent 460332f commit f725049

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-clipboard.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ describe('IgxGrid - Clipboard #grid', () => {
9090
expect(eventData).toEqual('Downloads\tReleased\r\n127\ttrue\r\n20\t\r\n');
9191
});
9292

93+
it('Copy data when paging is enabled', () => {
94+
grid.paging = true;
95+
grid.perPage = 5;
96+
fix.detectChanges();
97+
grid.page = 1;
98+
fix.detectChanges();
99+
const copySpy = spyOn<any>(grid.onGridCopy, 'emit').and.callThrough();
100+
grid.clipboardOptions.copyHeaders = false;
101+
grid.selectRange({ rowStart: 1, rowEnd: 2, columnStart: 2, columnEnd: 3 });
102+
fix.detectChanges();
103+
104+
const eventData = dispatchCopyEventOnGridBody(fix);
105+
expect(copySpy).toHaveBeenCalledTimes(1);
106+
expect(eventData).toEqual('0\ttrue\r\n1000\t\r\n');
107+
});
108+
93109
it('Disable clipboardOptions', () => {
94110
const copySpy = spyOn<any>(grid.onGridCopy, 'emit').and.callThrough();
95111
grid.clipboardOptions.enabled = false;

0 commit comments

Comments
 (0)