mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
dialog: fixed enable and disable methods
This commit is contained in:
parent
6f1b0d80be
commit
af178c00f1
@ -68,14 +68,22 @@ test("enable", function() {
|
|||||||
var expected = $('<div></div>').dialog(),
|
var expected = $('<div></div>').dialog(),
|
||||||
actual = expected.dialog('enable');
|
actual = expected.dialog('enable');
|
||||||
equals(actual, expected, 'enable is chainable');
|
equals(actual, expected, 'enable is chainable');
|
||||||
ok(false, 'missing test - untested code is broken code');
|
|
||||||
|
el = $('<div></div>').dialog({ disabled: true });
|
||||||
|
el.dialog('enable');
|
||||||
|
equals(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false');
|
||||||
|
ok(!el.parents('.ui-dialog').hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
var expected = $('<div></div>').dialog(),
|
var expected = $('<div></div>').dialog(),
|
||||||
actual = expected.dialog('disable');
|
actual = expected.dialog('disable');
|
||||||
equals(actual, expected, 'disable is chainable');
|
equals(actual, expected, 'disable is chainable');
|
||||||
ok(false, 'missing test - untested code is broken code');
|
|
||||||
|
el = $('<div></div>').dialog({ disabled: false });
|
||||||
|
el.dialog('disable');
|
||||||
|
equals(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true');
|
||||||
|
ok(el.parents('.ui-dialog').hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("close", function() {
|
test("close", function() {
|
||||||
|
5
ui/jquery.ui.dialog.js
vendored
5
ui/jquery.ui.dialog.js
vendored
@ -442,6 +442,11 @@ $.widget("ui.dialog", {
|
|||||||
.removeClass(self.options.dialogClass)
|
.removeClass(self.options.dialogClass)
|
||||||
.addClass(uiDialogClasses + value);
|
.addClass(uiDialogClasses + value);
|
||||||
break;
|
break;
|
||||||
|
case "disabled":
|
||||||
|
(value
|
||||||
|
? uiDialog.addClass('ui-dialog-disabled')
|
||||||
|
: uiDialog.removeClass('ui-dialog-disabled'));
|
||||||
|
break;
|
||||||
case "draggable":
|
case "draggable":
|
||||||
(value
|
(value
|
||||||
? self._makeDraggable()
|
? self._makeDraggable()
|
||||||
|
Loading…
Reference in New Issue
Block a user