Skip to content
Permalink
Browse files

Tests: Solve a frequent race condition in tests in Chrome/Safari

Closes gh-1916
  • Loading branch information
mgol committed May 16, 2020
1 parent d37ebc6 commit 579bedd7d2e5849389c42fe1964ef6c86eab27d6
Showing with 10 additions and 4 deletions.
  1. +10 −4 tests/unit/sortable/options.js
@@ -372,17 +372,23 @@ test("{ placeholder: false }, default", function() {
QUnit.test( "{ placeholder: false } img", function( assert ) {
assert.expect( 3 );

var element = $( "#sortable-images" ).sortable( {
var done = assert.async(),
element = $( "#sortable-images" ).sortable( {
start: function( event, ui ) {
assert.ok( ui.placeholder.attr( "src" ).indexOf( "images/jqueryui_32x32.png" ) > 0, "placeholder img has correct src" );
assert.equal( ui.placeholder.height(), 32, "placeholder has correct height" );
assert.equal( ui.placeholder.width(), 32, "placeholder has correct width" );
}
} );

element.find( "img" ).eq( 0 ).simulate( "drag", {
dy: 1
} );
// Give browsers some time to load the image if cache is disabled.
// This resolves a frequent issue in Chrome/Safari.
setTimeout( function() {
element.find( "img" ).eq( 0 ).simulate( "drag", {
dy: 1
} );
done();
}, 500 );
} );

QUnit.test( "{ placeholder: String }", function( assert ) {

0 comments on commit 579bedd

Please sign in to comment.
You can’t perform that action at this time.