Skip to content

Commit a0756d9

Browse files
committed
test(CSV): Verify column headers are printed
1 parent 3adfe66 commit a0756d9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

projects/igniteui-angular/src/lib/services/csv/csv-exporter-grid.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { wait } from '../../test-utils/ui-interactions.spec';
2424
import { IgxPivotGridComponent } from '../../grids/pivot-grid/pivot-grid.component';
2525
import { IgxPivotGridTestBaseComponent } from '../../test-utils/pivot-grid-samples.spec';
2626
import { IgxPivotNumericAggregate } from '../../grids/pivot-grid/pivot-grid-aggregate';
27+
import { OneGroupThreeColsGridComponent } from '../../test-utils/grid-mch-sample.spec';
2728

2829
describe('CSV Grid Exporter', () => {
2930
let exporter: IgxCsvExporterService;
@@ -391,6 +392,20 @@ describe('CSV Grid Exporter', () => {
391392
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
392393
});
393394

395+
it('should print column headers when available when column groups are present.', async () => {
396+
const fix = TestBed.createComponent(OneGroupThreeColsGridComponent);
397+
fix.componentInstance.data = [];
398+
fix.detectChanges();
399+
400+
fix.componentInstance.grid.getColumnByName('City').header = 'Test Header';
401+
fix.detectChanges();
402+
403+
const grid = fix.componentInstance.grid;
404+
405+
const wrapper = await getExportedData(grid, options);
406+
wrapper.verifyData('Country,Region,Test Header', 'Only headers should be exported.');
407+
});
408+
394409
describe('Tree Grid CSV export', () => {
395410
let fix;
396411
let treeGrid: IgxTreeGridComponent;

0 commit comments

Comments
 (0)