Skip to content

Commit eaa063f

Browse files
Merge branch '8.2.x' into ddimitrov/fix-5582-8.2.x
2 parents 1cf9da3 + 7212a9f commit eaa063f

21 files changed

+61
-61
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { take } from 'rxjs/operators';
2424
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
2525

2626
import { configureTestSuite } from '../../test-utils/configure-suite';
27-
import { resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
2827

2928
describe('IgxForOf directive -', () => {
3029
const INACTIVE_VIRT_CONTAINER = 'igx-display-container--inactive';
@@ -294,7 +293,6 @@ describe('IgxForOf directive -', () => {
294293
});
295294

296295
it('should always fill available space for last chunk size calculation - vertical virtualization', async () => {
297-
resizeObserverIgnoreError();
298296
fix.componentInstance.height = '1900px';
299297
const virtualContainer = fix.componentInstance.parentVirtDir;
300298
virtualContainer.igxForSizePropName = 'height';

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { SampleTestData } from '../../test-utils/sample-test-data.spec';
1313
import { IColumnResized } from '../../test-utils/grid-interfaces.spec';
1414
import { MultiColumnHeadersComponent } from '../../test-utils/grid-samples.spec';
1515
import { configureTestSuite } from '../../test-utils/configure-suite';
16-
import { resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
1716

1817
describe('IgxGrid - Deferred Column Resizing #grid', () => {
1918
configureTestSuite();
@@ -192,8 +191,6 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
192191
const fixture = TestBed.createComponent(ResizableColumnsComponent);
193192
fixture.detectChanges();
194193

195-
resizeObserverIgnoreError();
196-
197194
const grid = fixture.componentInstance.grid;
198195
const column = grid.getColumnByName('ID');
199196
const headers: DebugElement[] = fixture.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SelectionWithScrollsComponent,
1010
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
1111
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
1212
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
13-
import { setupGridScrollDetection, resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
13+
import { setupGridScrollDetection } from '../../test-utils/helper-utils.spec';
1414
import { DefaultSortingStrategy } from 'igniteui-angular';
1515
import { GridSelectionMode } from '../common/enums';
1616

@@ -1616,7 +1616,6 @@ describe('IgxGrid - Cell selection #grid', () => {
16161616
let detect;
16171617

16181618
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1619-
resizeObserverIgnoreError();
16201619
fix = TestBed.createComponent(SelectionWithScrollsComponent);
16211620
fix.detectChanges();
16221621
grid = fix.componentInstance.grid;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { FilteringLogic } from '../../data-operations/filtering-expression.inter
1515
import {
1616
IgxGridAdvancedFilteringComponent
1717
} from '../../test-utils/grid-samples.spec';
18-
import { resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
1918

2019
const ADVANCED_FILTERING_OPERATOR_LINE_AND_CSS_CLASS = 'igx-filter-tree__line--and';
2120
const ADVANCED_FILTERING_OPERATOR_LINE_OR_CSS_CLASS = 'igx-filter-tree__line--or';
@@ -42,7 +41,6 @@ describe('IgxGrid - Advanced Filtering', () => {
4241
describe('', () => {
4342
let fix, grid: IgxGridComponent;
4443
beforeEach(fakeAsync(() => {
45-
resizeObserverIgnoreError();
4644
fix = TestBed.createComponent(IgxGridAdvancedFilteringComponent);
4745
grid = fix.componentInstance.grid;
4846
fix.detectChanges();

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import {
4343
IgxGridFilteringESFLoadOnDemandComponent,
4444
CustomFilteringStrategyComponent
4545
} from '../../test-utils/grid-samples.spec';
46-
import { HelperUtils, resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
46+
import { HelperUtils } from '../../test-utils/helper-utils.spec';
4747
import { GridSelectionMode, FilterMode } from '../common/enums';
4848

4949
const FILTER_UI_ROW = 'igx-grid-filtering-row';
@@ -68,7 +68,6 @@ describe('IgxGrid - Filtering actions #grid', () => {
6868

6969
let fix, grid;
7070
beforeEach(fakeAsync(() => {
71-
resizeObserverIgnoreError();
7271

7372
fix = TestBed.createComponent(IgxGridFilteringComponent);
7473
fix.detectChanges();
@@ -1693,7 +1692,6 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
16931692
describe(null, () => {
16941693
let fix, grid;
16951694
beforeEach(fakeAsync(() => {
1696-
resizeObserverIgnoreError();
16971695
fix = TestBed.createComponent(IgxGridFilteringComponent);
16981696
fix.detectChanges();
16991697
grid = fix.componentInstance.grid;
@@ -3415,7 +3413,6 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
34153413
describe(null, () => {
34163414
let fix, grid;
34173415
beforeEach(fakeAsync(() => {
3418-
resizeObserverIgnoreError();
34193416
fix = TestBed.createComponent(IgxGridFilteringMCHComponent);
34203417
fix.detectChanges();
34213418
grid = fix.componentInstance.grid;
@@ -3531,7 +3528,6 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
35313528
describe(null, () => {
35323529
let fix, grid;
35333530
beforeEach(fakeAsync(() => {
3534-
resizeObserverIgnoreError();
35353531
fix = TestBed.createComponent(IgxGridFilteringScrollComponent);
35363532
grid = fix.componentInstance.grid;
35373533
fix.detectChanges();
@@ -3564,7 +3560,6 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
35643560
describe(null, () => {
35653561
let fix, grid;
35663562
beforeEach(fakeAsync(() => {
3567-
resizeObserverIgnoreError();
35683563
fix = TestBed.createComponent(IgxGridFilteringTemplateComponent);
35693564
fix.detectChanges();
35703565
grid = fix.componentInstance.grid;
@@ -3621,7 +3616,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36213616
describe(null, () => {
36223617
let fix, grid;
36233618
beforeEach(fakeAsync(() => {
3624-
resizeObserverIgnoreError();
36253619
fix = TestBed.createComponent(IgxGridFilteringComponent);
36263620
grid = fix.componentInstance.grid;
36273621
grid.filterMode = FilterMode.excelStyleFilter;
@@ -5688,7 +5682,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
56885682
describe(null, () => {
56895683
let fix, grid;
56905684
beforeEach(fakeAsync(() => {
5691-
resizeObserverIgnoreError();
5685+
56925686
fix = TestBed.createComponent(IgxGridFilteringESFTemplatesComponent);
56935687
fix.detectChanges();
56945688
grid = fix.componentInstance.grid;
@@ -5731,7 +5725,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
57315725
describe(null, () => {
57325726
let fix, grid;
57335727
beforeEach(fakeAsync(() => {
5734-
resizeObserverIgnoreError();
57355728
fix = TestBed.createComponent(IgxTestExcelFilteringDatePickerComponent);
57365729
fix.detectChanges();
57375730
grid = fix.componentInstance.grid;
@@ -5851,7 +5844,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58515844
let grid;
58525845

58535846
beforeEach(async(() => {
5854-
resizeObserverIgnoreError();
58555847
fix = TestBed.createComponent(CustomFilteringStrategyComponent);
58565848
grid = fix.componentInstance.grid;
58575849
fix.detectChanges();

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ describe('IgxGrid - Summaries #grid', () => {
209209
}));
210210

211211
it('should render correct data after hiding one bigger and then one smaller summary when scrolled to the bottom', (async () => {
212-
resizeObserverIgnoreError();
213212
const fixture = TestBed.createComponent(VirtualSummaryColumnComponent);
214213
fixture.detectChanges();
215214
await wait(100);
@@ -292,7 +291,6 @@ describe('IgxGrid - Summaries #grid', () => {
292291
let fix;
293292
let grid: IgxGridComponent;
294293
beforeEach(fakeAsync(/** height/width setter rAF */() => {
295-
resizeObserverIgnoreError();
296294
fix = TestBed.createComponent(SummaryColumnComponent);
297295
fix.detectChanges();
298296
grid = fix.componentInstance.grid;
@@ -1163,7 +1161,6 @@ describe('IgxGrid - Summaries #grid', () => {
11631161
let fix;
11641162
let grid;
11651163
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1166-
resizeObserverIgnoreError();
11671164
fix = TestBed.createComponent(SummariesGroupByTransactionsComponent);
11681165
fix.detectChanges();
11691166
grid = fix.componentInstance.grid;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,6 @@ describe('IgxGrid Component Tests #grid', () => {
10161016

10171017
it(`should render 10 records if height is 100% and parent container's height is unset and
10181018
display density is changed`, async () => {
1019-
resizeObserverIgnoreError();
10201019
const fix = TestBed.createComponent(IgxGridWrappedInContComponent);
10211020
fix.detectChanges();
10221021

@@ -1593,8 +1592,6 @@ describe('IgxGrid Component Tests #grid', () => {
15931592
});
15941593

15951594
it('IgxTabs: should initialize a grid with correct width/height', async () => {
1596-
resizeObserverIgnoreError();
1597-
15981595
const grid = fix.componentInstance.grid3;
15991596
const tab = fix.componentInstance.tabs;
16001597
expect(grid.calcHeight).toBe(510);

projects/igniteui-angular/src/lib/grids/grid/grid.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,9 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
592592
* @memberof IgxGridComponent
593593
*/
594594
public groupBy(expression: IGroupingExpression | Array<IGroupingExpression>): void {
595+
if (this.checkIfNoColumnField(expression)) {
596+
return;
597+
}
595598
this.endEdit(true);
596599
if (expression instanceof Array) {
597600
this._gridAPI.groupBy_multiple(expression);
@@ -992,4 +995,17 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
992995
this.navigation.grid = this;
993996
}
994997
}
998+
999+
private checkIfNoColumnField(expression: IGroupingExpression | Array<IGroupingExpression> | any): boolean {
1000+
if (expression instanceof Array) {
1001+
for (const singleExpression of expression) {
1002+
if (!singleExpression.fieldName) {
1003+
return true;
1004+
}
1005+
}
1006+
return false;
1007+
}
1008+
return !expression.fieldName;
1009+
}
1010+
9951011
}

projects/igniteui-angular/src/lib/grids/grid/grid.directives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class IgxGroupAreaDropDirective extends IgxDropDirective {
7878
}
7979
const grid = <IgxGridComponent>column.grid;
8080
const isGrouped = grid.groupingExpressions.findIndex((item) => item.fieldName === column.field) !== -1;
81-
if (column.groupable && !isGrouped && !column.columnGroup) {
81+
if (column.groupable && !isGrouped && !column.columnGroup && !!column.field) {
8282
drag.icon.innerText = 'group_work';
8383
this.hovered = true;
8484
} else {
@@ -106,7 +106,7 @@ export class IgxGroupAreaDropDirective extends IgxDropDirective {
106106
}
107107
const grid = <IgxGridComponent>column.grid;
108108
const isGrouped = grid.groupingExpressions.findIndex((item) => item.fieldName === column.field) !== -1;
109-
if (column.groupable && !isGrouped && !column.columnGroup) {
109+
if (column.groupable && !isGrouped && !column.columnGroup && !!column.field) {
110110
grid.groupBy({ fieldName: column.field, dir: SortingDirection.Asc, ignoreCase: column.sortingIgnoreCase,
111111
strategy: column.sortStrategy, groupingComparer: column.groupingComparer });
112112
}

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

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('IgxGrid - GroupBy #grid', () => {
4040
GroupableGridComponent,
4141
CustomTemplateGridComponent,
4242
GroupByDataMoreColumnsComponent,
43+
GroupByEmptyColumnFieldComponent,
4344
MultiColumnHeadersWithGroupingComponent
4445
],
4546
imports: [NoopAnimationsModule, IgxGridModule]
@@ -715,7 +716,6 @@ describe('IgxGrid - GroupBy #grid', () => {
715716
}));
716717

717718
it('should allow grouping of already sorted column', async(() => {
718-
resizeObserverIgnoreError();
719719
const fix = TestBed.createComponent(DefaultGridComponent);
720720
const grid = fix.componentInstance.instance;
721721
fix.componentInstance.enableSorting = true;
@@ -1407,7 +1407,6 @@ describe('IgxGrid - GroupBy #grid', () => {
14071407
}));
14081408

14091409
it('should update horizontal virtualization state correcly when data row views are re-used from cache.', async () => {
1410-
resizeObserverIgnoreError();
14111410
const fix = TestBed.createComponent(GroupableGridComponent);
14121411
const grid = fix.componentInstance.instance;
14131412
fix.detectChanges();
@@ -1834,7 +1833,6 @@ describe('IgxGrid - GroupBy #grid', () => {
18341833
}));
18351834

18361835
it('should reorder groups when reordering chip', async () => {
1837-
resizeObserverIgnoreError();
18381836
const fix = TestBed.createComponent(DefaultGridComponent);
18391837
const grid = fix.componentInstance.instance;
18401838
fix.detectChanges();
@@ -2026,6 +2024,19 @@ describe('IgxGrid - GroupBy #grid', () => {
20262024
expect(m).toBe('Maximum amount of grouped columns is 10.');
20272025
}));
20282026

2027+
it('should not allow grouping by column with no name', fakeAsync(() => {
2028+
const fix = TestBed.createComponent(GroupByEmptyColumnFieldComponent);
2029+
const grid = fix.componentInstance.instance;
2030+
fix.detectChanges();
2031+
tick();
2032+
const expr = grid.columns.map(val => {
2033+
return { fieldName: val.field, dir: SortingDirection.Asc, ignoreCase: true };
2034+
});
2035+
grid.groupBy(expr);
2036+
tick();
2037+
expect(grid.groupsRowList.toArray().length).toBe(0);
2038+
}));
2039+
20292040
it('should display column header text in the grouping chip.', fakeAsync(() => {
20302041
const fix = TestBed.createComponent(DefaultGridComponent);
20312042
const grid = fix.componentInstance.instance;
@@ -2741,5 +2752,25 @@ export class GroupByDataMoreColumnsComponent extends DataParent {
27412752
public instance: IgxGridComponent;
27422753
}
27432754

2755+
@Component({
2756+
template: `
2757+
<igx-grid
2758+
[width]='width'
2759+
[autoGenerate]='false'
2760+
[data]='data'>
2761+
<igx-column [width]='width' [groupable]='true'>
2762+
<ng-template igxCell>
2763+
<button>Dummy button</button>
2764+
</ng-template>
2765+
</igx-column>
2766+
</igx-grid>
2767+
`
2768+
})
2769+
export class GroupByEmptyColumnFieldComponent extends DataParent {
2770+
public width = '200px';
2771+
@ViewChild(IgxGridComponent, { read: IgxGridComponent, static: true })
2772+
public instance: IgxGridComponent;
2773+
}
2774+
27442775
export class CustomSortingStrategy extends DefaultSortingStrategy {
27452776
}

0 commit comments

Comments
 (0)