From b3475335476d7b326f4a98cced59e2ccc706e426 Mon Sep 17 00:00:00 2001 From: AlexStacker <525029662@qq.com> Date: Fri, 14 Sep 2018 11:25:12 +0800 Subject: [PATCH 1/2] Update missing parameter types --- types/select2/v3/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index 771d997384..73f1873df1 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -112,6 +112,14 @@ interface Select2Plugin { * @params triggerChange Should a change event be triggered */ (method: 'data', value: any, triggerChange?: boolean): any; + /** + * Whether it is open + */ + (method: 'opened'): boolean; + /** + * Whether it is in focus + */ + (method: 'isFocused'): boolean; /** * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. */ @@ -124,11 +132,19 @@ interface Select2Plugin { * Closes the dropdown */ (method: 'close'): JQuery; + /** + * Disables Select2 + */ + (method: 'disable'): JQuery; /** * Enables or disables Select2 and its underlying form component * @param value True if it should be enabled false if it should be disabled */ (method: 'enable', value?: boolean): JQuery; + /** + * Enable its focus + */ + (method: 'focus'): JQuery; /** * Toggles readonly mode on Select2 and its underlying form component * @param value True if it should be readonly false if it should be read write From 1335935bc89f043c4d7b6234c2ca449f7fd67e34 Mon Sep 17 00:00:00 2001 From: AlexStacker <525029662@qq.com> Date: Fri, 14 Sep 2018 21:28:41 +0800 Subject: [PATCH 2/2] Add test examples --- types/select2/v3/select2-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 2d5a400352..c820a246ef 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -220,6 +220,10 @@ $("#e8").select2("data"); $("#e8").select2("data", { id: "CA", text: "Califoria" }); $("#e8").select2("destroy"); $("#e8").select2("open"); +$("#e8").select2("opened"); +$("#e8").select2("focus"); +$("#e8").select2("isFocused"); +$("#e8").select2("disable"); $("#e8").select2("enable", false); $("#e8").select2("readonly", false); $("#e8").select2('container');