@@ -1119,7 +1119,8 @@ describe('IgxSimpleCombo', () => {
11191119 IgxSimpleComboSampleComponent ,
11201120 IgxComboInContainerTestComponent ,
11211121 IgxSimpleComboIconTemplatesComponent ,
1122- IgxSimpleComboDirtyCheckTestComponent
1122+ IgxSimpleComboDirtyCheckTestComponent ,
1123+ IgxSimpleComboTabBehaviorTestComponent
11231124 ]
11241125 } ) . compileComponents ( ) ;
11251126 } ) ) ;
@@ -2113,6 +2114,35 @@ describe('IgxSimpleCombo', () => {
21132114
21142115 expect ( reactiveForm . dirty ) . toBe ( false ) ;
21152116 } ) ) ;
2117+
2118+ it ( 'should focus on the next combo when Tab is pressed' , fakeAsync ( ( ) => {
2119+ fixture = TestBed . createComponent ( IgxSimpleComboTabBehaviorTestComponent ) ;
2120+ fixture . detectChanges ( ) ;
2121+
2122+ const combos = fixture . debugElement . queryAll ( By . directive ( IgxSimpleComboComponent ) ) ;
2123+ expect ( combos . length ) . toBe ( 3 ) ;
2124+
2125+ const firstComboInput = combos [ 0 ] . query ( By . css ( `.${ CSS_CLASS_COMBO_INPUTGROUP } ` ) ) ;
2126+ const secondComboInput = combos [ 1 ] . query ( By . css ( `.${ CSS_CLASS_COMBO_INPUTGROUP } ` ) ) ;
2127+ const thirdComboInput = combos [ 2 ] . query ( By . css ( `.${ CSS_CLASS_COMBO_INPUTGROUP } ` ) ) ;
2128+
2129+ firstComboInput . nativeElement . focus ( ) ;
2130+ tick ( ) ;
2131+ fixture . detectChanges ( ) ;
2132+ expect ( document . activeElement ) . toEqual ( firstComboInput . nativeElement ) ;
2133+
2134+ UIInteractions . triggerEventHandlerKeyDown ( 'Tab' , firstComboInput ) ;
2135+ secondComboInput . nativeElement . focus ( ) ;
2136+ tick ( ) ;
2137+ fixture . detectChanges ( ) ;
2138+ expect ( document . activeElement ) . toEqual ( secondComboInput . nativeElement ) ;
2139+
2140+ UIInteractions . triggerEventHandlerKeyDown ( 'Tab' , secondComboInput ) ;
2141+ thirdComboInput . nativeElement . focus ( ) ;
2142+ tick ( ) ;
2143+ fixture . detectChanges ( ) ;
2144+ expect ( document . activeElement ) . toEqual ( thirdComboInput . nativeElement ) ;
2145+ } ) ) ;
21162146 } ) ;
21172147
21182148 describe ( 'Display density' , ( ) => {
@@ -3456,3 +3486,64 @@ export class IgxSimpleComboDirtyCheckTestComponent implements OnInit {
34563486 ] ;
34573487 }
34583488}
3489+
3490+ @Component ( {
3491+ template : `
3492+ <form [formGroup]="form">
3493+ <div class="combo-section">
3494+ <igx-simple-combo
3495+ #combo
3496+ [data]="cities"
3497+ [displayKey]="'name'"
3498+ [valueKey]="'id'"
3499+ formControlName="city"
3500+ >
3501+ </igx-simple-combo>
3502+
3503+ <igx-simple-combo
3504+ #combo2
3505+ [data]="cities"
3506+ [displayKey]="'name'"
3507+ [valueKey]="'id'"
3508+ formControlName="city2"
3509+ ></igx-simple-combo>
3510+
3511+ <igx-simple-combo
3512+ #combo3
3513+ [data]="cities"
3514+ [displayKey]="'name'"
3515+ [valueKey]="'id'"
3516+ formControlName="city3"
3517+ ></igx-simple-combo>
3518+ </div>
3519+ </form>
3520+ ` ,
3521+ standalone : true ,
3522+ imports : [ IgxSimpleComboComponent , ReactiveFormsModule ]
3523+ } )
3524+ export class IgxSimpleComboTabBehaviorTestComponent implements OnInit {
3525+ @ViewChild ( 'combo' , { read : IgxSimpleComboComponent , static : true } )
3526+ public combo : IgxSimpleComboComponent ;
3527+ @ViewChild ( 'combo2' , { read : IgxSimpleComboComponent , static : true } )
3528+ public combo2 : IgxSimpleComboComponent ;
3529+ @ViewChild ( 'combo3' , { read : IgxSimpleComboComponent , static : true } )
3530+ public combo3 : IgxSimpleComboComponent ;
3531+
3532+ public cities = [ ] ;
3533+
3534+ public form = new FormGroup ( {
3535+ city : new FormControl < number > ( { value : undefined , disabled : false } ) ,
3536+ city2 : new FormControl < number > ( { value : undefined , disabled : false } ) ,
3537+ city3 : new FormControl < number > ( { value : undefined , disabled : false } ) ,
3538+ } ) ;
3539+
3540+ public ngOnInit ( ) : void {
3541+ this . cities = [
3542+ { id : 1 , name : 'New York' } ,
3543+ { id : 2 , name : 'Los Angeles' } ,
3544+ { id : 3 , name : 'Chicago' } ,
3545+ { id : 4 , name : 'Houston' } ,
3546+ { id : 5 , name : 'Phoenix' }
3547+ ] ;
3548+ }
3549+ }
0 commit comments