From 24752ba8c4e9a45576a34faffb13a68b36afce47 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Thu, 30 Jan 2025 11:04:42 +0200 Subject: [PATCH 1/3] fix(simple-combo): remove text selection trigger --- .../src/lib/simple-combo/simple-combo.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts index 539ac855880..b54dc83f0ac 100644 --- a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts +++ b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts @@ -466,9 +466,8 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co } this.composing = false; - // explicitly update selection and trigger text selection so that we don't have to force CD + // explicitly update selection so that we don't have to force CD this.textSelection.selected = true; - this.textSelection.trigger(); } /** @hidden @internal */ From 7ba77922909b664a50a71db74c88095badbb8877 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Mon, 17 Feb 2025 11:55:17 +0200 Subject: [PATCH 2/3] fix(simple-combo): add test for tab behavior --- .../simple-combo.component.spec.ts | 92 ++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts index bb6a327e85f..1124d81a4f7 100644 --- a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts +++ b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts @@ -1119,7 +1119,8 @@ describe('IgxSimpleCombo', () => { IgxSimpleComboSampleComponent, IgxComboInContainerTestComponent, IgxSimpleComboIconTemplatesComponent, - IgxSimpleComboDirtyCheckTestComponent + IgxSimpleComboDirtyCheckTestComponent, + IgxSimpleComboTabBehaviorTestComponent ] }).compileComponents(); })); @@ -2113,6 +2114,35 @@ describe('IgxSimpleCombo', () => { expect(reactiveForm.dirty).toBe(false); })); + + it('should focus on the next combo when Tab is pressed', fakeAsync(() => { + fixture = TestBed.createComponent(IgxSimpleComboTabBehaviorTestComponent); + fixture.detectChanges(); + + const combos = fixture.debugElement.queryAll(By.directive(IgxSimpleComboComponent)); + expect(combos.length).toBe(3); + + const firstComboInput = combos[0].query(By.css(`.${CSS_CLASS_COMBO_INPUTGROUP}`)); + const secondComboInput = combos[1].query(By.css(`.${CSS_CLASS_COMBO_INPUTGROUP}`)); + const thirdComboInput = combos[2].query(By.css(`.${CSS_CLASS_COMBO_INPUTGROUP}`)); + + firstComboInput.nativeElement.focus(); + tick(); + fixture.detectChanges(); + expect(document.activeElement).toEqual(firstComboInput.nativeElement); + + UIInteractions.triggerEventHandlerKeyDown('Tab', firstComboInput); + secondComboInput.nativeElement.focus(); + tick(); + fixture.detectChanges(); + expect(document.activeElement).toEqual(secondComboInput.nativeElement); + + UIInteractions.triggerEventHandlerKeyDown('Tab', secondComboInput); + thirdComboInput.nativeElement.focus(); + tick(); + fixture.detectChanges(); + expect(document.activeElement).toEqual(thirdComboInput.nativeElement); + })); }); describe('Display density', () => { @@ -3456,3 +3486,63 @@ export class IgxSimpleComboDirtyCheckTestComponent implements OnInit { ]; } } + +@Component({ + template: ` +
+
+ + + + + + +
+
+ `, + imports: [IgxSimpleComboComponent, ReactiveFormsModule] +}) +export class IgxSimpleComboTabBehaviorTestComponent implements OnInit { + @ViewChild('combo', { read: IgxSimpleComboComponent, static: true }) + public combo: IgxSimpleComboComponent; + @ViewChild('combo2', { read: IgxSimpleComboComponent, static: true }) + public combo2: IgxSimpleComboComponent; + @ViewChild('combo3', { read: IgxSimpleComboComponent, static: true }) + public combo3: IgxSimpleComboComponent; + + public cities = []; + + public form = new FormGroup({ + city: new FormControl({ value: undefined, disabled: false }), + city2: new FormControl({ value: undefined, disabled: false }), + city3: new FormControl({ value: undefined, disabled: false }), + }); + + public ngOnInit(): void { + this.cities = [ + { id: 1, name: 'New York' }, + { id: 2, name: 'Los Angeles' }, + { id: 3, name: 'Chicago' }, + { id: 4, name: 'Houston' }, + { id: 5, name: 'Phoenix' } + ]; + } +} From 2ba10379ed42cd26fb55ad214d4b6997f5b96093 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Mon, 17 Feb 2025 12:09:56 +0200 Subject: [PATCH 3/3] fix(simple-combo): add standalone flag to the component --- .../src/lib/simple-combo/simple-combo.component.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts index 1124d81a4f7..1043809c875 100644 --- a/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts +++ b/projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts @@ -3518,6 +3518,7 @@ export class IgxSimpleComboDirtyCheckTestComponent implements OnInit { `, + standalone: true, imports: [IgxSimpleComboComponent, ReactiveFormsModule] }) export class IgxSimpleComboTabBehaviorTestComponent implements OnInit {