diff --git a/Definitions/jqueryui-1.9.d.ts b/Definitions/jqueryui-1.9.d.ts index d8dd1d9e4..2d49a15e2 100644 --- a/Definitions/jqueryui-1.9.d.ts +++ b/Definitions/jqueryui-1.9.d.ts @@ -39,7 +39,7 @@ interface Accordion extends Widget { icons?: any; // Methods - + // Events activate(event: Event, ui): void; beforeActivate(event: Event, ui): void; @@ -61,7 +61,7 @@ interface Autocomplete extends Widget { source?: any; // [], string or () // Methods - close(); + close(); search(value?: string); // Events @@ -78,7 +78,7 @@ interface Autocomplete extends Widget { // Button ////////////////////////////////////////////////// -interface Button extends Widget { +interface Button extends Widget { // Options disabled?: bool; @@ -152,7 +152,7 @@ interface Datepicker extends Widget { // Methods destroy(); - dialog(date: any, onSelect?: () => void, settings?: any, pos?: any); + dialog(date: any, onSelect?: () => void , settings?: any, pos?: any); getDate(): Date; hide(): void; isDisabled(): bool; @@ -357,7 +357,7 @@ interface Menu extends Widget { blur(event: Event, ui): void; create(event: Event, ui): void; focus(event: Event, ui): void; - select(event: Event, ui): void; + select(event: Event, ui): void; } @@ -372,7 +372,7 @@ interface Progressbar extends Widget { // Methods destroy(); disable(); - enable(); + enable(); option(optionName: string): any; option(): any; option(optionName: string, value: any): void; @@ -414,7 +414,7 @@ interface Resizable extends Widget { minWidth?: number; // Methods - + // Events resize(event: Event, ui): void; start(event: Event, ui): void; @@ -436,7 +436,7 @@ interface Selectable extends Widget { tolerance?: string; // Methods - + // Events selected(event: Event, ui): void; selecting(event: Event, ui): void; @@ -452,7 +452,7 @@ interface Slider extends Widget { // Options animate?: any; // bool, string or number - disabled?: bool; + disabled?: bool; max?: number; min?: number; orientation?: string; @@ -471,8 +471,8 @@ interface Slider extends Widget { // Events change(event: Event, ui): void; - create(event: Event, ui): void; - slide(event: Event, ui): void; + create(event: Event, ui): void; + slide(event: Event, ui): void; start(event: Event, ui): void; stop(event: Event, ui): void; } @@ -615,47 +615,124 @@ interface Tooltip extends Widget { interface JQuery { - accordion(options?: Accordion): void; + accordion(): JQuery; + accordion(methodName: string): JQuery; + accordion(options: Dialog): JQuery; + accordion(optionLiteral: string, options: Dialog): JQuery; + accordion(optionLiteral: string, optionName: string, optionValue: any): JQuery; + accordion(optionLiteral: string, optionName: string): JQuery; - autocomplete(options?: Autocomplete): void; + autocomplete(): JQuery; + autocomplete(methodName: string): JQuery; + autocomplete(options: Autocomplete): JQuery; + autocomplete(optionLiteral: string, options: Autocomplete): JQuery; + autocomplete(optionLiteral: string, optionName: string, optionValue: any): JQuery; + autocomplete(optionLiteral: string, optionName: string): JQuery; - button(options?: Button): void; - buttonset(options?: Button): void; + button(): JQuery; + button(methodName: string): JQuery; + button(options: Button): JQuery; + button(optionLiteral: string, options: Button): JQuery; + button(optionLiteral: string, optionName: string, optionValue: any): JQuery; + button(optionLiteral: string, optionName: string): JQuery; - datepicker(options?: Datepicker): void; + buttonset(): JQuery; + buttonset(methodName: string): JQuery; + buttonset(options: Button): JQuery; + buttonset(optionLiteral: string, options: Button): JQuery; + buttonset(optionLiteral: string, optionName: string, optionValue: any): JQuery; + buttonset(optionLiteral: string, optionName: string): JQuery; - dialog(options?: Dialog): void; - dialog(optionLiteral: string): void; + datepicker(): JQuery; + datepicker(methodName: string): JQuery; + datepicker(options: Datepicker): JQuery; + datepicker(optionLiteral: string, options: Datepicker): JQuery; + datepicker(optionLiteral: string, optionName: string, optionValue: any): JQuery; + datepicker(optionLiteral: string, optionName: string): JQuery; - draggable(options?: Draggable): JQuery; + dialog(): JQuery; + dialog(methodName: string): JQuery; + dialog(options: Dialog): JQuery; + dialog(optionLiteral: string, options: Dialog): JQuery; + dialog(optionLiteral: string, optionName: string, optionValue: any): JQuery; + dialog(optionLiteral: string, optionName: string): JQuery; + + draggable(): JQuery; + draggable(methodName: string): JQuery; + draggable(options: Draggable): JQuery; draggable(optionLiteral: string, options: Draggable): JQuery; draggable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - draggable(optionLiteral: string, optionName: string): any; - // draggable(methodName: string): any; + draggable(optionLiteral: string, optionName: string): JQuery; + droppable(): JQuery; + droppable(methodName: string): JQuery; droppable(options: Droppable): JQuery; droppable(optionLiteral: string, options: Draggable): JQuery; droppable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - droppable(optionLiteral: string, optionName: string): any; - droppable(methodName: string): any; + droppable(optionLiteral: string, optionName: string): JQuery; - menu(options?: Menu): void; + menu(): JQuery; + menu(methodName: string): JQuery; + menu(options: Menu): JQuery; + menu(optionLiteral: string, options: Menu): JQuery; + menu(optionLiteral: string, optionName: string, optionValue: any): JQuery; + menu(optionLiteral: string, optionName: string): JQuery; - progressbar(options?: Progressbar): void; + progressbar(): JQuery; + progressbar(methodName: string): JQuery; + progressbar(options: Progressbar): JQuery; + progressbar(optionLiteral: string, options: Progressbar): JQuery; + progressbar(optionLiteral: string, optionName: string, optionValue: any): JQuery; + progressbar(optionLiteral: string, optionName: string): JQuery; - resizable(options?: Resizable): void; + resizable(): JQuery; + resizable(methodName: string): JQuery; + resizable(options: Resizable): JQuery; + resizable(optionLiteral: string, options: Resizable): JQuery; + resizable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + resizable(optionLiteral: string, optionName: string): JQuery; - selectable(options?: Selectable): void; + selectable(): JQuery; + selectable(methodName: string): JQuery; + selectable(options: Selectable): JQuery; + selectable(optionLiteral: string, options: Selectable): JQuery; + selectable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + selectable(optionLiteral: string, optionName: string): JQuery; - slider(options?: Slider): void; + slider(): JQuery; + slider(methodName: string): JQuery; + slider(options: Slider): JQuery; + slider(optionLiteral: string, options: Slider): JQuery; + slider(optionLiteral: string, optionName: string, optionValue: any): JQuery; + slider(optionLiteral: string, optionName: string): JQuery; - sortable(options?: Sortable): void; + sortable(): JQuery; + sortable(methodName: string): JQuery; + sortable(options: Sortable): JQuery; + sortable(optionLiteral: string, options: Sortable): JQuery; + sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; + sortable(optionLiteral: string, optionName: string): JQuery; - spinner(options?: Spinner): void; + spinner(): JQuery; + spinner(methodName: string): JQuery; + spinner(options: Spinner): JQuery; + spinner(optionLiteral: string, options: Spinner): JQuery; + spinner(optionLiteral: string, optionName: string, optionValue: any): JQuery; + spinner(optionLiteral: string, optionName: string): JQuery; - tabs(options?: Tabs): void; + tabs(): JQuery; + tabs(methodName: string): JQuery; + tabs(options: Tabs): JQuery; + tabs(optionLiteral: string, options: Tabs): JQuery; + tabs(optionLiteral: string, optionName: string, optionValue: any): JQuery; + tabs(optionLiteral: string, optionName: string): JQuery; - tooltip(options?: Tooltip): void; + tooltip(): JQuery; + tooltip(methodName: string): JQuery; + tooltip(options: Tooltip): JQuery; + tooltip(optionLiteral: string, options: Tooltip): JQuery; + tooltip(optionLiteral: string, optionName: string, optionValue: any): JQuery; + tooltip(optionLiteral: string, optionName: string): JQuery; } interface JQueryStatic { diff --git a/Tests/jqueryui-tests.ts b/Tests/jqueryui-tests.ts index 896b0f7a4..7ef12853a 100644 --- a/Tests/jqueryui-tests.ts +++ b/Tests/jqueryui-tests.ts @@ -2,440 +2,449 @@ declare var $: any; +function tests_draggable() { -// Draggable ////////////////////////////////////////////////// - -$("#draggable").draggable({ axis: "y" }); -$("#draggable2").draggable({ axis: "x" }); -$("#draggable3").draggable({ containment: "#containment-wrapper", scroll: false }); -$("#draggable5").draggable({ containment: "parent" }); -$("#draggable").draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } }); -$("#draggable2").draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } }); -$("#draggable3").draggable({ cursorAt: { bottom: 0 } }); -$("#draggable").draggable(); -$("#draggable").draggable({ distance: 20 }); -$("#draggable2").draggable({ delay: 1000 }); -$("#draggable").draggable({ - start: () => { }, - drag: () => { }, - stop: () => { } -}); -$("#draggable").draggable({ handle: "p" }); -$("#draggable2").draggable({ cancel: "p.ui-widget-header" }); -$("#draggable").draggable({ revert: true }); -$("#draggable2").draggable({ revert: true, helper: "clone" }); -$("#draggable").draggable({ scroll: true }); -$("#draggable2").draggable({ scroll: true, scrollSensitivity: 100 }); -$("#draggable3").draggable({ scroll: true, scrollSpeed: 100 }); -$("#draggable").draggable({ snap: true }); -$("#draggable2").draggable({ snap: ".ui-widget-header" }); -$("#draggable3").draggable({ snap: ".ui-widget-header", snapMode: "outer" }); -$("#draggable4").draggable({ grid: [20, 20] }); -$("#draggable5").draggable({ grid: [80, 80] }); -$("#sortable").sortable({ revert: true }); -$("#draggable").draggable({ - connectToSortable: "#sortable", - helper: "clone", - revert: "invalid" -}); -$("#draggable").draggable({ helper: "original" }); -$("#draggable2").draggable({ opacity: 0.7, helper: "clone" }); -$("#draggable3").draggable({ - cursor: "move", - cursorAt: { top: -12, left: -20 }, - helper: (event) => { return $("
I'm a custom helper
"); } -}); -$("#set div").draggable({ stack: "#set div" }); - - -// Droppable ////////////////////////////////////////////////// - -$( "#draggable, #draggable-nonvalid" ).draggable(); -$("#droppable").droppable({ - accept: "#draggable", - activeClass: "ui-state-hover", - hoverClass: "ui-state-active", - drop: (event, ui) => { - $(this) - .addClass("ui-state-highlight") - .find("p") - .html("Dropped!"); - } -}); -$( "#draggable" ).draggable(); -$("#droppable").droppable({ - drop: (event, ui) => { - $(this) - .addClass("ui-state-highlight") - .find("p") - .html("Dropped!"); - } -}); - -var $gallery = $( "#gallery" ), - $trash = $( "#trash" ); -$("li", $gallery).draggable({ - cancel: "a.ui-icon", - revert: "invalid", - containment: "document", - helper: "clone", - cursor: "move" -}); - -$trash.droppable({ - accept: "#gallery > li", - activeClass: "ui-state-highlight", - drop: ( event, ui ) => { } -}); - -$gallery.droppable({ - accept: "#trash li", - activeClass: "custom-state-active", - drop: ( event, ui ) => { } -}); - -var recycle_icon = "Recycle image"; -function deleteImage($item) { - $item.fadeOut(() => { - var $list = $("ul", $trash).length ? - $("ul", $trash) : - $("