Skip to content

Commit 03e9ea9

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Add automation for all min-width constraints.
1 parent 07dcd32 commit 03e9ea9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,36 @@ describe('IgxGrid Component Tests #grid', () => {
21802180
// first column takes new min
21812181
expect(col1.calcPixelWidth).toBe(500);
21822182
});
2183+
2184+
it('in columns with no width and min-widths should recalculate and re-apply constraints to all cols.', () => {
2185+
const fix = TestBed.createComponent(IgxGridDefaultRenderingComponent);
2186+
// 3 cols
2187+
fix.componentInstance.initColumnsRows(5, 3);
2188+
fix.detectChanges();
2189+
2190+
const grid = fix.componentInstance.grid;
2191+
grid.columns[0].minWidth = "80px";
2192+
grid.columns[1].minWidth = "90px";
2193+
grid.columns[2].minWidth = "130px";
2194+
2195+
grid.width = "300px";
2196+
fix.detectChanges();
2197+
2198+
expect(grid.columns[0].calcWidth).toBe(80);
2199+
expect(grid.columns[1].calcWidth).toBe(90);
2200+
expect(grid.columns[2].calcWidth).toBe(130);
2201+
2202+
expect(grid.hasHorizontalScroll()).toBe(false);
2203+
2204+
grid.width = "290px";
2205+
fix.detectChanges();
2206+
2207+
expect(grid.columns[0].calcWidth).toBe(80);
2208+
expect(grid.columns[1].calcWidth).toBe(90);
2209+
expect(grid.columns[2].calcWidth).toBe(130);
2210+
2211+
expect(grid.hasHorizontalScroll()).toBe(true);
2212+
});
21832213
});
21842214

21852215

0 commit comments

Comments
 (0)