aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2020-05-16 08:28:26 +0200
committerGitHub <noreply@github.com>2020-05-16 08:28:26 +0200
commit579bedd7d2e5849389c42fe1964ef6c86eab27d6 (patch)
tree5c0e16eb31f76c21471ed160668a82d26c054ff3
parentd37ebc624da1432bd58e5131805a821e163277ce (diff)
downloadjquery-ui-579bedd7d2e5849389c42fe1964ef6c86eab27d6.tar.gz
jquery-ui-579bedd7d2e5849389c42fe1964ef6c86eab27d6.zip
Tests: Solve a frequent race condition in tests in Chrome/Safari
Closes gh-1916
-rw-r--r--tests/unit/sortable/options.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/unit/sortable/options.js b/tests/unit/sortable/options.js
index d157d2b77..029b442be 100644
--- a/tests/unit/sortable/options.js
+++ b/tests/unit/sortable/options.js
@@ -372,7 +372,8 @@ 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" );
@@ -380,9 +381,14 @@ QUnit.test( "{ placeholder: false } img", function( assert ) {
}
} );
- 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 ) {