Skip to content

Sstoychev/bypassing input required logic 20 #16047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: 20.0.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ng-content select="igx-hint, [igxHint]"></ng-content>
</ng-container>
<input igxInput #comboInput name="comboInput" type="text" [value]="displayValue" readonly
[attr.required]="required"
[attr.placeholder]="placeholder" [disabled]="disabled"
role="combobox" aria-haspopup="listbox"
[attr.aria-expanded]="!dropdown.collapsed" [attr.aria-controls]="dropdown.listId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3436,8 +3436,10 @@ describe('igxCombo', () => {
it('should add/remove asterisk when setting validators dynamically', () => {
let inputGroupIsRequiredClass = fixture.debugElement.query(By.css('.' + CSS_CLASS_INPUTGROUP_REQUIRED));
let asterisk = window.getComputedStyle(fixture.debugElement.query(By.css('.' + CSS_CLASS_INPUTGROUP_LABEL)).nativeElement, ':after').content;
input = fixture.debugElement.query(By.css(`.${CSS_CLASS_COMBO_INPUTGROUP}`));
expect(asterisk).toBe('"*"');
expect(inputGroupIsRequiredClass).toBeDefined();
expect(input.nativeElement.getAttribute('aria-required')).toMatch('true');

fixture.componentInstance.reactiveForm.controls.townCombo.clearValidators();
fixture.componentInstance.reactiveForm.controls.townCombo.updateValueAndValidity();
Expand All @@ -3446,6 +3448,7 @@ describe('igxCombo', () => {
asterisk = window.getComputedStyle(fixture.debugElement.query(By.css('.' + CSS_CLASS_INPUTGROUP_LABEL)).nativeElement, ':after').content;
expect(asterisk).toBe('none');
expect(inputGroupIsRequiredClass).toBeNull();
expect(input.nativeElement.getAttribute('aria-required')).toMatch('false');

fixture.componentInstance.reactiveForm.controls.townCombo.setValidators(Validators.required);
fixture.componentInstance.reactiveForm.controls.townCombo.updateValueAndValidity();
Expand All @@ -3454,6 +3457,7 @@ describe('igxCombo', () => {
asterisk = window.getComputedStyle(fixture.debugElement.query(By.css('.' + CSS_CLASS_INPUTGROUP_LABEL)).nativeElement, ':after').content;
expect(asterisk).toBe('"*"');
expect(inputGroupIsRequiredClass).toBeDefined();
expect(input.nativeElement.getAttribute('aria-required')).toMatch('true');
});

it('Should update validity state when programmatically setting errors on reactive form controls', fakeAsync(() => {
Expand Down
Loading