Tests: Workaround a jQuery 1.8 issue with one dialog test

The test "#8958: dialog can be opened while opening" had special behavior in
jQuery 1.8 and the patch from commit 7adb13ac7c
broke those assumptions. Adjust the test so that it passes again.

Closes gh-2229
This commit is contained in:
Michał Gołębiowski-Owczarek 2024-04-12 15:22:05 +02:00 committed by GitHub
parent b4df487608
commit ab2a2a973e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -217,6 +217,8 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
var ready = assert.async( 3 ); var ready = assert.async( 3 );
assert.expect( 1 ); assert.expect( 1 );
var jQuery1Dot8 = jQuery.fn.jquery.indexOf( "1.8" ) === 0;
var element = $( "<div>" ).dialog( { var element = $( "<div>" ).dialog( {
autoOpen: false, autoOpen: false,
modal: true, modal: true,
@ -246,6 +248,15 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
// handle a call to the open() method during the process of the dialog // handle a call to the open() method during the process of the dialog
// being opened. // being opened.
.on( "blur", function() { .on( "blur", function() {
// Support: jQuery 1.8 only
// The test never fully worked in jQuery 1.8 since the input's blur
// handler never fired. It's only been uncovered when `ready()` calls
// have been added to all handlers. Skip this handler in jQuery 1.8.
if ( jQuery1Dot8 ) {
return;
}
element.dialog( "open" ); element.dialog( "open" );
// Detach the handlers to avoid firing them outside of this // Detach the handlers to avoid firing them outside of this
@ -255,6 +266,13 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
ready(); ready();
} ) } )
.trigger( "focus" ); .trigger( "focus" );
// Support: jQuery 1.8 only
// Account for the skipped `ready()` call above. To make sure the count
// is constant, call it here instead.
if ( jQuery1Dot8 ) {
ready();
}
} ); } );
QUnit.test( "#5531: dialog width should be at least minWidth on creation", function( assert ) { QUnit.test( "#5531: dialog width should be at least minWidth on creation", function( assert ) {