Skip to content

Commit 91037d6

Browse files
authored
Tests: Accept a small difference of animated width/height
jQuery 3.2 & newer have a different animation logic and the animated elements width/height differ from the starting ones even at the beginning of the animation. The point of the assertions checking that they're identical was to ensure bug #5245 is fixed; that issue manifested by a big jump to half the element size. To test for that, it's enough to check that the first obtained values are close to the original ones. This makes effects tests pass in all supported jQuery versions. Closes jquerygh-1928 Ref #5245
1 parent b8ec78a commit 91037d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/unit/effects/core.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,10 @@ $.each( $.effects.effect, function( effect ) {
378378
assert.equal( test[ 0 ].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
379379
ready();
380380
} );
381-
assert.equal( test.width(), width, "Width is the same px after animation started" );
382-
assert.equal( test.height(), height, "Height is the same px after animation started" );
381+
assert.ok( Math.abs( test.width() - width ) / width < 0.05,
382+
"Width is close to the value when animation started" );
383+
assert.ok( Math.abs( test.height() - height ) / height < 0.05,
384+
"Height is close to the value when animation started" );
383385
} );
384386
} );
385387

0 commit comments

Comments
 (0)