fix(chips): invalid aria-selected value for non-selectable chip (#6544)

This commit is contained in:
Kristiyan Kostadinov
2017-08-22 23:04:10 +02:00
committed by Kara
parent 1f4a962e23
commit 90fc300ea9
2 changed files with 4 additions and 9 deletions
+2 -7
View File
@@ -194,13 +194,8 @@ describe('Chips', () => {
expect(testComponent.chipSelect).not.toHaveBeenCalled();
});
it('should have empty aria-selected', () => {
expect(chipNativeElement.getAttribute('aria-selected')).toBeFalsy();
testComponent.selectable = true;
fixture.detectChanges();
expect(chipNativeElement.getAttribute('aria-selected')).toBe('false');
it('should not have the aria-selected attribute', () => {
expect(chipNativeElement.hasAttribute('aria-selected')).toBe(false);
});
});
+2 -2
View File
@@ -121,8 +121,8 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
/** Emitted when the chip is destroyed. */
@Output() destroy = new EventEmitter<MdChipEvent>();
get ariaSelected(): string {
return this.selectable ? this.selected.toString() : '';
get ariaSelected(): string | null {
return this.selectable ? this.selected.toString() : null;
}
constructor(renderer: Renderer2, elementRef: ElementRef) {