From fe1d50cbd34382ef45d354aa26d900d8f5d7374b Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Thu, 7 Jan 2016 08:55:23 -0700 Subject: [PATCH 1/3] Make MenuOptions extend MenuEvents The menu widget definition does not allow a MenuEvents object to be passed to it during initialization. For example, this gives an error from TypeScript: $el.menu({select: (e, ui) => { }}); I modified the MenuOptions definition to extend MenuEvents and removed MenuEvents from the Menu interface definition. This makes it consistent with how the other widgets are defined and allows both options and events to be defined when creating a menu widget. --- jqueryui/jqueryui.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index ade8eb735..7f117cc07 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -498,7 +498,7 @@ declare module JQueryUI { // Menu ////////////////////////////////////////////////// - interface MenuOptions { + interface MenuOptions extends MenuEvents { disabled?: boolean; icons?: any; menus?: string; @@ -520,7 +520,7 @@ declare module JQueryUI { select?: MenuEvent; } - interface Menu extends Widget, MenuOptions, MenuEvents { + interface Menu extends Widget, MenuOptions { } From d12cb4f80a6ae6b9c14e0116cad340aa59e83577 Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Thu, 7 Jan 2016 09:43:34 -0700 Subject: [PATCH 2/3] Add item property to MenuUIParams in JQueryUI The ui parameter that is returned to the caller in jQueryUI menu events (e.g. select) has an optional property named item, but it was not included in this type file. --- jqueryui/jqueryui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 7f117cc07..e93ca9301 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -507,6 +507,7 @@ declare module JQueryUI { } interface MenuUIParams { + item?: JQuery; } interface MenuEvent { From 36797eab8f7fc75c931b58292b15d2664f76f79f Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Fri, 8 Jan 2016 08:42:09 -0700 Subject: [PATCH 3/3] Added test --- jqueryui/jqueryui-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475..14de7019a 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1471,6 +1471,7 @@ function test_menu() { $(".selector").menu({ position: { my: "left top", at: "right-5 top+5" } }); $(".selector").menu({ role: null }); $(".selector").menu("option", { disabled: true }); + $(".selector").menu({ select: (e, ui) => { } }); }