mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[angular-aria] Add types for $ariaProvider (#42256)
* Add types for AngularJS Aria $ariaProvider. * Add another test
This commit is contained in:
parent
fee22aede9
commit
ec100987c0
@ -1,4 +1,18 @@
|
||||
function testConfig($aria: angular.aria.IAriaService): void {
|
||||
function testProvider($ariaProvider: angular.aria.IAriaProvider): void {
|
||||
// $ExpectType void
|
||||
$ariaProvider.config({ariaHidden: true});
|
||||
|
||||
// $ExpectType void
|
||||
$ariaProvider.config({ariaChecked: true, ariaReadonly: false});
|
||||
|
||||
// $ExpectError
|
||||
$ariaProvider.config({ariaDisabled: 44});
|
||||
|
||||
// $ExpectError
|
||||
$ariaProvider.config({unknownkey: false});
|
||||
}
|
||||
|
||||
function testService($aria: angular.aria.IAriaService): void {
|
||||
// $ExpectType boolean
|
||||
$aria.config('tabindex');
|
||||
|
||||
|
||||
13
types/angular-aria/index.d.ts
vendored
13
types/angular-aria/index.d.ts
vendored
@ -10,8 +10,19 @@ declare module 'angular' {
|
||||
namespace aria {
|
||||
type IAriaAttribute = 'ariaHidden'|'ariaChecked'|'ariaReadonly'|'ariaDisabled'|'ariaRequired'|'ariaInvalid'|'ariaValue'|'tabindex'|'bindKeydown'|'bindRoleForClick';
|
||||
|
||||
type IAriaProviderOptions = {
|
||||
[key in IAriaAttribute]?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* $aria service.
|
||||
* $ariaProvider (https://docs.angularjs.org/api/ngAria/provider/$ariaProvider).
|
||||
*/
|
||||
interface IAriaProvider {
|
||||
config(config: IAriaProviderOptions): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $aria service (https://docs.angularjs.org/api/ngAria/service/$aria).
|
||||
*/
|
||||
interface IAriaService {
|
||||
config(attribute: IAriaAttribute): boolean;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user