File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/cdk-experimental/ui-patterns/listbox Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -132,5 +132,23 @@ describe('Listbox Pattern', () => {
132132 listbox . onKeydown ( event ) ;
133133 expect ( listbox . inputs . activeIndex ( ) ) . toBe ( 0 ) ;
134134 } ) ;
135+
136+ it ( 'should navigate to the first option on Home' , ( ) => {
137+ const event = createKeyboardEvent ( 'keydown' , 36 , 'Home' ) ;
138+ const { listbox, options} = getDefaultPatterns ( {
139+ activeIndex : signal ( 8 ) ,
140+ } ) ;
141+ expect ( listbox . inputs . activeIndex ( ) ) . toBe ( 8 ) ;
142+ listbox . onKeydown ( event ) ;
143+ expect ( listbox . inputs . activeIndex ( ) ) . toBe ( 0 ) ;
144+ } ) ;
145+
146+ it ( 'should navigate to the last option on End' , ( ) => {
147+ const event = createKeyboardEvent ( 'keydown' , 35 , 'End' ) ;
148+ const { listbox, options} = getDefaultPatterns ( ) ;
149+ expect ( listbox . inputs . activeIndex ( ) ) . toBe ( 0 ) ;
150+ listbox . onKeydown ( event ) ;
151+ expect ( listbox . inputs . activeIndex ( ) ) . toBe ( options ( ) . length - 1 ) ;
152+ } ) ;
135153 } ) ;
136154} ) ;
You can’t perform that action at this time.
0 commit comments