@@ -250,6 +250,33 @@ describe('Typeahead should', () => {
250250 expect ( Boolean ( value1Option . prop ( 'data-highlighted' ) ) ) . toEqual ( true ) ;
251251 } ) ;
252252
253+ it ( 'highlight second option in a filtered list when no value is set and arrow down key is pressed twice' , function ( ) {
254+ const wrapper = mount ( < Typeahead fieldName = "fieldName" options = { options } /> ) ;
255+ wrapper . find ( 'input' ) . simulate ( 'focus' ) ;
256+ simulateKeys ( wrapper . find ( 'input' ) , 'spe' ) ;
257+ wrapper . find ( 'input' ) . simulate ( 'keyDown' , { keyCode : KEY_DOWN } ) ;
258+ wrapper . find ( 'input' ) . simulate ( 'keyDown' , { keyCode : KEY_DOWN } ) ;
259+ const value1Option = wrapper . find ( '.typeahead__option[data-value="value4"]' ) ;
260+ expect ( Boolean ( value1Option . prop ( 'data-highlighted' ) ) ) . toEqual ( true ) ;
261+ } ) ;
262+
263+ it ( 'highlight the right option in a filtered list when no value is set and arrow down key is pressed twice' , function ( ) {
264+ const optionsForFilter = [
265+ { label : 'nomatch' , value : 'value1' } ,
266+ { label : 'nomatch' , value : 'value2' } ,
267+ { label : 'match haus' , value : 'value3' } ,
268+ { label : 'nomatch' , value : 'value4' } ,
269+ { label : 'match haus 2' , value : 'value5' }
270+ ] ;
271+ const wrapper = mount ( < Typeahead fieldName = "fieldName" options = { optionsForFilter } /> ) ;
272+ wrapper . find ( 'input' ) . simulate ( 'focus' ) ;
273+ simulateKeys ( wrapper . find ( 'input' ) , 'haus' ) ;
274+ wrapper . find ( 'input' ) . simulate ( 'keyDown' , { keyCode : KEY_DOWN } ) ;
275+ wrapper . find ( 'input' ) . simulate ( 'keyDown' , { keyCode : KEY_DOWN } ) ;
276+ const value1Option = wrapper . find ( '.typeahead__option[data-value="value5"]' ) ;
277+ expect ( Boolean ( value1Option . prop ( 'data-highlighted' ) ) ) . toEqual ( true ) ;
278+ } ) ;
279+
253280 it ( 'highlight first option when no value is set and arrow up key is pressed' , function ( ) {
254281 const wrapper = mount ( < Typeahead fieldName = "fieldName" options = { options } /> ) ;
255282 wrapper . find ( 'input' ) . simulate ( 'focus' ) ;
0 commit comments