Skip to content

Commit 3a92c24

Browse files
committed
Merge branch '8.2.x' into dmdimitrov/issue6257-8.2.x
2 parents 33bf65e + 97d7dcb commit 3a92c24

File tree

11 files changed

+64
-20
lines changed

11 files changed

+64
-20
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
181181
@Output()
182182
public onChunkLoad = new EventEmitter<IForOfState>();
183183

184+
/**
185+
* @hidden @internal
186+
* An event that is emitted when scrollbar visibility has changed.
187+
*/
188+
@Output()
189+
public onScrollbarVisibilityChanged = new EventEmitter<any>();
190+
184191
/**
185192
* An event that is emitted after the rendered content size of the igxForOf has been changed.
186193
*/
@@ -1155,10 +1162,11 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
11551162
protected _recalcScrollBarSize() {
11561163
const count = this.isRemote ? this.totalItemCount : (this.igxForOf ? this.igxForOf.length : 0);
11571164
this.dc.instance.notVirtual = !(this.igxForContainerSize && this.dc && this.state.chunkSize < count);
1165+
const scrollable = this.isScrollable();
11581166
if (this.igxForScrollOrientation === 'horizontal') {
11591167
const totalWidth = this.igxForContainerSize ? this.initSizesCache(this.igxForOf) : 0;
11601168
this.scrollComponent.nativeElement.style.width = this.igxForContainerSize + 'px';
1161-
this.scrollComponent.nativeElement.children[0].style.width = totalWidth + 'px';
1169+
this.scrollComponent.size = totalWidth;
11621170
if (totalWidth <= parseInt(this.igxForContainerSize, 10)) {
11631171
this.scrollPosition = 0;
11641172
}
@@ -1170,6 +1178,10 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
11701178
this.scrollPosition = 0;
11711179
}
11721180
}
1181+
if (scrollable !== this.isScrollable()) {
1182+
// scrollbar visibility has changed
1183+
this.onScrollbarVisibilityChanged.emit();
1184+
}
11731185
}
11741186

11751187
protected _calcHeight(): number {

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,9 +3017,19 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
30173017
});
30183018

30193019
this.verticalScrollContainer.onDataChanging.pipe(destructor, filter(() => !this._init)).subscribe(($event) => {
3020-
this.calculateGridHeight();
3021-
$event.containerSize = this.calcHeight;
3020+
const shouldRecalcSize = this.isPercentHeight &&
3021+
( !this.calcHeight || this.calcHeight === this.getDataBasedBodyHeight() ||
3022+
this.calcHeight === this.renderedRowHeight * this._defaultTargetRecordNumber);
3023+
if (shouldRecalcSize) {
3024+
this.calculateGridHeight();
3025+
$event.containerSize = this.calcHeight;
3026+
}
30223027
this.evaluateLoadingState();
3028+
});
3029+
3030+
this.verticalScrollContainer.onScrollbarVisibilityChanged.pipe(destructor, filter(() => !this._init)).subscribe(() => {
3031+
// called to recalc all widths that may have changes as a result of
3032+
// the vert. scrollbar showing/hiding
30233033
this.notifyChanges(true);
30243034
});
30253035

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,9 @@ describe('IgxGrid - Advanced Filtering', () => {
24292429
// and verify that the root group and all of its children become selected.
24302430
let rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
24312431
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2432+
fix.detectChanges();
2433+
await wait(200);
2434+
fix.detectChanges();
24322435
await wait(200);
24332436
fix.detectChanges();
24342437
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), true);
@@ -2438,6 +2441,9 @@ describe('IgxGrid - Advanced Filtering', () => {
24382441
// and verify that the root group and all of its children become unselected.
24392442
rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
24402443
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2444+
fix.detectChanges();
2445+
await wait(200);
2446+
fix.detectChanges();
24412447
await wait(200);
24422448
fix.detectChanges();
24432449
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), false);

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,23 +3319,30 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33193319
fix.detectChanges();
33203320

33213321
GridFunctions.applyFilter('a', fix);
3322-
await wait(16);
3322+
fix.detectChanges();
3323+
await wait(300);
3324+
fix.detectChanges();
33233325
GridFunctions.applyFilter('e', fix);
3324-
await wait(16);
3326+
fix.detectChanges();
3327+
await wait(300);
3328+
fix.detectChanges();
33253329
GridFunctions.applyFilter('i', fix);
3326-
await wait(16);
3330+
fix.detectChanges();
3331+
await wait(300);
3332+
fix.detectChanges();
33273333
GridFunctions.applyFilter('o', fix);
33283334
// wait for chip to be scrolled in view
3329-
await wait(200);
33303335
fix.detectChanges();
3331-
await wait(100);
3336+
await wait(300);
3337+
fix.detectChanges();
33323338
verifyMultipleChipsVisibility(fix, [false, false, false, true]);
33333339

