update easing tests for jQuery and jQueryUI

This commit is contained in:
error
2016-01-08 14:36:01 -06:00
parent e0078362c7
commit c44772fa6a
2 changed files with 48 additions and 25 deletions
+38 -17
View File
@@ -1820,22 +1820,43 @@ function test_widget() {
}
function test_easing() {
var easing = jQuery.easing,
easing_fns = ["easeInQuad", "easeOutQuad", "easeInOutQuad",
"easeInCubic", "easeOutCubic", "easeInOutCubic",
"easeInQuart", "easeOutQuart", "easeInOutQuart",
"easeInQuint", "easeOutQuint", "easeInOutQuint",
"easeInExpo", "easeOutExpo", "easeInOutExpo",
"easeInSine", "easeOutSine", "easeInOutSine",
"easeInCirc", "easeOutCirc", "easeInOutCirc",
"easeInElastic", "easeOutElastic", "easeInOutElastic",
"easeInBack", "easeOutBack", "easeInOutBack",
"easeInBounce", "easeOutBounce", "easeInOutBounce"],
step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error
easing_fns.forEach( function( name ) {
var fn = easing[ name ];
for( var i = 0; i <= 1; i += step ) {
console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) );
const easing = jQuery.easing;
function test_easing_function( name: string, fn: JQueryEasingFunction ) {
const step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error
for( let i = 0; i <= 1; i += step ) {
console.log( `$.easing.${name}(${i}): ${fn.call(easing, i)}` );
}
} );
}
test_easing_function("easeInQuad", easing.easeInQuad);
test_easing_function("easeOutQuad", easing.easeOutQuad);
test_easing_function("easeInOutQuad", easing.easeInOutQuad);
test_easing_function("easeInCubic", easing.easeInCubic);
test_easing_function("easeOutCubic", easing.easeOutCubic);
test_easing_function("easeInOutCubic", easing.easeInOutCubic);
test_easing_function("easeInQuart", easing.easeInQuart);
test_easing_function("easeOutQuart", easing.easeOutQuart);
test_easing_function("easeInOutQuart", easing.easeInOutQuart);
test_easing_function("easeInQuint", easing.easeInQuint);
test_easing_function("easeOutQuint", easing.easeOutQuint);
test_easing_function("easeInOutQuint", easing.easeInOutQuint);
test_easing_function("easeInExpo", easing.easeInExpo);
test_easing_function("easeOutExpo", easing.easeOutExpo);
test_easing_function("easeInOutExpo", easing.easeInOutExpo);
test_easing_function("easeInSine", easing.easeInSine);
test_easing_function("easeOutSine", easing.easeOutSine);
test_easing_function("easeInOutSine", easing.easeInOutSine);
test_easing_function("easeInCirc", easing.easeInCirc);
test_easing_function("easeOutCirc", easing.easeOutCirc);
test_easing_function("easeInOutCirc", easing.easeInOutCirc);
test_easing_function("easeInElastic", easing.easeInElastic);
test_easing_function("easeOutElastic", easing.easeOutElastic);
test_easing_function("easeInOutElastic", easing.easeInOutElastic);
test_easing_function("easeInBack", easing.easeInBack);
test_easing_function("easeOutBack", easing.easeOutBack);
test_easing_function("easeInOutBack", easing.easeInOutBack);
test_easing_function("easeInBounce", easing.easeInBounce);
test_easing_function("easeOutBounce", easing.easeOutBounce);
test_easing_function("easeInOutBounce", easing.easeInOutBounce);
}