From 3458bc6328c6a674eb0ec6f3475e262865bf9f15 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 16 Apr 2014 17:25:58 +0100 Subject: [PATCH] jQuery UI: button option getters / setters --- jqueryui/jqueryui-tests.ts | 29 ++++++++++++++++++++++ jqueryui/jqueryui.d.ts | 50 +++++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 987b48c4f..dc3e80856 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1194,6 +1194,35 @@ function test_datepicker() { // setter var $set: JQuery = $(".selector").datepicker("option", "autoSize", true); } + + function buttonImage() { + $(".selector").datepicker({ buttonImage: "/images/datepicker.gif" }); + + // getter + var buttonImage: string = $(".selector").datepicker("option", "buttonImage"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonImage", "/images/datepicker.gif"); + } + + function buttonImageOnly() { + $(".selector").datepicker({ buttonImageOnly: true }); + + // getter + var buttonImageOnly: boolean = $(".selector").datepicker("option", "buttonImageOnly"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonImageOnly", true); + } + + function buttonText() { + $(".selector").datepicker({ buttonText: "Choose" }); + + var buttonText: string = $(".selector").datepicker("option", "buttonText"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonText", "Choose"); + } } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index e2b6d1fb8..52b9169e4 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1016,7 +1016,55 @@ interface JQuery { * @param optionName 'autoSize' * @param autoSizeValue Set to true to automatically resize the input field to accommodate dates in the current dateFormat. */ - datepicker(methodName: 'option', optionName: 'autoSize', autoSizeValue: string): JQuery; + datepicker(methodName: 'option', optionName: 'autoSize', autoSizeValue: boolean): JQuery; + + /** + * Get the buttonImage option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImage' + */ + datepicker(methodName: 'option', optionName: 'buttonImage'): string; + /** + * Set the buttonImage option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImage' + * @param buttonImageValue A URL of an image to use to display the datepicker when the showOn option is set to "button" or "both". If set, the buttonText option becomes the alt value and is not directly displayed. + */ + datepicker(methodName: 'option', optionName: 'buttonImage', buttonImageValue: string): JQuery; + + /** + * Get the buttonImageOnly option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImageOnly' + */ + datepicker(methodName: 'option', optionName: 'buttonImageOnly'): boolean; + /** + * Set the buttonImageOnly option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImageOnly' + * @param buttonImageOnlyValue Whether the button image should be rendered by itself instead of inside a button element. This option is only relevant if the buttonImage option has also been set. + */ + datepicker(methodName: 'option', optionName: 'buttonImageOnly', buttonImageOnlyValue: boolean): JQuery; + + /** + * Get the buttonText option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonText' + */ + datepicker(methodName: 'option', optionName: 'buttonText'): string; + /** + * Set the buttonText option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonText' + * @param buttonTextValue The text to display on the trigger button. Use in conjunction with the showOn option set to "button" or "both". + */ + datepicker(methodName: 'option', optionName: 'buttonText', buttonTextValue: string): JQuery; /** * Gets the value currently associated with the specified optionName.