Skip to content

Commit b4422f5

Browse files
MKirovaMKirova
authored andcommitted
fix(igxCombo): Prevent toggle on click of disabled combo.
1 parent e90c997 commit b4422f5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,13 @@ describe('igxCombo', () => {
24392439
expect(combo.valid).toEqual(IgxComboState.INITIAL);
24402440
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
24412441
});
2442+
it('should not open on click if combo is disabled', () => {
2443+
combo.disabled = true;
2444+
fixture.detectChanges();
2445+
UIInteractions.simulateClickEvent(combo.comboInput.nativeElement);
2446+
fixture.detectChanges();
2447+
expect(combo.dropdown.collapsed).toBeTruthy();
2448+
});
24422449
it('should be possible to be enabled/disabled when used as a form control', () => {
24432450
const form = fixture.componentInstance.reactiveForm;
24442451
const comboFormReference = form.controls.townCombo;

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,9 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
867867
onInputClick(event: Event) {
868868
event.stopPropagation();
869869
event.preventDefault();
870-
this.toggle();
870+
if (!this.disabled) {
871+
this.toggle();
872+
}
871873
}
872874

873875
/**

0 commit comments

Comments
 (0)