Skip to content

Commit 02aa37c

Browse files
MKirovaMayaKirova
authored andcommitted
chore(*): Add test for container with display:contents.
1 parent d1266c2 commit 02aa37c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,20 @@ describe('IgxGrid Component Tests #grid', () => {
14461446
fix.componentInstance.data = fix.componentInstance.fullData;
14471447
}));
14481448

1449+
it('should not auto-size when container has display:contents and size is determinable ', fakeAsync(() => {
1450+
const fix = TestBed.createComponent(IgxGridWrappedInContComponent);
1451+
fix.componentInstance.display = "contents";
1452+
fix.componentInstance.data = fix.componentInstance.fullData;
1453+
tick();
1454+
fix.detectChanges();
1455+
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1456+
const defaultHeightNum = parseInt(defaultHeight, 10);
1457+
expect(defaultHeight).not.toBeFalsy();
1458+
1459+
expect(defaultHeightNum).toBeGreaterThan(fix.componentInstance.grid.renderedRowHeight * 10);
1460+
expect(fix.componentInstance.grid.calcHeight).toBeGreaterThan(fix.componentInstance.grid.renderedRowHeight * 10);
1461+
}));
1462+
14491463
it('should render correct columns if after scrolling right container size changes so that all columns become visible.',
14501464
async () => {
14511465
const fix = TestBed.createComponent(IgxGridDefaultRenderingComponent);
@@ -3015,7 +3029,7 @@ export class IgxGridWithCustomFooterComponent extends IgxGridTestComponent {
30153029
public override data = SampleTestData.foodProductData();
30163030
}
30173031
@Component({
3018-
template: `<div [style.width.px]="outerWidth" [style.height.px]="outerHeight">
3032+
template: `<div [style.display]="display" [style.width.px]="outerWidth" [style.height.px]="outerHeight">
30193033
<igx-grid #grid [data]="data" [autoGenerate]="true">
30203034
<igx-paginator *ngIf="paging" [perPage]="pageSize"></igx-paginator>
30213035
</igx-grid>
@@ -3065,6 +3079,7 @@ export class IgxGridWrappedInContComponent extends IgxGridTestComponent {
30653079
public pageSize = 5;
30663080
public outerWidth = 800;
30673081
public outerHeight: number;
3082+
public display: string = "";
30683083
}
30693084

30703085
@Component({

0 commit comments

Comments
 (0)