mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Fixed conflict between beforeShowDay and getDate
http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
This commit is contained in:
parent
b144b7644b
commit
f214b70889
@ -3,6 +3,27 @@
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
module("datepicker: tickets");
|
||||
module("datepicker: tickets", {
|
||||
teardown: function() {
|
||||
stop();
|
||||
setTimeout(start, 13);
|
||||
}
|
||||
});
|
||||
|
||||
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
|
||||
test('beforeShowDay-getDate', function() {
|
||||
var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }});
|
||||
var dp = $('#ui-datepicker-div');
|
||||
inp.val('01/01/2010').datepicker('show');
|
||||
equals($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
|
||||
$('a.ui-datepicker-next', dp).click();
|
||||
$('a.ui-datepicker-next', dp).click();
|
||||
equals($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks');
|
||||
inp.datepicker('hide').datepicker('show');
|
||||
$('a.ui-datepicker-prev', dp).click();
|
||||
$('a.ui-datepicker-prev', dp).click();
|
||||
equals($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks');
|
||||
inp.datepicker('hide');
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
7
ui/jquery.ui.datepicker.js
vendored
7
ui/jquery.ui.datepicker.js
vendored
@ -603,6 +603,7 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
var beforeShow = $.datepicker._get(inst, 'beforeShow');
|
||||
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
|
||||
inst.lastVal = null;
|
||||
$.datepicker._lastInput = input;
|
||||
$.datepicker._setDateFromField(inst);
|
||||
if ($.datepicker._inDialog) // hide cursor
|
||||
@ -1224,9 +1225,11 @@ $.extend(Datepicker.prototype, {
|
||||
|
||||
/* Parse existing date and initialise date picker. */
|
||||
_setDateFromField: function(inst, noDefault) {
|
||||
if (inst.input.val() == inst.lastVal) {
|
||||
return;
|
||||
}
|
||||
var dateFormat = this._get(inst, 'dateFormat');
|
||||
inst.lastVal = inst.input ? inst.input.val() : null;
|
||||
var dates = inst.lastVal;
|
||||
var dates = inst.lastVal = inst.input ? inst.input.val() : null;
|
||||
var date, defaultDate;
|
||||
date = defaultDate = this._getDefaultDate(inst);
|
||||
var settings = this._getFormatConfig(inst);
|
||||
|
Loading…
Reference in New Issue
Block a user