@@ -699,51 +699,16 @@ describe('TreeKeyManager', () => {
699699
700700 it ( 'should debounce the input key presses' , async ( ) => {
701701 keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 79 , 'o' ) ) ; // types "o"
702- await wait ( 1 ) ;
702+ await wait ( 50 ) ;
703703 keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 78 , 'n' ) ) ; // types "n"
704- await wait ( 1 ) ;
704+ await wait ( 50 ) ;
705705 keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 69 , 'e' ) ) ; // types "e"
706706
707707 expect ( keyManager . getActiveItemIndex ( ) )
708708 . withContext ( 'active item index, before debounce interval' )
709709 . not . toBe ( 0 ) ;
710710
711- await wait ( debounceInterval - 1 ) ;
712-
713- expect ( keyManager . getActiveItemIndex ( ) )
714- . withContext ( 'active item index, after partial debounce interval' )
715- . not . toBe ( 0 ) ;
716-
717- await wait ( 100 ) ;
718-
719- expect ( keyManager . getActiveItemIndex ( ) )
720- . withContext ( 'active item index, after full debounce interval' )
721- . toBe ( 0 ) ;
722- } ) ;
723-
724- it ( 'uses a default debounce interval' , async ( ) => {
725- const defaultInterval = 200 ;
726- keyManager = new TreeKeyManager ( itemList , {
727- typeAheadDebounceInterval : true ,
728- } ) ;
729-
730- keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 79 , 'o' ) ) ; // types "o"
731- await wait ( 1 ) ;
732- keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 78 , 'n' ) ) ; // types "n"
733- await wait ( 1 ) ;
734- keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , 69 , 'e' ) ) ; // types "e"
735-
736- expect ( keyManager . getActiveItemIndex ( ) )
737- . withContext ( 'active item index, before debounce interval' )
738- . not . toBe ( 0 ) ;
739-
740- await wait ( defaultInterval - 1 ) ;
741-
742- expect ( keyManager . getActiveItemIndex ( ) )
743- . withContext ( 'active item index, after partial debounce interval' )
744- . not . toBe ( 0 ) ;
745-
746- await wait ( 100 ) ;
711+ await wait ( debounceInterval * 1.5 ) ;
747712
748713 expect ( keyManager . getActiveItemIndex ( ) )
749714 . withContext ( 'active item index, after full debounce interval' )
0 commit comments