@@ -771,35 +771,7 @@ describe('getInputProps', () => {
771771 return { ...playground , item } ;
772772 }
773773
774- test ( 'scrolls to the active item with scrollIntoViewIfNeeded fallback with ArrowDown' , ( ) => {
775- const onStateChange = jest . fn ( ) ;
776- const { inputElement, item } = setupTestWithItem ( { onStateChange } ) ;
777- ( item as any ) . scrollIntoViewIfNeeded = jest . fn ( ) ;
778-
779- inputElement . focus ( ) ;
780- userEvent . type ( inputElement , '{arrowdown}' ) ;
781-
782- expect ( ( item as any ) . scrollIntoViewIfNeeded ) . toHaveBeenCalledTimes ( 1 ) ;
783- expect ( ( item as any ) . scrollIntoViewIfNeeded ) . toHaveBeenCalledWith (
784- false
785- ) ;
786- } ) ;
787-
788- test ( 'scrolls to the active item with scrollIntoViewIfNeeded fallback with ArrowUp' , ( ) => {
789- const onStateChange = jest . fn ( ) ;
790- const { inputElement, item } = setupTestWithItem ( { onStateChange } ) ;
791- ( item as any ) . scrollIntoViewIfNeeded = jest . fn ( ) ;
792-
793- inputElement . focus ( ) ;
794- userEvent . type ( inputElement , '{arrowup}' ) ;
795-
796- expect ( ( item as any ) . scrollIntoViewIfNeeded ) . toHaveBeenCalledTimes ( 1 ) ;
797- expect ( ( item as any ) . scrollIntoViewIfNeeded ) . toHaveBeenCalledWith (
798- false
799- ) ;
800- } ) ;
801-
802- test ( 'scrolls to the active item with scrollIntoView fallback with ArrowDown' , ( ) => {
774+ test ( 'scrolls to the active item with ArrowDown' , ( ) => {
803775 const onStateChange = jest . fn ( ) ;
804776 const { inputElement, item } = setupTestWithItem ( { onStateChange } ) ;
805777 item . scrollIntoView = jest . fn ( ) ;
@@ -808,10 +780,13 @@ describe('getInputProps', () => {
808780 userEvent . type ( inputElement , '{arrowdown}' ) ;
809781
810782 expect ( item . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
811- expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( false ) ;
783+ expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( {
784+ block : 'nearest' ,
785+ inline : 'nearest' ,
786+ } ) ;
812787 } ) ;
813788
814- test ( 'scrolls to the active item with scrollIntoView fallback with ArrowUp' , ( ) => {
789+ test ( 'scrolls to the active item with ArrowUp' , ( ) => {
815790 const onStateChange = jest . fn ( ) ;
816791 const { inputElement, item } = setupTestWithItem ( { onStateChange } ) ;
817792 item . scrollIntoView = jest . fn ( ) ;
@@ -820,7 +795,10 @@ describe('getInputProps', () => {
820795 userEvent . type ( inputElement , '{arrowup}' ) ;
821796
822797 expect ( item . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
823- expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( false ) ;
798+ expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( {
799+ block : 'nearest' ,
800+ inline : 'nearest' ,
801+ } ) ;
824802 } ) ;
825803
826804 test ( 'calls onActive when activeItemId' , ( ) => {
@@ -1014,7 +992,10 @@ describe('getInputProps', () => {
1014992 ) ;
1015993
1016994 expect ( item . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
1017- expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( false ) ;
995+ expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( {
996+ block : 'nearest' ,
997+ inline : 'nearest' ,
998+ } ) ;
1018999 } ) ;
10191000 } ) ;
10201001
@@ -1121,7 +1102,10 @@ describe('getInputProps', () => {
11211102 ) ;
11221103
11231104 expect ( item . scrollIntoView ) . toHaveBeenCalledTimes ( 1 ) ;
1124- expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( false ) ;
1105+ expect ( item . scrollIntoView ) . toHaveBeenCalledWith ( {
1106+ block : 'nearest' ,
1107+ inline : 'nearest' ,
1108+ } ) ;
11251109 } ) ;
11261110 } ) ;
11271111 } ) ;
0 commit comments