Skip to content

Commit

Permalink
fix(Exporter): #3332 Improve the fix and test
Browse files Browse the repository at this point in the history
  • Loading branch information
astaev committed Jan 3, 2019
1 parent be821cc commit f4f11f6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,32 @@ describe('Excel Exporter', () => {
error = ex.message;
}
expect(error).toMatch('Can create an outline of up to eight levels!');

treeGrid.deleteRowById(9);
fix.detectChanges();
await wait(16);

error = '';
try {
exporter.export(treeGrid, options);
await wait();
} catch (ex) {
error = ex.message;
}
expect(error).toEqual('');

treeGrid.addRow({ ID: 9, ParentID: 8, Name: 'Test', JobTitle: '', Age: 49 });
fix.detectChanges();
await wait(16);

error = '';
try {
exporter.export(treeGrid, options);
await wait();
} catch (ex) {
error = ex.message;
}
expect(error).toMatch('Can create an outline of up to eight levels!');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export abstract class IgxBaseExporter {
}

private prepareData(grid: any, options: IgxExporterOptionsBase): any[] {
this.flatRecords = [];
let rootRecords = grid.rootRecords;
this._isTreeGrid = rootRecords !== undefined;

Expand All @@ -210,7 +211,6 @@ export abstract class IgxBaseExporter {
};

if (this._isTreeGrid) {
this.flatRecords = [];
rootRecords = DataUtil.treeGridFilter(rootRecords, filteringState);
this.prepareHierarchicalData(rootRecords);
data = this.flatRecords;
Expand All @@ -225,7 +225,6 @@ export abstract class IgxBaseExporter {
this._sort = cloneValue(grid.sortingExpressions[0]);

if (this._isTreeGrid) {
this.flatRecords = [];
rootRecords = DataUtil.treeGridSort(rootRecords, grid.sortingExpressions);
this.prepareHierarchicalData(rootRecords);
data = this.flatRecords;
Expand Down

0 comments on commit f4f11f6

Please sign in to comment.