diff --git a/Definitions/jqueryui-1.9.d.ts b/Definitions/jqueryui-1.9.d.ts index 9c0f841063..d55d03a1a8 100644 --- a/Definitions/jqueryui-1.9.d.ts +++ b/Definitions/jqueryui-1.9.d.ts @@ -7,26 +7,6 @@ /// -// Widget ////////////////////////////////////////////////// - -interface Widget { - - // Methods - destroy(); - disable(); - enable(); - option(optionName: string): any; - option(): any; - option(optionName: string, value: any): void; - option(options: any): void; - refresh(): void; - widget(): JQuery; - - // Events - create?: (event: Event, ui) => void; -} - - // Accordion ////////////////////////////////////////////////// interface AccordionOptions { @@ -718,6 +698,64 @@ interface TransferEffect { to?: string; } +interface JQueryPositionOptions { + my?: string; + at?: string; + of?: any; + collision?: string; + using?: Function; + within?: any; +} + + +// UI ////////////////////////////////////////////////// + +interface MouseOptions { + cancel?: string; + delay?: number; + distance?: number; +} + +interface UI { + mouse(method: string): JQuery; + mouse(options: MouseOptions): JQuery; + mouse(optionLiteral: string, optionName: string, optionValue: any): JQuery; + mouse(optionLiteral: string, optionValue: any): any; + + accordion: Accordion; + autocomplete: Autocomplete; + button: Button; + buttonset: Button; + datepicker: Datepicker; + dialog: Dialog; + menu: Menu; + progressbar: Progressbar; + slider: Slider; + spinner: Spinner; + tabs: Tabs; + tooltip: Tooltip; +} + + +// Widget ////////////////////////////////////////////////// + +interface WidgetOptions { + disabled?: bool; + hide?: any; + show?: any; +} + +interface Widget { + (methodName: string): JQuery; + (options: WidgetOptions): JQuery; + (options: AccordionOptions): JQuery; + (optionLiteral: string, optionName: string): any; + (optionLiteral: string, options: WidgetOptions): any; + (optionLiteral: string, optionName: string, optionValue: any): JQuery; + + (name: string, prototype: any): JQuery; + (name: string, base: Function, prototype: any): JQuery; +} //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -821,8 +859,6 @@ interface JQuery { sortable(optionLiteral: string, options: SortableOptions): any; sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - disableSelection(); - spinner(): JQuery; spinner(methodName: string): JQuery; spinner(options: SpinnerOptions): JQuery; @@ -879,8 +915,23 @@ interface JQuery { toggle(effect: string, options?: any, duration?: number, complete?: Function): JQuery; toggle(effect: string, options?: any, duration?: string, complete?: Function): JQuery; + enableSelection(): JQuery; + disableSelection(): JQuery; + focus(delay: number, callback?: Function): JQuery; + removeUniqueId(): JQuery; + scrollParent(): JQuery; + zIndex(): JQuery; + zIndex(zIndex: number): JQuery; + position(options: JQueryPositionOptions): JQuery; + + widget: Widget; + + jQuery: JQueryStatic; } interface JQueryStatic { + ui: UI; datepicker: JQueryDatePicker; + widget: Widget; + Widget: Widget; } \ No newline at end of file diff --git a/Tests/jqueryui-tests.ts b/Tests/jqueryui-tests.ts index 9267fc1f06..fba9d59326 100644 --- a/Tests/jqueryui-tests.ts +++ b/Tests/jqueryui-tests.ts @@ -755,7 +755,6 @@ function test_autocomplete() { $.Widget.prototype.destroy.call(this); } }); - $("#combobox").combobox(); $("#toggle").click(() => { $("#combobox").toggle(); }); $("#project").autocomplete({ minLength: 0, @@ -1505,8 +1504,55 @@ function test_effects() { collision: $("#collision_horizontal").val() + " " + $("#collision_vertical").val() }); $("#toggle").toggle({ effect: "scale", direction: "horizontal" }); - $(this).effect("transfer", { to: $("div").eq(i) }, 1000); - $( "div" ).hide( "drop", { direction: "down" }, "slow" ); - $( this ).switchClass( "big", "blue", 1000, "easeInOutQuad" ); - $( this ).toggleClass( "big-blue", 1000, "easeOutSine" ); + $(this).effect("transfer", { to: $("div").eq(5) }, 1000); + $("div").hide("drop", { direction: "down" }, "slow"); + $(this).switchClass("big", "blue", 1000, "easeInOutQuad"); + $(this).toggleClass("big-blue", 1000, "easeOutSine"); +} + +function test_methods() { + $('.selector').disableSelection(); + $("#position1").position({ + my: "center", + at: "center", + of: "#targetElement" + }); + $("#position2").position({ + my: "left top", + at: "left top", + of: "#targetElement" + }); + $("#position3").position({ + my: "right center", + at: "right bottom", + of: "#targetElement" + }); + $(document).mousemove(function (event) { + $("#position4").position({ + my: "left+3 bottom-3", + of: event, + collision: "fit" + }); + }); +} + +function test_ui() { + $(".selector").jQuery.ui.mouse({ cancel: ".title" }); + var cancel = $(".selector").jQuery.ui.mouse("option", "cancel"); + $(".selector").jQuery.ui.mouse("option", "cancel", ".title"); + $(".selector").jQuery.ui.mouse({ delay: 300 }); + $(".selector").jQuery.ui.mouse({ distance: 10 }); + $(".selector").jQuery.ui.mouse("_mouseCapture"); +} + +function test_widget() { + $(".selector").jQuery.Widget({ disabled: true }); + var disabled = $(".selector").jQuery.Widget("option", "disabled"); + $(".selector").jQuery.Widget("option", "disabled", true); + $(".selector").jQuery.Widget({ hide: { effect: "explode", duration: 1000 } }); + $(".selector").jQuery.Widget({ show: { effect: "blind", duration: 800 } }); + var options = $(".selector").jQuery.Widget("option"); + var isDisabled = $(".selector").jQuery.Widget("option", "disabled"); + $(".selector").jQuery.Widget("option", "disabled", true); + $(".selector").jQuery.Widget("option", { disabled: true }); } \ No newline at end of file