Skip to content
Permalink
Browse files

dialog: fixed enable and disable methods

  • Loading branch information
rdworth committed Sep 19, 2009
1 parent 6f1b0d8 commit af178c00f160a38dbbaf2fba630ecf9c0ca5ec0b
Showing with 15 additions and 2 deletions.
  1. +10 −2 tests/unit/dialog/dialog_methods.js
  2. +5 −0 ui/jquery.ui.dialog.js
@@ -68,14 +68,22 @@ test("enable", function() {
var expected = $('<div></div>').dialog(),
actual = expected.dialog('enable');
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() {
var expected = $('<div></div>').dialog(),
actual = expected.dialog('disable');
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() {
@@ -442,6 +442,11 @@ $.widget("ui.dialog", {
.removeClass(self.options.dialogClass)
.addClass(uiDialogClasses + value);
break;
case "disabled":
(value
? uiDialog.addClass('ui-dialog-disabled')
: uiDialog.removeClass('ui-dialog-disabled'));
break;
case "draggable":
(value
? self._makeDraggable()

0 comments on commit af178c0

Please sign in to comment.
You can’t perform that action at this time.