diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 6f39f7b8afd..55da8c8f591 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -22,7 +22,6 @@ "ui/button.js", "ui/effect.js", "ui/effect-blind.js", - "ui/effect-clip.js", "ui/effect-explode.js", "ui/dialog.js" ] diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index d72fef7b5bf..56f1e3da8e7 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -59,90 +59,94 @@ asyncTest( "focus tabbable", function() { element = $( markup ).dialog( options ); setTimeout(function() { - testFn(); - element.remove(); - setTimeout( next ); + testFn(function done() { + element.remove(); + setTimeout( next ); + }); }); } function step1() { - element = $( "
" ).dialog( options ); - setTimeout(function() { + checkFocus( "
", options, function( done ) { var input = element.find( "input:last" ).focus().blur(); element.dialog( "instance" )._focusTabbable(); setTimeout(function() { equal( document.activeElement, input[ 0 ], "1. an element that was focused previously." ); - element.remove(); - setTimeout( step2 ); + done(); }); - }); + }, step2 ); } function step2() { - checkFocus( "
", options, function() { + checkFocus( "
", options, function( done ) { equal( document.activeElement, element.find( "input" )[ 1 ], "2. first element inside the dialog matching [autofocus]" ); + done(); }, step3 ); } function step3() { - checkFocus( "
", options, function() { + checkFocus( "
", options, function( done ) { equal( document.activeElement, element.find( "input" )[ 0 ], "3. tabbable element inside the content element" ); + done(); }, step4 ); } function step4() { - checkFocus( "
text
", options, function() { + checkFocus( "
text
", options, function( done ) { equal( document.activeElement, element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ], "4. tabbable element inside the buttonpane" ); + done(); }, step5 ); } function step5() { - checkFocus( "
text
", {}, function() { + checkFocus( "
text
", {}, function( done ) { equal( document.activeElement, element.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ], "5. the close button" ); + done(); }, step6 ); } function step6() { - element = $( "
text
" ).dialog({ - autoOpen: false - }); - element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide(); - element.dialog( "open" ); - setTimeout(function() { - equal( document.activeElement, element.parent()[ 0 ], "6. the dialog itself" ); - element.remove(); - setTimeout( step7 ); - }); + checkFocus( "
text
", { autoOpen: false }, function( done ) { + element.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide(); + element.dialog( "open" ); + setTimeout(function() { + equal( document.activeElement, element.parent()[ 0 ], "6. the dialog itself" ); + done(); + }); + }, step7 ); } function step7() { - element = $( "
" ).dialog({ - open: function() { - var inputs = $( this ).find( "input" ); - inputs.last().keydown(function( event ) { - event.preventDefault(); - inputs.first().focus(); - }); - } - }); - setTimeout(function() { - var inputs = element.find( "input" ); - equal( document.activeElement, inputs[ 1 ], "Focus starts on second input" ); - inputs.last().simulate( "keydown", { keyCode: $.ui.keyCode.TAB }); - setTimeout(function() { - equal( document.activeElement, inputs[ 0 ], - "Honor preventDefault, allowing custom focus management" ); - element.remove(); - start(); - }, 50 ); - }); + checkFocus( + "
", + { + open: function() { + var inputs = $( this ).find( "input" ); + inputs.last().keydown(function( event ) { + event.preventDefault(); + inputs.first().focus(); + }); + } + }, + function( done ) { + var inputs = element.find( "input" ); + equal( document.activeElement, inputs[ 1 ], "Focus starts on second input" ); + inputs.last().simulate( "keydown", { keyCode: $.ui.keyCode.TAB }); + setTimeout(function() { + equal( document.activeElement, inputs[ 0 ], + "Honor preventDefault, allowing custom focus management" ); + done(); + }, 50 ); + }, + start + ); } step1(); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 3e5444c67e2..6bab426fbbe 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -283,15 +283,6 @@ test("height", function() { element.remove(); }); -asyncTest( "hide, #5860 - don't leave effects wrapper behind", function() { - expect( 1 ); - $( "#dialog1" ).dialog({ hide: "clip" }).dialog( "close" ).dialog( "destroy" ); - setTimeout(function() { - equal( $( ".ui-effects-wrapper" ).length, 0 ); - start(); - }, 500); -}); - test("maxHeight", function() { expect(3); diff --git a/ui/dialog.js b/ui/dialog.js index 0775fbe8df9..166f68b0f44 100644 --- a/ui/dialog.js +++ b/ui/dialog.js @@ -168,7 +168,7 @@ return $.widget( "ui.dialog", { // Without detaching first, the following becomes really slow .detach(); - this.uiDialog.stop( true, true ).remove(); + this.uiDialog.remove(); if ( this.originalTitle ) { this.element.attr( "title", this.originalTitle );