Skip to content
Merged
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
9 changes: 9 additions & 0 deletions src/material-experimental/mdc-chips/chip-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ describe('MDC-based MatChipInput', () => {
expect(inputNativeElement.getAttribute('aria-required')).toBe('true');
});

it('should be required if the list is required', () => {
expect(inputNativeElement.hasAttribute('required')).toBe(false);

fixture.componentInstance.required = true;
fixture.detectChanges();

expect(inputNativeElement.getAttribute('required')).toBe('true');
});

it('should allow focus to escape when tabbing forwards', fakeAsync(() => {
const gridElement: HTMLElement = fixture.nativeElement.querySelector('mat-chip-grid');

Expand Down
1 change: 1 addition & 0 deletions src/material-experimental/mdc-chips/chip-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ let nextUniqueId = 0;
'[attr.placeholder]': 'placeholder || null',
'[attr.aria-invalid]': '_chipGrid && _chipGrid.ngControl ? _chipGrid.ngControl.invalid : null',
'[attr.aria-required]': '_chipGrid && _chipGrid.required || null',
'[attr.required]': '_chipGrid && _chipGrid.required || null',
}
})
export class MatChipInput implements MatChipTextControl, AfterContentInit, OnChanges, OnDestroy {
Expand Down