@@ -54,12 +54,11 @@ describe('scroll to column', () => {
5454 return false ;
5555 }
5656
57- const scrollLeft = grid . $ . table . scrollLeft ;
58- const clientWidth = grid . $ . table . clientWidth ;
59-
60- return (
61- headerCell . offsetLeft + headerCell . offsetWidth >= scrollLeft && headerCell . offsetLeft <= scrollLeft + clientWidth
62- ) ;
57+ const bounds = headerCell . getBoundingClientRect ( ) ;
58+ const centerX = bounds . left + bounds . width / 2 ;
59+ const centerY = bounds . top + bounds . height / 2 ;
60+ const cellContent = document . elementFromPoint ( centerX , centerY ) ;
61+ return headerCell . querySelector ( 'slot' ) . assignedElements ( ) . includes ( cellContent ) ;
6362 }
6463
6564 describe ( 'by index' , ( ) => {
@@ -216,14 +215,16 @@ describe('scroll to column', () => {
216215 } ) ;
217216
218217 it ( 'should not scroll for frozen column (always visible)' , ( ) => {
218+ grid . scrollToColumn ( 9 ) ;
219+ expect ( isColumnInViewport ( columns [ 9 ] ) ) . to . be . true ;
220+
219221 const initialScrollLeft = grid . $ . table . scrollLeft ;
220222 grid . scrollToColumn ( columns [ 0 ] ) ;
221223 expect ( grid . $ . table . scrollLeft ) . to . equal ( initialScrollLeft ) ;
222224 } ) ;
223225
224- it ( 'should scroll non-frozen column into view' , async ( ) => {
226+ it ( 'should scroll non-frozen column into view' , ( ) => {
225227 grid . scrollToColumn ( 9 ) ;
226- await nextFrame ( ) ;
227228 expect ( isColumnInViewport ( columns [ 9 ] ) ) . to . be . true ;
228229
229230 // Scroll back to first non-frozen
0 commit comments