Skip to content

Commit c649f05

Browse files
authored
Merge branch 'master' into mkirova/row-pinning-filtering
2 parents 1a84fae + cc90be5 commit c649f05

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
31003100
public set expansionStates(value) {
31013101
this._expansionStates = new Map<any, boolean>(value);
31023102
this.expansionStatesChange.emit(this._expansionStates);
3103+
this.notifyChanges(true);
31033104
if (this.gridAPI.grid) {
31043105
this.cdr.detectChanges();
31053106
}

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

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { configureTestSuite } from '../../test-utils/configure-suite';
88
import { ColumnPinningPosition, RowPinningPosition } from '../common/enums';
99
import { IPinningConfig } from '../common/grid.interface';
1010
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
11+
import { GridFunctions } from '../../test-utils/grid-functions.spec';
1112
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
1213
import { IgxGridTransaction } from '../tree-grid';
1314
import { IgxTransactionService } from '../../services';
@@ -24,6 +25,7 @@ describe('Row Pinning #grid', () => {
2425
TestBed.configureTestingModule({
2526
declarations: [
2627
GridRowPinningComponent,
28+
GridRowPinningWithMDVComponent,
2729
GridRowPinningWithTransactionsComponent
2830
],
2931
imports: [
@@ -339,6 +341,40 @@ describe('Row Pinning #grid', () => {
339341
expect(grid.getRowByIndex(2).rowID).toBe(fix.componentInstance.data[lastIndex]);
340342
});
341343
});
344+
describe('Row pinning with Master Detail View', () => {
345+
beforeEach(fakeAsync(() => {
346+
fix = TestBed.createComponent(GridRowPinningWithMDVComponent);
347+
fix.detectChanges();
348+
grid = fix.componentInstance.instance;
349+
tick();
350+
fix.detectChanges();
351+
}));
352+
353+
it('should be in view when expanded and pinning row to bottom of the grid.', () => {
354+
fix.componentInstance.pinningConfig = { columns: ColumnPinningPosition.Start, rows: RowPinningPosition.Bottom };
355+
fix.detectChanges();
356+
// pin 1st row
357+
const row = grid.getRowByIndex(0);
358+
row.pinned = true;
359+
fix.detectChanges();
360+
361+
GridFunctions.toggleMasterRow(fix, grid.pinnedRows[0]);
362+
fix.detectChanges();
363+
364+
365+
expect(grid.pinnedRows.length).toBe(1);
366+
367+
const firstRowIconName = GridFunctions.getRowExpandIconName(grid.pinnedRows[0]);
368+
const firstRowDetail = GridFunctions.getMasterRowDetail(grid.pinnedRows[0]);
369+
expect(grid.expansionStates.size).toEqual(1);
370+
expect(grid.expansionStates.has(grid.pinnedRows[0].rowID)).toBeTruthy();
371+
expect(grid.expansionStates.get(grid.pinnedRows[0].rowID)).toBeTruthy();
372+
expect(firstRowIconName).toEqual('expand_more');
373+
374+
// check last pinned and expanded is fully in view
375+
expect(firstRowDetail.getBoundingClientRect().bottom - grid.tbody.nativeElement.getBoundingClientRect().bottom).toBe(0);
376+
});
377+
});
342378

343379
describe(' Editing ', () => {
344380
beforeEach(fakeAsync(() => {
@@ -440,6 +476,25 @@ export class GridRowPinningComponent {
440476
public instance: IgxGridComponent;
441477
}
442478

479+
@Component({
480+
template: `
481+
<igx-grid
482+
[pinning]='pinningConfig'
483+
[width]='"800px"'
484+
[height]='"500px"'
485+
[data]="data"
486+
[autoGenerate]="true">
487+
<ng-template igxGridDetail let-dataItem>
488+
<div>
489+
<div><span class='categoryStyle'>Country:</span> {{dataItem.Country}}</div>
490+
<div><span class='categoryStyle'>City:</span> {{dataItem.City}}</div>
491+
<div><span class='categoryStyle'>Address:</span> {{dataItem.Address}}</div>
492+
</div>
493+
</ng-template>
494+
</igx-grid>`
495+
})
496+
export class GridRowPinningWithMDVComponent extends GridRowPinningComponent {}
497+
443498

444499
@Component({
445500
template: `
@@ -454,6 +509,4 @@ export class GridRowPinningComponent {
454509
`,
455510
providers: [{ provide: IgxGridTransaction, useClass: IgxTransactionService }]
456511
})
457-
export class GridRowPinningWithTransactionsComponent extends GridRowPinningComponent {
458-
public data = SampleTestData.contactInfoDataFull();
459-
}
512+
export class GridRowPinningWithTransactionsComponent extends GridRowPinningComponent {}

0 commit comments

Comments
 (0)