@@ -214,7 +214,7 @@ QUnit.test( "Ensure form elements don't reset when opening a dialog", function(
214
214
} ) ;
215
215
216
216
QUnit . test ( "#8958: dialog can be opened while opening" , function ( assert ) {
217
- var ready = assert . async ( ) ;
217
+ var ready = assert . async ( 3 ) ;
218
218
assert . expect ( 1 ) ;
219
219
220
220
var element = $ ( "<div>" ) . dialog ( {
@@ -227,7 +227,7 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
227
227
} ) ;
228
228
229
229
// 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
231
231
// focus the body first, causing the test to hang.
232
232
$ ( "body" ) . trigger ( "focus" ) ;
233
233
@@ -238,6 +238,7 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
238
238
// the dialog to gain focus, thus blurring the input.
239
239
. on ( "focus" , function ( ) {
240
240
element . dialog ( "open" ) ;
241
+ ready ( ) ;
241
242
} )
242
243
243
244
// 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 ) {
246
247
// being opened.
247
248
. on ( "blur" , function ( ) {
248
249
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 ( ) ;
249
256
} )
250
257
. trigger ( "focus" ) ;
251
258
} ) ;
0 commit comments