Skip to content

Commit

Permalink
Add the possibility to use '$( ".selector" ).dialog( "option", "zInde…
Browse files Browse the repository at this point in the history
…x", 3999 );', as noted in the docs on http://jqueryui.com/demos/dialog/ .
  • Loading branch information
PaulUithol committed May 19, 2011
1 parent 9d067d3 commit b4c5a46
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/unit/dialog/dialog_options.js
Expand Up @@ -441,4 +441,31 @@ test("width", function() {
el.remove();
});

test("zIndex", function() {
expect(6);

el = $('<div></div>').dialog( { autoOpen: false } );
equals(dlg().css( 'zIndex' ), 1000, "default zIndex");
el.dialog("open");
equals(dlg().css( 'zIndex' ), $.ui.dialog.maxZ, "default zIndex");
el.remove();

el = $('<div></div>').dialog();
equals(dlg().css( 'zIndex' ), $.ui.dialog.maxZ, "default zIndex");
el.remove();

// The z-index will always be 1 higher than requested if 'moveToTop' gets called, such as when 'autoOpen' is true.
el = $('<div></div>').dialog({zIndex: 2932 });
equals(dlg().css('zIndex'), 2932 + 1, "explicit zIndex");
el.dialog('option', 'zIndex', 1748);
equals(dlg().css('zIndex'), 1748, 'explicit zIndex after init');
el.remove();

// At the moment, an explicit zIndex option lower than $.ui.dialog.maxZ will be ignored since 'open' calls
// 'moveToTop'. Is this the desired behavior?
el = $('<div></div>').dialog({zIndex: 1584 });
equals(dlg().css('zIndex'), $.ui.dialog.maxZ, "explicit zIndex, lower than $.ui.dialog.maxZ, is ignored");
el.remove();
});

})(jQuery);
3 changes: 3 additions & 0 deletions ui/jquery.ui.dialog.js
Expand Up @@ -595,6 +595,9 @@ $.widget("ui.dialog", {
$( ".ui-dialog-title", self.uiDialogTitlebar )
.html( "" + ( value || "&#160;" ) );
break;
case "zIndex":
uiDialog.css({ zIndex: value });
break;
}

this._super( "_setOption", key, value );
Expand Down

0 comments on commit b4c5a46

Please sign in to comment.