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