Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#2100 from johnnyreilly/master
Browse files Browse the repository at this point in the history
jQueryUI: Tidy up and up to gotoCurrent
  • Loading branch information
johnnyreilly committed Apr 25, 2014
2 parents b26a443 + 4d233b7 commit 1c1c12e
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 20 deletions.
27 changes: 27 additions & 0 deletions jqueryui/jqueryui-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,33 @@ function test_datepicker() {
$set = $(".selector").datepicker("option", "defaultDate", new Date());
$set = $(".selector").datepicker("option", "defaultDate", "+1m +7d");
}

function duration() {
$(".selector").datepicker({ duration: "slow" });

var duration: string = $(".selector").datepicker("option", "duration");

// setter
var $set: JQuery = $(".selector").datepicker("option", "duration", "slow");
}

function firstDay() {
$(".selector").datepicker({ firstDay: 1 });

var firstDay: number = $(".selector").datepicker("option", "firstDay");

// setter
var $set: JQuery = $(".selector").datepicker("option", "firstDay", 1);
}

function gotoCurrent() {
$(".selector").datepicker({ gotoCurrent: true });

var gotoCurrent: boolean = $(".selector").datepicker("option", "gotoCurrent");

// setter
var $set: JQuery = $(".selector").datepicker("option", "gotoCurrent", true);
}
}