33343340
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
33353341
GridFunctions.removeFilterChipByIndex(3, filterUIRow);
33363342
// wait for chip to be scrolled in view
33373343
fix.detectChanges();
3338-
await wait(200);
3344+
await wait(300);
3345+
fix.detectChanges();
33393346

33403347
verifyMultipleChipsVisibility(fix, [false, true, false]);
33413348
let chips = filterUIRow.queryAll(By.directive(IgxChipComponent));
@@ -3344,7 +3351,8 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33443351
GridFunctions.removeFilterChipByIndex(2, filterUIRow);
33453352
// wait for chip to be scrolled in view
33463353
fix.detectChanges();
3347-
await wait(200);
3354+
await wait(300);
3355+
fix.detectChanges();
33483356

33493357
verifyMultipleChipsVisibility(fix, [true, false]);
33503358
chips = filterUIRow.queryAll(By.directive(IgxChipComponent));

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,13 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
848848
fix.detectChanges();
849849

850850
grid.navigateTo(15, 1, (args) => { args.target.nativeElement.focus(); });
851-
await wait(DEBOUNCETIME);
851+
fix.detectChanges();
852+
await wait(200);
852853
fix.detectChanges();
853854

854855
const target = grid.getCellByColumn(15, '1');
855856
expect(target).toBeDefined();
856-
expect(target.focused).toBe(true);
857+
expect(document.activeElement).toBe(target.nativeElement);
857858
});
858859

859860
it('Custom KB navigation: should be able to scroll horizontally and vertically to a cell in the grid', async () => {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ describe('IgxGrid Component Tests #grid', () => {
11761176
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11771177
}));
11781178

1179-
it('should not keep default height when lower the amount of bound data', () => {
1179+
it('should not keep default height when lower the amount of bound data', async() => {
11801180
const fix = TestBed.createComponent(IgxGridWrappedInContComponent);
11811181
fix.detectChanges();
11821182

@@ -1195,6 +1195,8 @@ describe('IgxGrid Component Tests #grid', () => {
11951195

11961196
fix.componentInstance.grid.data = fix.componentInstance.semiData;
11971197
fix.detectChanges();
1198+
await wait(100);
1199+
fix.detectChanges();
11981200

11991201
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
12001202
expect(defaultHeight).toBeNull();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
144144
if (this.shouldGenerate) {
145145
this.setupColumns();
146146
}
147-
this.notifyChanges(true);
147+
this.cdr.markForCheck();
148148
}
149149

150150
/**

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
401401

402402
hierarchicalGrid.clearFilter();
403403
fixture.detectChanges();
404-
await wait(30);
404+
await wait(100);
405+
fixture.detectChanges();
405406

406407
expect(childGrid.calcWidth - 370 ).toBeLessThan(3);
407408
});
@@ -553,7 +554,7 @@ describe('IgxHierarchicalGrid Row Islands #hGrid', () => {
553554
}
554555
});
555556
it('should allow setting different height/width in px/percent for row islands and grids should be rendered correctly.',
556-
fakeAsync(/** height/width setter + row toggle rAF */() => {
557+
(/** height/width setter + row toggle rAF */async() => {
557558
const ri1 = fixture.componentInstance.rowIsland1;
558559

559560
// test px
@@ -565,6 +566,8 @@ describe('IgxHierarchicalGrid Row Islands #hGrid', () => {
565566
let row = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
566567
UIInteractions.clickElement(row.expander);
567568
fixture.detectChanges();
569+
await wait(100);
570+
fixture.detectChanges();
568571
let childGrids = fixture.debugElement.queryAll(By.css('igx-child-grid-row'));
569572
let childGrid = childGrids[0].query(By.css('igx-hierarchical-grid')).componentInstance;
570573

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ describe('IgxTreeGrid Component Tests #tGrid', () => {
7878
}));
7979

8080
it(`should render all records exactly if height is 100% and parent container\'s height is unset and
81-
there are fewer than 10 records in the data view`, fakeAsync(() => {
81+
there are fewer than 10 records in the data view`, (async() => {
8282
grid.height = '100%';
8383
fix.componentInstance.data = fix.componentInstance.data.slice(0, 1);
84-
tick(16);
84+
fix.detectChanges();
85+
await wait(100);
8586
fix.detectChanges();
8687
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
8788
expect(defaultHeight).toBeNull();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent implements IGridD
110110
if (this.shouldGenerate) {
111111
this.setupColumns();
112112
}
113-
this.notifyChanges(true);
113+
this.cdr.markForCheck();
114114
}
115115

116116
/**

0 commit comments

Comments
 (0)