@@ -1844,7 +1844,7 @@ describe('FragmentRefs', () => {
18441844 } ) ;
18451845
18461846 describe ( 'scrollIntoView' , ( ) => {
1847- // @gate enableFragmentRefs
1847+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
18481848 it ( 'does not yet support options' , async ( ) => {
18491849 const fragmentRef = React . createRef ( ) ;
18501850 const root = ReactDOMClient . createRoot ( container ) ;
@@ -1853,15 +1853,15 @@ describe('FragmentRefs', () => {
18531853 } ) ;
18541854
18551855 expect ( ( ) => {
1856- fragmentRef . current . scrollIntoView ( { block : 'start' } ) ;
1856+ fragmentRef . current . experimental_scrollIntoView ( { block : 'start' } ) ;
18571857 } ) . toThrowError (
1858- 'FragmentInstance.scrollIntoView () does not support ' +
1858+ 'FragmentInstance.experimental_scrollIntoView () does not support ' +
18591859 'scrollIntoViewOptions. Use the alignToTop boolean instead.' ,
18601860 ) ;
18611861 } ) ;
18621862
18631863 describe ( 'with children' , ( ) => {
1864- // @gate enableFragmentRefs
1864+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
18651865 it ( 'calls scrollIntoView on the first child by default, or if alignToTop=true' , async ( ) => {
18661866 const fragmentRef = React . createRef ( ) ;
18671867 const childARef = React . createRef ( ) ;
@@ -1883,19 +1883,19 @@ describe('FragmentRefs', () => {
18831883 childBRef . current . scrollIntoView = jest . fn ( ) ;
18841884
18851885 // Default call
1886- fragmentRef . current . scrollIntoView ( ) ;
1886+ fragmentRef . current . experimental_scrollIntoView ( ) ;
18871887 expect ( childARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
18881888 expect ( childBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
18891889
18901890 childARef . current . scrollIntoView . mockClear ( ) ;
18911891
18921892 // alignToTop=true
1893- fragmentRef . current . scrollIntoView ( true ) ;
1893+ fragmentRef . current . experimental_scrollIntoView ( true ) ;
18941894 expect ( childARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
18951895 expect ( childBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
18961896 } ) ;
18971897
1898- // @gate enableFragmentRefs
1898+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
18991899 it ( 'calls scrollIntoView on the last child if alignToTop is false' , async ( ) => {
19001900 const fragmentRef = React . createRef ( ) ;
19011901 const childARef = React . createRef ( ) ;
@@ -1913,12 +1913,12 @@ describe('FragmentRefs', () => {
19131913 childARef . current . scrollIntoView = jest . fn ( ) ;
19141914 childBRef . current . scrollIntoView = jest . fn ( ) ;
19151915
1916- fragmentRef . current . scrollIntoView ( false ) ;
1916+ fragmentRef . current . experimental_scrollIntoView ( false ) ;
19171917 expect ( childARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
19181918 expect ( childBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
19191919 } ) ;
19201920
1921- // @gate enableFragmentRefs
1921+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
19221922 it ( 'handles portaled elements -- same scroll container' , async ( ) => {
19231923 const fragmentRef = React . createRef ( ) ;
19241924 const childARef = React . createRef ( ) ;
@@ -1950,12 +1950,12 @@ describe('FragmentRefs', () => {
19501950 childBRef . current . scrollIntoView = jest . fn ( ) ;
19511951
19521952 // Default call
1953- fragmentRef . current . scrollIntoView ( ) ;
1953+ fragmentRef . current . experimental_scrollIntoView ( ) ;
19541954 expect ( childARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
19551955 expect ( childBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
19561956 } ) ;
19571957
1958- // @gate enableFragmentRefs
1958+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
19591959 it ( 'handles portaled elements -- different scroll container' , async ( ) => {
19601960 const fragmentRef = React . createRef ( ) ;
19611961 const headerChildRef = React . createRef ( ) ;
@@ -2086,7 +2086,7 @@ describe('FragmentRefs', () => {
20862086 } ) ;
20872087
20882088 // Default call
2089- fragmentRef . current . scrollIntoView ( ) ;
2089+ fragmentRef . current . experimental_scrollIntoView ( ) ;
20902090 expect ( childCRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
20912091 // In the same group as A, we use the first child
20922092 expect ( childBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -2102,7 +2102,7 @@ describe('FragmentRefs', () => {
21022102 logs = [ ] ;
21032103
21042104 // // alignToTop=false
2105- fragmentRef . current . scrollIntoView ( false ) ;
2105+ fragmentRef . current . experimental_scrollIntoView ( false ) ;
21062106 expect ( headerChildRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
21072107 // In the same group as B, only attempt B which is the last child
21082108 expect ( childARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -2116,7 +2116,7 @@ describe('FragmentRefs', () => {
21162116 } ) ;
21172117
21182118 describe ( 'without children' , ( ) => {
2119- // @gate enableFragmentRefs
2119+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
21202120 it ( 'calls scrollIntoView on the next sibling by default, or if alignToTop=true' , async ( ) => {
21212121 const fragmentRef = React . createRef ( ) ;
21222122 const siblingARef = React . createRef ( ) ;
@@ -2138,19 +2138,19 @@ describe('FragmentRefs', () => {
21382138 siblingBRef . current . scrollIntoView = jest . fn ( ) ;
21392139
21402140 // Default call
2141- fragmentRef . current . scrollIntoView ( ) ;
2141+ fragmentRef . current . experimental_scrollIntoView ( ) ;
21422142 expect ( siblingARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
21432143 expect ( siblingBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
21442144
21452145 siblingBRef . current . scrollIntoView . mockClear ( ) ;
21462146
21472147 // alignToTop=true
2148- fragmentRef . current . scrollIntoView ( true ) ;
2148+ fragmentRef . current . experimental_scrollIntoView ( true ) ;
21492149 expect ( siblingARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
21502150 expect ( siblingBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
21512151 } ) ;
21522152
2153- // @gate enableFragmentRefs
2153+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
21542154 it ( 'calls scrollIntoView on the prev sibling if alignToTop is false' , async ( ) => {
21552155 const fragmentRef = React . createRef ( ) ;
21562156 const siblingARef = React . createRef ( ) ;
@@ -2182,12 +2182,12 @@ describe('FragmentRefs', () => {
21822182 siblingBRef . current . scrollIntoView = jest . fn ( ) ;
21832183
21842184 // alignToTop=false
2185- fragmentRef . current . scrollIntoView ( false ) ;
2185+ fragmentRef . current . experimental_scrollIntoView ( false ) ;
21862186 expect ( siblingARef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
21872187 expect ( siblingBRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 0 ) ;
21882188 } ) ;
21892189
2190- // @gate enableFragmentRefs
2190+ // @gate enableFragmentRefs && enableFragmentRefsScrollIntoView
21912191 it ( 'calls scrollIntoView on the parent if there are no siblings' , async ( ) => {
21922192 const fragmentRef = React . createRef ( ) ;
21932193 const parentRef = React . createRef ( ) ;
@@ -2203,7 +2203,7 @@ describe('FragmentRefs', () => {
22032203 } ) ;
22042204
22052205 parentRef . current . scrollIntoView = jest . fn ( ) ;
2206- fragmentRef . current . scrollIntoView ( ) ;
2206+ fragmentRef . current . experimental_scrollIntoView ( ) ;
22072207 expect ( parentRef . current . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
22082208 } ) ;
22092209 } ) ;
0 commit comments