Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the possibility to use '$( ".selector" ).dialog( "option", "zInde…

…x", 3999 );', as noted in the docs on http://jqueryui.com/demos/dialog/ .
  • Loading branch information...
commit 9ca8d935252be9226873ea7a5fff33b7b3717ad3 1 parent 70687f7
@PaulUithol authored
Showing with 30 additions and 0 deletions.
  1. +27 −0 tests/unit/dialog/dialog_options.js
  2. +3 −0  ui/jquery.ui.dialog.js
View
27 tests/unit/dialog/dialog_options.js
@@ -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);
View
3  ui/jquery.ui.dialog.js
@@ -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 );
Please sign in to comment.
Something went wrong with that request. Please try again.