Skip to content

Commit 90fc300

Browse files
crisbetokara
authored andcommitted
fix(chips): invalid aria-selected value for non-selectable chip (#6544)
1 parent 1f4a962 commit 90fc300

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/lib/chips/chip.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,8 @@ describe('Chips', () => {
194194
expect(testComponent.chipSelect).not.toHaveBeenCalled();
195195
});
196196

197-
it('should have empty aria-selected', () => {
198-
expect(chipNativeElement.getAttribute('aria-selected')).toBeFalsy();
199-
200-
testComponent.selectable = true;
201-
fixture.detectChanges();
202-
203-
expect(chipNativeElement.getAttribute('aria-selected')).toBe('false');
197+
it('should not have the aria-selected attribute', () => {
198+
expect(chipNativeElement.hasAttribute('aria-selected')).toBe(false);
204199
});
205200
});
206201

src/lib/chips/chip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
121121
/** Emitted when the chip is destroyed. */
122122
@Output() destroy = new EventEmitter<MdChipEvent>();
123123

124-
get ariaSelected(): string {
125-
return this.selectable ? this.selected.toString() : '';
124+
get ariaSelected(): string | null {
125+
return this.selectable ? this.selected.toString() : null;
126126
}
127127

128128
constructor(renderer: Renderer2, elementRef: ElementRef) {

0 commit comments

Comments
 (0)