@@ -3538,14 +3538,15 @@ describe('AnalyticalTable', () => {
35383538 } ) ;
35393539
35403540 it ( 'initial scroll-to' , ( ) => {
3541+ const disableStrictMode = reactVersion . startsWith ( '19' ) ;
35413542 const ScrollTo = ( ) => {
35423543 const tableRef = useRef < AnalyticalTableDomRef > ( null ) ;
35433544 useEffect ( ( ) => {
35443545 tableRef . current . scrollTo ( 520 ) ;
35453546 } , [ ] ) ;
35463547 return < AnalyticalTable data = { generateMoreData ( 200 ) } columns = { columns } ref = { tableRef } /> ;
35473548 } ;
3548- cy . mount ( < ScrollTo /> ) ;
3549+ cy . mount ( < ScrollTo /> , { strict : disableStrictMode } ) ;
35493550 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
35503551 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
35513552
@@ -3556,30 +3557,28 @@ describe('AnalyticalTable', () => {
35563557 } , [ ] ) ;
35573558 return < AnalyticalTable data = { generateMoreData ( 200 ) } columns = { columns } ref = { tableRef } /> ;
35583559 } ;
3559- cy . mount ( < ScrollToItem /> ) ;
3560+ cy . mount ( < ScrollToItem /> , { strict : disableStrictMode } ) ;
35603561 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
35613562 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
3563+
3564+ const cols = [
3565+ ...columns ,
3566+ ...new Array ( 50 ) . fill ( '' ) . map ( ( _ , index ) => ( {
3567+ id : `${ index } ` ,
3568+ Header : ( ) => index ,
3569+ } ) ) ,
3570+ ] ;
3571+ const ScrollToHorizontal = ( ) => {
3572+ const tableRef = useRef ( null ) ;
3573+ useEffect ( ( ) => {
3574+ tableRef . current . horizontalScrollTo ( 1020 ) ;
3575+ } , [ ] ) ;
3576+ return < AnalyticalTable data = { generateMoreData ( 50 ) } columns = { cols } ref = { tableRef } /> ;
3577+ } ;
3578+ cy . mount ( < ScrollToHorizontal /> , { strict : disableStrictMode } ) ;
3579+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
3580+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
35623581
3563- // todo: investigate how to test this behavior again with Cypress and React19, it works fine when tested manually
3564- if ( reactVersion . startsWith ( '18' ) ) {
3565- const cols = [
3566- ...columns ,
3567- ...new Array ( 50 ) . fill ( '' ) . map ( ( _ , index ) => ( {
3568- id : `${ index } ` ,
3569- Header : ( ) => index ,
3570- } ) ) ,
3571- ] ;
3572- const ScrollToHorizontal = ( ) => {
3573- const tableRef = useRef ( null ) ;
3574- useEffect ( ( ) => {
3575- tableRef . current . horizontalScrollTo ( 1020 ) ;
3576- } , [ ] ) ;
3577- return < AnalyticalTable data = { generateMoreData ( 50 ) } columns = { cols } ref = { tableRef } /> ;
3578- } ;
3579- cy . mount ( < ScrollToHorizontal /> ) ;
3580- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
3581- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
3582- }
35833582 const ScrollToItemHorizontal = ( ) => {
35843583 const tableRef = useRef ( null ) ;
35853584 useEffect ( ( ) => {
@@ -3593,7 +3592,7 @@ describe('AnalyticalTable', () => {
35933592 />
35943593 ) ;
35953594 } ;
3596- cy . mount ( < ScrollToItemHorizontal /> ) ;
3595+ cy . mount ( < ScrollToItemHorizontal /> , { strict : disableStrictMode } ) ;
35973596 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
35983597 cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
35993598 } ) ;
0 commit comments