From c158f5761a6a66b0ef6e7ee450ab721c80620d67 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Mon, 4 Apr 2016 01:07:14 +0300 Subject: [PATCH] Tests: do not run IE9 effect tests if inside testswarm That test doesn't work properly in such environment Ref e04e246552c27e872bbf4ae00b55def02b197189 Fixes gh-2888 Closes gh-3034 --- test/data/testinit.js | 9 ++++---- test/unit/effects.js | 49 +++++++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/test/data/testinit.js b/test/data/testinit.js index 073dc349f..dfae73d7c 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -293,9 +293,10 @@ this.iframeCallback = undefined; // Tests are always loaded async QUnit.config.autostart = false; this.loadTests = function() { + // Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode - var loadSwarm = ( QUnit.urlParams[ "swarmURL" ] + "" ).indexOf( "http" ) === 0, - basicTests = ( QUnit.urlParams[ "module" ] + "" ) === "basic"; + QUnit.isSwarm = ( QUnit.urlParams[ "swarmURL" ] + "" ).indexOf( "http" ) === 0; + QUnit.basicTests = ( QUnit.urlParams[ "module" ] + "" ) === "basic"; // Get testSubproject from testrunner first require( [ "data/testrunner.js" ], function() { @@ -335,7 +336,7 @@ this.loadTests = function() { var dep = tests[ i++ ]; if ( dep ) { - if ( !basicTests || i === 1 ) { + if ( !QUnit.basicTests || i === 1 ) { require( [ dep ], loadDep ); // Support: Android 2.3 only @@ -357,7 +358,7 @@ this.loadTests = function() { } // Load the TestSwarm listener if swarmURL is in the address. - if ( loadSwarm ) { + if ( QUnit.isSwarm ) { require( [ "http://swarm.jquery.org/js/inject.js?" + ( new Date() ).getTime() ], function() { QUnit.start(); diff --git a/test/unit/effects.js b/test/unit/effects.js index 653db6431..0f5eaa415 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -649,35 +649,44 @@ QUnit.test( "stop()", function( assert ) { this.clock.tick( 100 ); } ); -QUnit.test( "stop() - several in queue", function( assert ) { - assert.expect( 5 ); +// In IE9 inside testswarm this test doesn't work properly +( function() { + var type = "test"; - var nw, $foo = jQuery( "#foo" ); + if ( QUnit.isSwarm && /msie 9\.0/i.test( window.navigator.userAgent ) ) { + type = "skip"; + } - // default duration is 400ms, so 800px ensures we aren't 0 or 1 after 1ms - $foo.hide().css( "width", 800 ); + QUnit[ type ]( "stop() - several in queue", function( assert ) { + assert.expect( 5 ); - $foo.animate( { "width": "show" }, 400, "linear" ); - $foo.animate( { "width": "hide" } ); - $foo.animate( { "width": "show" } ); + var nw, $foo = jQuery( "#foo" ); - this.clock.tick( 1 ); + // default duration is 400ms, so 800px ensures we aren't 0 or 1 after 1ms + $foo.hide().css( "width", 800 ); - jQuery.fx.tick(); - assert.equal( $foo.queue().length, 3, "3 in the queue" ); + $foo.animate( { "width": "show" }, 400, "linear" ); + $foo.animate( { "width": "hide" } ); + $foo.animate( { "width": "show" } ); - nw = $foo.css( "width" ); - assert.notEqual( parseFloat( nw ), 1, "An animation occurred " + nw ); - $foo.stop(); + this.clock.tick( 1 ); - assert.equal( $foo.queue().length, 2, "2 in the queue" ); - nw = $foo.css( "width" ); - assert.notEqual( parseFloat( nw ), 1, "Stop didn't reset the animation " + nw ); + jQuery.fx.tick(); + assert.equal( $foo.queue().length, 3, "3 in the queue" ); - $foo.stop( true ); + nw = $foo.css( "width" ); + assert.notEqual( parseFloat( nw ), 1, "An animation occurred " + nw ); + $foo.stop(); - assert.equal( $foo.queue().length, 0, "0 in the queue" ); -} ); + assert.equal( $foo.queue().length, 2, "2 in the queue" ); + nw = $foo.css( "width" ); + assert.notEqual( parseFloat( nw ), 1, "Stop didn't reset the animation " + nw ); + + $foo.stop( true ); + + assert.equal( $foo.queue().length, 0, "0 in the queue" ); + } ); +} )(); QUnit.test( "stop(clearQueue)", function( assert ) { assert.expect( 4 ); -- 2.39.5