chore(a11y): make disabled property optional (#1613)

This commit is contained in:
Kara
2016-10-26 13:13:52 -07:00
committed by Jeremy Elbourn
parent 596d994f06
commit 3c79855b27
2 changed files with 17 additions and 1 deletions
@@ -77,6 +77,22 @@ describe('ListKeyManager', () => {
expect(items[2].focus).toHaveBeenCalledTimes(1);
});
it('should work normally when disabled property does not exist', () => {
items[0].disabled = undefined;
items[1].disabled = undefined;
items[2].disabled = undefined;
keyManager.onKeydown(DOWN_ARROW_EVENT);
expect(items[0].focus).not.toHaveBeenCalled();
expect(items[1].focus).toHaveBeenCalledTimes(1);
expect(items[2].focus).not.toHaveBeenCalled();
keyManager.onKeydown(DOWN_ARROW_EVENT);
expect(items[0].focus).not.toHaveBeenCalled();
expect(items[1].focus).toHaveBeenCalledTimes(1);
expect(items[2].focus).toHaveBeenCalledTimes(1);
});
it('should wrap back to menu when arrow keying past items', () => {
keyManager.onKeydown(DOWN_ARROW_EVENT);
keyManager.onKeydown(DOWN_ARROW_EVENT);
+1 -1
View File
@@ -7,7 +7,7 @@ import {UP_ARROW, DOWN_ARROW, TAB} from '../core';
*/
export interface MdFocusable {
focus(): void;
disabled: boolean;
disabled?: boolean;
}
/**