Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Workaround a jQuery 1.8 issue with one draggable test #2227

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/unit/dialog/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
var ready = assert.async( 3 );
assert.expect( 1 );

var jQuery1Dot8 = jQuery.fn.jquery.indexOf( "1.8" ) === 0;

var element = $( "<div>" ).dialog( {
autoOpen: false,
modal: true,
Expand Down Expand Up @@ -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
// being opened.
.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" );

// Detach the handlers to avoid firing them outside of this
Expand All @@ -255,6 +266,13 @@ QUnit.test( "#8958: dialog can be opened while opening", function( assert ) {
ready();
} )
.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 ) {
Expand Down