Skip to content

Commit 46e2a31

Browse files
authored
Merge pull request #6929 from IgniteUI/nrobakova/refactor-summaries-tests
Tests Refactoring: IgxGrid - Summaries
2 parents ff0f4d7 + edc184d commit 46e2a31

File tree

3 files changed

+453
-568
lines changed

3 files changed

+453
-568
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy';
1313
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
1414
import { configureTestSuite } from '../../test-utils/configure-suite';
1515
import { IgxGridHeaderComponent } from '../headers/grid-header.component';
16+
import { GridSummaryFunctions } from '../../test-utils/grid-functions.spec';
1617

1718
const GRID_COL_THEAD_TITLE_CLASS = 'igx-grid__th-title';
1819
const GRID_COL_GROUP_THEAD_TITLE_CLASS = 'igx-grid__thead-title';
@@ -179,6 +180,8 @@ describe('IgxGrid - multi-column headers #grid', () => {
179180
expect(getColGroup(grid, 'General Information').hidden).toEqual(false);
180181
}));
181182

183+
184+
182185
it('Width should be correct. Column group with column. No width.', fakeAsync(/** height/width setter rAF */() => {
183186
const fixture = TestBed.createComponent(OneGroupOneColGridComponent);
184187
fixture.detectChanges();
@@ -1215,6 +1218,28 @@ describe('IgxGrid - multi-column headers #grid', () => {
12151218
expect(grid.getCellByColumn(4, 'Country').value).toEqual('Sweden');
12161219
}));
12171220

1221+
it('summaries - verify summaries when there are grouped columns', fakeAsync(() => {
1222+
const fixture = TestBed.createComponent(ColumnGroupFourLevelTestComponent);
1223+
fixture.detectChanges();
1224+
const grid = fixture.componentInstance.grid;
1225+
const allColumns = grid.columnList;
1226+
allColumns.forEach((col) => {
1227+
if (!col.columnGroup) {
1228+
col.hasSummary = true;
1229+
}
1230+
});
1231+
fixture.detectChanges();
1232+
1233+
const summaryRow = GridSummaryFunctions.getRootSummaryRow(fixture);
1234+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 0, ['Count'], ['27']);
1235+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 1, ['Count'], ['27']);
1236+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 2, ['Count'], ['27']);
1237+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 3, ['Count'], ['27']);
1238+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 4, ['Count'], ['27']);
1239+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 5, ['Count'], ['27']);
1240+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 6, ['Count'], ['27']);
1241+
}));
1242+
12181243
it('filtering - filter a grouped column', fakeAsync(() => {
12191244
const fixture = TestBed.createComponent(ColumnGroupFourLevelTestComponent);
12201245
fixture.detectChanges();
@@ -1275,6 +1300,7 @@ describe('IgxGrid - multi-column headers #grid', () => {
12751300
}));
12761301

12771302

1303+
12781304
it('grouping - verify grouping when there are grouped columns', fakeAsync(/** height/width setter rAF */() => {
12791305
const fixture = TestBed.createComponent(ColumnGroupGroupingTestComponent);
12801306
fixture.detectChanges();

0 commit comments

Comments
 (0)