Skip to content

Commit 94c2ae5

Browse files
committed
feat(*): aria-required date-picker and simple combo
1 parent 8394a01 commit 94c2ae5

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,7 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
13001300
this.manageRequiredAsterisk();
13011301
};
13021302

1303+
/** @hidden @internal */
13031304
protected externalValidate(): IgxInputState {
13041305
return this._valid;
13051306
}

projects/igniteui-angular/src/lib/date-picker/date-picker.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
}
1616

1717
<input class="igx-date-picker__input-date" [displayValuePipe]="formatter ? displayValue : null" igxInput
18+
[required]="required" [attr.aria-required]="required"
1819
[igxDateTimeEditor]="inputFormat" [displayFormat]="displayFormat"
1920
[minValue]="minValue" [maxValue]="maxValue" [spinDelta]="spinDelta" [spinLoop]="spinLoop"
2021
[disabled]="disabled" [placeholder]="placeholder" [readonly]="!isDropdown || readOnly"

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,22 @@ describe('IgxDatePicker', () => {
231231

232232
expect(datePicker).toBeDefined();
233233
expect(inputGroup.isRequired).toBeTruthy();
234+
expect((datePicker as any).inputDirective.nativeElement.getAttribute('aria-required')).toEqual('true');
234235
});
235236

236237
it('should update inputGroup isRequired correctly', () => {
237238
const inputGroup = (datePicker as any).inputGroup;
239+
const inputEl = (datePicker as any).inputDirective.nativeElement;
238240

239241
expect(datePicker).toBeDefined();
240242
expect(inputGroup.isRequired).toBeTruthy();
243+
expect(inputEl.getAttribute('aria-required')).toEqual('true');
241244

242245
(fixture.componentInstance as IgxDatePickerNgModelComponent).isRequired = false;
243246
fixture.detectChanges();
244247

245248
expect(inputGroup.isRequired).toBeFalsy();
249+
expect(inputEl.getAttribute('aria-required')).toEqual('false');
246250
});
247251

248252
it('should set validity to initial when the form is reset', fakeAsync(() => {

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</ng-container>
1414

1515
<input #comboInput igxInput [value]="displayValue" role="combobox"
16+
[required]="required" [attr.aria-required]="required" [externalValidate]="externalValidate"
1617
aria-haspopup="listbox" aria-autocomplete="list" aria-readonly="false"
1718
[attr.aria-expanded]="!this.dropdown.collapsed" [attr.aria-controls]="this.dropdown.listId"
1819
[attr.aria-labelledby]="this.ariaLabelledBy || this.label?.id || this.placeholder"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,7 @@ describe('IgxSimpleCombo', () => {
22772277

22782278
expect(combo.valid).toEqual(IgxInputState.INITIAL);
22792279
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
2280+
expect(combo.comboInput.nativeElement.attributes['aria-required']).toBeDefined();
22802281

22812282
// empty string
22822283
combo.open();

0 commit comments

Comments
 (0)