mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(a11y): make disabled property optional (#1613)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -7,7 +7,7 @@ import {UP_ARROW, DOWN_ARROW, TAB} from '../core';
|
||||
*/
|
||||
export interface MdFocusable {
|
||||
focus(): void;
|
||||
disabled: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user