File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
projects/igniteui-angular/src/lib/grids/grid Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments