mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Removed broken disabled option from dialog, defuse disable/enable methods. Disabling dialogs is not supported.
This commit is contained in:
parent
92b8a41164
commit
6dccd917c3
@ -47,32 +47,12 @@ test("destroy", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test( "enable/disable disabled", function() {
|
||||||
expect( 3 );
|
expect( 2 );
|
||||||
|
var el = $( "<div></div>" ).dialog();
|
||||||
var el,
|
el.dialog( "disable" );
|
||||||
expected = $('<div></div>').dialog(),
|
equal(el.dialog( "option", "disabled" ), false, "disable method doesn't do anything" );
|
||||||
actual = expected.dialog('enable');
|
ok( !el.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" );
|
||||||
equal(actual, expected, 'enable is chainable');
|
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ disabled: true });
|
|
||||||
el.dialog('enable');
|
|
||||||
equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false');
|
|
||||||
ok(!el.dialog('widget').hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element');
|
|
||||||
});
|
|
||||||
|
|
||||||
test("disable", function() {
|
|
||||||
expect( 3 );
|
|
||||||
|
|
||||||
var el,
|
|
||||||
expected = $('<div></div>').dialog(),
|
|
||||||
actual = expected.dialog('disable');
|
|
||||||
equal(actual, expected, 'disable is chainable');
|
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ disabled: false });
|
|
||||||
el.dialog('disable');
|
|
||||||
equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true');
|
|
||||||
ok(el.dialog('widget').hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("close", function() {
|
test("close", function() {
|
||||||
|
7
ui/jquery.ui.dialog.js
vendored
7
ui/jquery.ui.dialog.js
vendored
@ -152,6 +152,9 @@ $.widget("ui.dialog", {
|
|||||||
return this.uiDialog;
|
return this.uiDialog;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disable: $.noop,
|
||||||
|
enable: $.noop,
|
||||||
|
|
||||||
close: function( event ) {
|
close: function( event ) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
@ -578,6 +581,10 @@ $.widget("ui.dialog", {
|
|||||||
.addClass( value );
|
.addClass( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( key === "disabled" ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._super( key, value );
|
this._super( key, value );
|
||||||
|
|
||||||
if ( key === "buttons" ) {
|
if ( key === "buttons" ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user