File tree Expand file tree Collapse file tree
projects/igniteui-angular/src/lib/grids/grid Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1301,6 +1301,30 @@ describe('IgxGrid Component Tests #grid', () => {
13011301 expect ( parseInt ( window . getComputedStyle ( domGrid ) . height , 10 ) ) . toBe ( 300 ) ;
13021302 } ) ) ;
13031303
1304+ it ( 'should account for CSS border widths in body height calculation when height is percent #16640' , fakeAsync ( ( ) => {
1305+ const fix = TestBed . createComponent ( IgxGridWrappedInContComponent ) ;
1306+ fix . componentInstance . outerHeight = 600 ;
1307+ fix . componentInstance . data = fix . componentInstance . fullData ;
1308+ tick ( ) ;
1309+ fix . detectChanges ( ) ;
1310+
1311+ const grid = fix . componentInstance . grid ;
1312+ const calcHeightNoBorder = grid . calcHeight ;
1313+ expect ( calcHeightNoBorder ) . not . toBeNull ( ) ;
1314+
1315+ // Apply a 2px border (top and bottom) to the grid's native element
1316+ grid . nativeElement . style . borderTop = '2px solid black' ;
1317+ grid . nativeElement . style . borderBottom = '2px solid black' ;
1318+
1319+ // Trigger height recalculation
1320+ grid . reflow ( ) ;
1321+ fix . detectChanges ( ) ;
1322+
1323+ // The fix ensures border widths are included in the rendered height calculation,
1324+ // reducing the available body height accordingly and preventing continuous reflow growth
1325+ expect ( grid . calcHeight ) . toBe ( calcHeightNoBorder - 4 ) ;
1326+ } ) ) ;
1327+
13041328 it ( 'should keep auto-sizing if initial data is empty then set to a new array' , fakeAsync ( ( ) => {
13051329 const fix = TestBed . createComponent ( IgxGridWrappedInContComponent ) ;
13061330 tick ( ) ;
You can’t perform that action at this time.
0 commit comments