mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge pull request #220 from kzys/trac-6850
Fixed #6850 - Disable datepicker should disable month and year dropdowns.
This commit is contained in:
commit
caca915888
@ -102,16 +102,19 @@ test('enableDisable', function() {
|
|||||||
ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image now enabled');
|
ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image now enabled');
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl');
|
var inl = init('#inl', {changeYear: true});
|
||||||
var dp = $('.ui-datepicker-inline', inl);
|
var dp = $('.ui-datepicker-inline', inl);
|
||||||
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
|
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
|
||||||
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
|
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
|
||||||
|
ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled initially');
|
||||||
inl.datepicker('disable');
|
inl.datepicker('disable');
|
||||||
ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled');
|
ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled');
|
||||||
ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled');
|
ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled');
|
||||||
|
ok(dp.find('select').attr('disabled'), 'Enable/disable inline - form element disabled');
|
||||||
inl.datepicker('enable');
|
inl.datepicker('enable');
|
||||||
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled');
|
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled');
|
||||||
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled');
|
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled');
|
||||||
|
ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled');
|
||||||
inl.datepicker('destroy');
|
inl.datepicker('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
4
ui/jquery.ui.datepicker.js
vendored
4
ui/jquery.ui.datepicker.js
vendored
@ -364,6 +364,8 @@ $.extend(Datepicker.prototype, {
|
|||||||
else if (nodeName == 'div' || nodeName == 'span') {
|
else if (nodeName == 'div' || nodeName == 'span') {
|
||||||
var inline = $target.children('.' + this._inlineClass);
|
var inline = $target.children('.' + this._inlineClass);
|
||||||
inline.children().removeClass('ui-state-disabled');
|
inline.children().removeClass('ui-state-disabled');
|
||||||
|
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
|
||||||
|
removeAttr("disabled");
|
||||||
}
|
}
|
||||||
this._disabledInputs = $.map(this._disabledInputs,
|
this._disabledInputs = $.map(this._disabledInputs,
|
||||||
function(value) { return (value == target ? null : value); }); // delete entry
|
function(value) { return (value == target ? null : value); }); // delete entry
|
||||||
@ -387,6 +389,8 @@ $.extend(Datepicker.prototype, {
|
|||||||
else if (nodeName == 'div' || nodeName == 'span') {
|
else if (nodeName == 'div' || nodeName == 'span') {
|
||||||
var inline = $target.children('.' + this._inlineClass);
|
var inline = $target.children('.' + this._inlineClass);
|
||||||
inline.children().addClass('ui-state-disabled');
|
inline.children().addClass('ui-state-disabled');
|
||||||
|
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
|
||||||
|
attr("disabled", "disabled");
|
||||||
}
|
}
|
||||||
this._disabledInputs = $.map(this._disabledInputs,
|
this._disabledInputs = $.map(this._disabledInputs,
|
||||||
function(value) { return (value == target ? null : value); }); // delete entry
|
function(value) { return (value == target ? null : value); }); // delete entry
|
||||||
|
Loading…
Reference in New Issue
Block a user