diff options
author | Nate Eagle <nate.eagle@teamaol.com> | 2012-10-15 16:12:21 -0400 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-10-24 16:56:19 -0400 |
commit | 3829a37ca122e923c3a08b964c4b1a946a2a1456 (patch) | |
tree | 7427c153042537f62f3265764c8d8ec5686abcb2 /tests/unit | |
parent | 88bfb7572d888b2a835888281f19770361b318d7 (diff) | |
download | jquery-ui-3829a37ca122e923c3a08b964c4b1a946a2a1456.tar.gz jquery-ui-3829a37ca122e923c3a08b964c4b1a946a2a1456.zip |
Dialog: Awesome new stacking and overlay implementation. Fixes the following tickets:
Fixes #3534 - Dialog: Modal dialog disables all input elements on page.
Fixes #4671 - Dialog: Modal Dialog disables vertical scroll bar in Chrome & Safari.
Fixes #4995 - Dialog: Modal Dialog's overlay dissapears in IE when content is tall.
Fixes #5388 - Dialog: Don't change z-index when already at the top.
Fixes #5466 - Dialog: "modal" Dialog Incorrectly Cancels Input Events.
Fixes #5762 - Dialog: Get rid of z-index workaround, document it instead.
Fixes #6267 - Dialog: checkboxes that inherit a z-index < jqueryui.dialog z-index don't work.
Fixes #7051 - Dialog: modal prevents tab key from moving focus off slider handle.
Fixes #7107 - Dialog: Modal dialog event loss with high zindex child elements (FF 3.6).
Fixes #7120 - Dialog: Modal operation interrupts drag drop marker functionality on gmaps.
Fixes #8172 - Dialog: Change event cancelled when opening modal dialog from another modal dialog.
Fixes #8583 - Dialog: Mouse event wrongly stopped.
Fixes #8722 - Dialog: Remove stack option.
Fixes #8729 - Dialog: Remove zIndex option.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/dialog/dialog.html | 3 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_common.js | 1 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 42 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_tickets.js | 79 |
4 files changed, 28 insertions, 97 deletions
diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index d804807f2..5a7fc8fe5 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -52,7 +52,8 @@ <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture"> - + <div id="dialog1"></div> + <div id="dialog2"></div> </div> </body> </html> diff --git a/tests/unit/dialog/dialog_common.js b/tests/unit/dialog/dialog_common.js index 623908da7..d49f78a4b 100644 --- a/tests/unit/dialog/dialog_common.js +++ b/tests/unit/dialog/dialog_common.js @@ -26,7 +26,6 @@ TestHelpers.commonWidgetTests( "dialog", { stack: true, title: '', width: 300, - zIndex: 1000, // callbacks create: null diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 3c80a9bea..e7b2fc710 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -106,24 +106,30 @@ test("isOpen", function() { }); test("moveToTop", function() { - expect( 3 ); - - var d1, d2, dlg1, dlg2, - expected = $('<div></div>').dialog(), - actual = expected.dialog('moveToTop'); - equal(actual, expected, 'moveToTop is chainable'); - - d1 = $('<div></div>').dialog(); - dlg1 = d1.parents('.ui-dialog'); - d1.dialog('close'); - d1.dialog('open'); - d2 = $('<div></div>').dialog(); - dlg2 = d2.parents('.ui-dialog'); - d2.dialog('close'); - d2.dialog('open'); - ok(dlg1.css('zIndex') < dlg2.css('zIndex'), 'dialog 1 under dialog 2 before moveToTop method called'); - d1.dialog('moveToTop'); - ok(dlg1.css('zIndex') > dlg2.css('zIndex'), 'dialog 1 above dialog 2 after moveToTop method called'); + expect( 5 ); + function order() { + var actual = $( ".ui-dialog" ).map(function() { + return +$( this ).find( ".ui-dialog-content" ).attr( "id" ).replace( /\D+/, "" ); + }).get().reverse(); + deepEqual( actual, $.makeArray( arguments ) ); + } + var dialog1, dialog2, + focusOn = "dialog1"; + dialog1 = $( "#dialog1" ).dialog({ + focus: function() { + equal( focusOn, "dialog1" ); + } + }); + focusOn = "dialog2"; + dialog2 = $( "#dialog2" ).dialog({ + focus: function() { + equal( focusOn, "dialog2" ); + } + }); + order( 2, 1 ); + focusOn = "dialog1"; + dialog1.dialog( "moveToTop" ); + order( 1, 2 ); }); test("open", function() { diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index cf4ab0219..2b0214718 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -99,10 +99,10 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() { '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false}); d1.find('#b').prop( "checked", true ); - equal($('input:checked').val(), 'b', "checkbox b is checked"); + equal(d1.find('input:checked').val(), 'b', "checkbox b is checked"); d1.dialog('open'); - equal($('input:checked').val(), 'b', "checkbox b is checked"); + equal(d1.find('input:checked').val(), 'b', "checkbox b is checked"); d1.remove(); }); @@ -117,81 +117,6 @@ test("#6645: Missing element not found check in overlay", function(){ d1.add(d2).remove(); }); -test("#6966: Escape key closes all dialogs, not the top one", function(){ - expect(24); - // test with close function removing dialog triggered through the overlay - d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true, close: function(){ d1.remove(); }}); - d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }}); - - ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open'); - ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open'); - - $( document ).simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); - ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open'); - ok(!d2.data('dialog'), 'second dialog is closed'); - - $( document ).simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); - ok(!d1.data('dialog'), 'first dialog is closed'); - ok(!d2.data('dialog'), 'second dialog is closed'); - - d2.remove(); - d1.remove(); - - // test with close function removing dialog triggered through the dialog - d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true, close: function(){ d1.remove(); }}); - d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }}); - - ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open'); - ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open'); - - d2.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); - ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open'); - ok(!d2.data('dialog'), 'second dialog is closed'); - - d1.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); - ok(!d1.data('dialog'), 'first dialog is closed'); - ok(!d2.data('dialog'), 'second dialog is closed'); - - d2.remove(); - d1.remove(); - - // test without close function removing dialog - d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true}); - d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true}); - - ok(d1.dialog("isOpen"), 'first dialog is open'); - ok(d2.dialog("isOpen"), 'second dialog is open'); - - d2.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE}); - ok(d1.dialog("isOpen"), 'first dialog still open'); - ok(!d2.dialog("isOpen"), 'second dialog is closed'); - - d1.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE}); - ok(!d1.dialog("isOpen"), 'first dialog is closed'); - ok(!d2.dialog("isOpen"), 'second dialog is closed'); - - d2.remove(); - d1.remove(); - - // test without close function removing dialog triggered through the overlay - d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true}); - d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true}); - - ok(d1.dialog("isOpen"), 'first dialog is open'); - ok(d2.dialog("isOpen"), 'second dialog is open'); - - $( document ).simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE}); - ok(d1.dialog("isOpen"), 'first dialog still open'); - ok(!d2.dialog("isOpen"), 'second dialog is closed'); - - $( document ).simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE}); - ok(!d1.dialog("isOpen"), 'first dialog is closed'); - ok(!d2.dialog("isOpen"), 'second dialog is closed'); - - d2.remove(); - d1.remove(); -}); - test("#4980: Destroy should place element back in original DOM position", function(){ expect( 2 ); container = $('<div id="container"><div id="modal">Content</div></div>'); |