Expand Down
88 changes: 68 additions & 20 deletions jqueryui/jqueryui.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1278,14 +1278,14 @@ interface JQuery {
* Get the calculateWeek option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'calculateWeek'
*/
datepicker(methodName: 'option', optionName: 'calculateWeek'): (date: Date) => string;
/**
* Set the calculateWeek option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'calculateWeek'
* @param calculateWeekValue A function to calculate the week of the year for a given date. The default implementation uses the ISO 8601 definition: weeks start on a Monday; the first week of the year contains the first Thursday of the year.
*/
datepicker(methodName: 'option', optionName: 'calculateWeek', calculateWeekValue: (date: Date) => string): JQuery;
Expand All @@ -1294,14 +1294,14 @@ interface JQuery {
* Get the changeMonth option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'changeMonth'
*/
datepicker(methodName: 'option', optionName: 'changeMonth'): boolean;
/**
* Set the changeMonth option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'changeMonth'
* @param changeMonthValue Whether the month should be rendered as a dropdown instead of text.
*/
datepicker(methodName: 'option', optionName: 'changeMonth', changeMonthValue: boolean): JQuery;
Expand All @@ -1310,14 +1310,14 @@ interface JQuery {
* Get the changeYear option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'changeYear'
*/
datepicker(methodName: 'option', optionName: 'changeYear'): boolean;
/**
* Set the changeYear option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'changeYear'
* @param changeYearValue Whether the year should be rendered as a dropdown instead of text. Use the yearRange option to control which years are made available for selection.
*/
datepicker(methodName: 'option', optionName: 'changeYear', changeYearValue: boolean): JQuery;
Expand All @@ -1326,14 +1326,14 @@ interface JQuery {
* Get the closeText option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'closeText'
*/
datepicker(methodName: 'option', optionName: 'closeText'): string;
/**
* Set the closeText option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'closeText'
* @param closeTextValue The text to display for the close link. Use the showButtonPanel option to display this button.
*/
datepicker(methodName: 'option', optionName: 'closeText', closeTextValue: string): JQuery;
Expand All @@ -1342,14 +1342,14 @@ interface JQuery {
* Get the constrainInput option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'constrainInput'
*/
datepicker(methodName: 'option', optionName: 'constrainInput'): boolean;
/**
* Set the constrainInput option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'constrainInput'
* @param constrainInputValue When true, entry in the input field is constrained to those characters allowed by the current dateFormat option.
*/
datepicker(methodName: 'option', optionName: 'constrainInput', constrainInputValue: boolean): JQuery;
Expand All @@ -1358,14 +1358,14 @@ interface JQuery {
* Get the currentText option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'currentText'
*/
datepicker(methodName: 'option', optionName: 'currentText'): string;
/**
* Set the currentText option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'currentText'
* @param currentTextValue The text to display for the current day link. Use the showButtonPanel option to display this button.
*/
datepicker(methodName: 'option', optionName: 'currentText', currentTextValue: string): JQuery;
Expand All @@ -1374,14 +1374,14 @@ interface JQuery {
* Get the dateFormat option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dateFormat'
*/
datepicker(methodName: 'option', optionName: 'dateFormat'): string;
/**
* Set the dateFormat option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dateFormat'
* @param dateFormatValue The format for parsed and displayed dates. For a full list of the possible formats see the formatDate function.
*/
datepicker(methodName: 'option', optionName: 'dateFormat', dateFormatValue: string): JQuery;
Expand All @@ -1390,14 +1390,14 @@ interface JQuery {
* Get the dayNames option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNames'
*/
datepicker(methodName: 'option', optionName: 'dayNames'): string[];
/**
* Set the dayNames option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNames'
* @param dayNamesValue The list of long day names, starting from Sunday, for use as requested via the dateFormat option.
*/
datepicker(methodName: 'option', optionName: 'dayNames', dayNamesValue: string[]): JQuery;
Expand All @@ -1406,14 +1406,14 @@ interface JQuery {
* Get the dayNamesMin option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNamesMin'
*/
datepicker(methodName: 'option', optionName: 'dayNamesMin'): string[];
/**
* Set the dayNamesMin option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNamesMin'
* @param dayNamesMinValue The list of minimised day names, starting from Sunday, for use as column headers within the datepicker.
*/
datepicker(methodName: 'option', optionName: 'dayNamesMin', dayNamesMinValue: string[]): JQuery;
Expand All @@ -1422,14 +1422,14 @@ interface JQuery {
* Get the dayNamesShort option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNamesShort'
*/
datepicker(methodName: 'option', optionName: 'dayNamesShort'): string[];
/**
* Set the dayNamesShort option, after initialization
*
* @param methodName 'option'
* @param optionName 'buttonText'
* @param optionName 'dayNamesShort'
* @param dayNamesShortValue The list of abbreviated day names, starting from Sunday, for use as requested via the dateFormat option.
*/
datepicker(methodName: 'option', optionName: 'dayNamesShort', dayNamesShortValue: string[]): JQuery;
Expand Down Expand Up @@ -1466,6 +1466,54 @@ interface JQuery {
*/
datepicker(methodName: 'option', optionName: 'defaultDate', defaultDateValue: string): JQuery;

/**
* Get the duration option, after initialization
*
* @param methodName 'option'
* @param optionName 'duration'
*/
datepicker(methodName: 'option', optionName: 'duration'): string;
/**
* Set the duration option, after initialization
*
* @param methodName 'option'
* @param optionName 'duration'
* @param durationValue Control the speed at which the datepicker appears, it may be a time in milliseconds or a string representing one of the three predefined speeds ("slow", "normal", "fast").
*/
datepicker(methodName: 'option', optionName: 'duration', durationValue: string): JQuery;

/**
* Get the firstDay option, after initialization
*
* @param methodName 'option'
* @param optionName 'firstDay'
*/
datepicker(methodName: 'option', optionName: 'firstDay'): number;
/**
* Set the firstDay option, after initialization
*
* @param methodName 'option'
* @param optionName 'firstDay'
* @param firstDayValue Set the first day of the week: Sunday is 0, Monday is 1, etc.
*/
datepicker(methodName: 'option', optionName: 'firstDay', firstDayValue: number): JQuery;

/**
* Get the gotoCurrent option, after initialization
*
* @param methodName 'option'
* @param optionName 'gotoCurrent'
*/
datepicker(methodName: 'option', optionName: 'gotoCurrent'): boolean;
/**
* Set the gotoCurrent option, after initialization
*
* @param methodName 'option'
* @param optionName 'gotoCurrent'
* @param gotoCurrentValue When true, the current day link moves to the currently selected date instead of today.
*/
datepicker(methodName: 'option', optionName: 'gotoCurrent', gotoCurrentValue: boolean): JQuery;

/**
* Gets the value currently associated with the specified optionName.
*
Expand Down

0 comments on commit 1c1c12e

Please sign in to comment.