@@ -3537,66 +3537,6 @@ describe('AnalyticalTable', () => {
35373537 cy . get ( '[data-component-name="AnalyticalTableBody"]' ) . should ( 'have.css' , 'height' , '800px' ) ;
35383538 } ) ;
35393539
3540- it ( 'initial scroll-to' , ( ) => {
3541- const ScrollTo = ( ) => {
3542- const tableRef = useRef < AnalyticalTableDomRef > ( null ) ;
3543- useEffect ( ( ) => {
3544- tableRef . current . scrollTo ( 520 ) ;
3545- } , [ ] ) ;
3546- return < AnalyticalTable data = { generateMoreData ( 300 ) } columns = { columns } ref = { tableRef } /> ;
3547- } ;
3548- cy . mount ( < ScrollTo /> ) ;
3549- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
3550- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
3551-
3552- const ScrollToItem = ( ) => {
3553- const tableRef = useRef ( null ) ;
3554- useEffect ( ( ) => {
3555- tableRef . current . scrollToItem ( 12 , { align : 'start' } ) ;
3556- } , [ ] ) ;
3557- return < AnalyticalTable data = { generateMoreData ( 300 ) } columns = { columns } ref = { tableRef } /> ;
3558- } ;
3559- cy . mount ( < ScrollToItem /> ) ;
3560- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
3561- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
3562-
3563- const ScrollToHorizontal = ( ) => {
3564- const tableRef = useRef ( null ) ;
3565- useEffect ( ( ) => {
3566- tableRef . current . horizontalScrollTo ( 1020 ) ;
3567- } , [ ] ) ;
3568- return (
3569- < AnalyticalTable
3570- data = { generateMoreData ( 300 ) }
3571- columns = { [
3572- ...columns ,
3573- ...new Array ( 100 ) . fill ( '' ) . map ( ( _ , index ) => ( { id : `${ index } ` , Header : ( ) => index } ) ) ,
3574- ] }
3575- ref = { tableRef }
3576- />
3577- ) ;
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- const ScrollToItemHorizontal = ( ) => {
3583- const tableRef = useRef ( null ) ;
3584- useEffect ( ( ) => {
3585- tableRef . current . horizontalScrollToItem ( 13 , { align : 'start' } ) ;
3586- } , [ ] ) ;
3587- return (
3588- < AnalyticalTable
3589- data = { generateMoreData ( 300 ) }
3590- columns = { new Array ( 100 ) . fill ( '' ) . map ( ( _ , index ) => ( { id : `${ index } ` , Header : ( ) => index } ) ) }
3591- ref = { tableRef }
3592- />
3593- ) ;
3594- } ;
3595- cy . mount ( < ScrollToItemHorizontal /> ) ;
3596- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
3597- cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
3598- } ) ;
3599-
36003540 it ( 'additionalEmptyRowsCount' , ( ) => {
36013541 cy . mount ( < AnalyticalTable data = { data } columns = { columns } minRows = { 4 } /> ) ;
36023542 cy . get ( '[data-empty-row]' ) . should ( 'not.exist' ) ;
@@ -4302,6 +4242,63 @@ describe('AnalyticalTable', () => {
43024242 cy . focused ( ) . should ( 'have.text' , 'Before' ) ;
43034243 } ) ;
43044244
4245+ it ( 'initial scroll-to' , ( ) => {
4246+ const ScrollTo = ( ) => {
4247+ const tableRef = useRef < AnalyticalTableDomRef > ( null ) ;
4248+ useEffect ( ( ) => {
4249+ tableRef . current . scrollTo ( 520 ) ;
4250+ } , [ ] ) ;
4251+ return < AnalyticalTable data = { generateMoreData ( 200 ) } columns = { columns } ref = { tableRef } /> ;
4252+ } ;
4253+ cy . mount ( < ScrollTo /> ) ;
4254+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
4255+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
4256+
4257+ const ScrollToItem = ( ) => {
4258+ const tableRef = useRef ( null ) ;
4259+ useEffect ( ( ) => {
4260+ tableRef . current . scrollToItem ( 12 , { align : 'start' } ) ;
4261+ } , [ ] ) ;
4262+ return < AnalyticalTable data = { generateMoreData ( 200 ) } columns = { columns } ref = { tableRef } /> ;
4263+ } ;
4264+ cy . mount ( < ScrollToItem /> ) ;
4265+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-12' ) . should ( 'be.visible' ) ;
4266+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( 'Name-11' ) . should ( 'not.be.visible' ) ;
4267+
4268+ const ScrollToHorizontal = ( ) => {
4269+ const tableRef = useRef ( null ) ;
4270+ useEffect ( ( ) => {
4271+ tableRef . current . horizontalScrollTo ( 1020 ) ;
4272+ } , [ ] ) ;
4273+ return (
4274+ < AnalyticalTable
4275+ data = { generateMoreData ( 200 ) }
4276+ columns = { [ ...columns , ...new Array ( 50 ) . fill ( '' ) . map ( ( _ , index ) => ( { id : `${ index } ` , Header : ( ) => index } ) ) ] }
4277+ ref = { tableRef }
4278+ />
4279+ ) ;
4280+ } ;
4281+ cy . mount ( < ScrollToHorizontal /> ) ;
4282+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
4283+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
4284+ const ScrollToItemHorizontal = ( ) => {
4285+ const tableRef = useRef ( null ) ;
4286+ useEffect ( ( ) => {
4287+ tableRef . current . horizontalScrollToItem ( 13 , { align : 'start' } ) ;
4288+ } , [ ] ) ;
4289+ return (
4290+ < AnalyticalTable
4291+ data = { generateMoreData ( 200 ) }
4292+ columns = { new Array ( 50 ) . fill ( '' ) . map ( ( _ , index ) => ( { id : `${ index } ` , Header : ( ) => index } ) ) }
4293+ ref = { tableRef }
4294+ />
4295+ ) ;
4296+ } ;
4297+ cy . mount ( < ScrollToItemHorizontal /> ) ;
4298+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '13' ) . should ( 'be.visible' ) ;
4299+ cy . get ( '[data-component-name="AnalyticalTableContainer"]' ) . findByText ( '12' ) . should ( 'not.be.visible' ) ;
4300+ } ) ;
4301+
43054302 cypressPassThroughTestsFactory ( AnalyticalTable , { data, columns } ) ;
43064303} ) ;
43074304
0 commit comments