@@ -214,7 +214,7 @@ QUnit.test( "Ensure form elements don't reset when opening a dialog", function(
214214} ) ;
215215
216216QUnit . test ( "#8958: dialog can be opened while opening" , function ( assert ) {
217- var ready = assert . async ( ) ;
217+ var ready = assert . async ( 3 ) ;
218218 assert . expect ( 1 ) ;
219219
220220 var element = $ ( "<div>" ) . dialog ( {
@@ -227,7 +227,7 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
227227 } ) ;
228228
229229 // Support: IE8
230- // For some reason the #favorite-color input doesn't get focus if we don't
230+ // For some reason the #favorite-animal input doesn't get focus if we don't
231231 // focus the body first, causing the test to hang.
232232 $ ( "body" ) . trigger ( "focus" ) ;
233233
@@ -238,6 +238,7 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
238238 // the dialog to gain focus, thus blurring the input.
239239 . on ( "focus" , function ( ) {
240240 element . dialog ( "open" ) ;
241+ ready ( ) ;
241242 } )
242243
243244 // When the input blurs, the dialog is in the process of opening. We
@@ -246,6 +247,12 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
246247 // being opened.
247248 . on ( "blur" , function ( ) {
248249 element . dialog ( "open" ) ;
250+
251+ // Detach the handlers to avoid firing them outside of this
252+ // test logic; this may affect other tests.
253+ $ ( this ) . off ( "focus blur" ) ;
254+
255+ ready ( ) ;
249256 } )
250257 . trigger ( "focus" ) ;
251258} ) ;
0 commit comments