]> source.dussan.org Git - jquery.git/commitdiff
Effects: fix failing tests in IE8
authorTimmy Willison <timmywillisn@gmail.com>
Wed, 8 Jul 2015 17:31:09 +0000 (13:31 -0400)
committerTimmy Willison <timmywillisn@gmail.com>
Wed, 8 Jul 2015 17:31:09 +0000 (13:31 -0400)
test/unit/animation.js
test/unit/tween.js

index 6bb070145eac273b3f4fd364a015dc19af352935..3aae7eab1c632059ac6538925f8570518e91a845 100644 (file)
@@ -17,15 +17,16 @@ module( "animation", {
                this.sandbox = sinon.sandbox.create();
                this.clock = this.sandbox.useFakeTimers( startTime );
                this._oldInterval = jQuery.fx.interval;
+               this._oldNow = jQuery.now;
                jQuery.fx.step = {};
                jQuery.fx.interval = 10;
-               jQuery.now = Date.now;
+               jQuery.now = Date.now || this._oldNow;
                jQuery.Animation.prefilters = [ defaultPrefilter ];
                jQuery.Animation.tweeners = { "*": [ defaultTweener ] };
        },
        teardown: function() {
                this.sandbox.restore();
-               jQuery.now = Date.now;
+               jQuery.now = this._oldNow;
                jQuery.fx.stop();
                jQuery.fx.interval = this._oldInterval;
                window.requestAnimationFrame = oldRaf;
index 39894c57573467097d65ab0718105ef07de231c8..7d806fe6b14e795cc43fe80630c0ed424d54a9ef 100644 (file)
@@ -13,13 +13,14 @@ module( "tween", {
                this.sandbox = sinon.sandbox.create();
                this.clock = this.sandbox.useFakeTimers( 505877050 );
                this._oldInterval = jQuery.fx.interval;
+               this._oldNow = jQuery.now;
                jQuery.fx.step = {};
                jQuery.fx.interval = 10;
-               jQuery.now = Date.now;
+               jQuery.now = Date.now || this._oldNow;
        },
        teardown: function() {
                this.sandbox.restore();
-               jQuery.now = Date.now;
+               jQuery.now = this._oldNow;
                jQuery.fx.stop();
                jQuery.fx.interval = this._oldInterval;
                window.requestAnimationFrame = oldRaf;
@@ -198,7 +199,7 @@ test( "jQuery.Tween - Element", function() {
 
        ok( easingSpy.calledWith( 0.1, 0.1 * testOptions.duration, 0, 1, testOptions.duration ),
                "...using jQuery.easing.linear with back-compat arguments" );
-       equal( parseFloat( testElement.style.height ).toFixed( 2 ), eased.toFixed( 2 ), "Set value" );
+       equal( Math.floor( parseFloat( testElement.style.height ) ), Math.floor( eased ), "Set value" );
 
        tween.run( 1 );
        equal( testElement.style.height, "0px", "Checking another value" );