aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/effects.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-05-05 10:24:20 -0700
committerTimmy Willison <timmywillisn@gmail.com>2015-05-05 10:24:20 -0700
commit5f2ea402582c7b8f4773771e1529d60587f3435e (patch)
tree1402dffc1deed7ec0074882ed9712f27fb2ef9f4 /test/unit/effects.js
parent436f0aee0a4c37ecb61b87a3a44227f6f5153b3a (diff)
downloadjquery-5f2ea402582c7b8f4773771e1529d60587f3435e.tar.gz
jquery-5f2ea402582c7b8f4773771e1529d60587f3435e.zip
Effects: set default easing using jQuery.easing._default
Fixes gh-2219 Close gh-2218
Diffstat (limited to 'test/unit/effects.js')
-rw-r--r--test/unit/effects.js50
1 files changed, 35 insertions, 15 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 99faa1438..39e10d10c 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -1178,45 +1178,45 @@ test("animate with per-property easing", function(){
test("animate with CSS shorthand properties", function(){
expect(11);
- var _default_count = 0,
- _special_count = 0,
+ var easeAnimation_count = 0,
+ easeProperty_count = 0,
propsBasic = { "padding": "10 20 30" },
- propsSpecial = { "padding": [ "1 2 3", "_special" ] };
+ propsSpecial = { "padding": [ "1 2 3", "propertyScope" ] };
- jQuery.easing._default = function(p) {
+ jQuery.easing.animationScope = function(p) {
if ( p >= 1 ) {
- _default_count++;
+ easeAnimation_count++;
}
return p;
};
- jQuery.easing._special = function(p) {
+ jQuery.easing.propertyScope = function(p) {
if ( p >= 1 ) {
- _special_count++;
+ easeProperty_count++;
}
return p;
};
jQuery("#foo")
- .animate( propsBasic, 200, "_default", function() {
+ .animate( propsBasic, 200, "animationScope", function() {
equal( this.style.paddingTop, "10px", "padding-top was animated" );
equal( this.style.paddingLeft, "20px", "padding-left was animated" );
equal( this.style.paddingRight, "20px", "padding-right was animated" );
equal( this.style.paddingBottom, "30px", "padding-bottom was animated" );
- equal( _default_count, 4, "per-animation default easing called for each property" );
- _default_count = 0;
+ equal( easeAnimation_count, 4, "per-animation default easing called for each property" );
+ easeAnimation_count = 0;
})
- .animate( propsSpecial, 200, "_default", function() {
+ .animate( propsSpecial, 200, "animationScope", function() {
equal( this.style.paddingTop, "1px", "padding-top was animated again" );
equal( this.style.paddingLeft, "2px", "padding-left was animated again" );
equal( this.style.paddingRight, "2px", "padding-right was animated again" );
equal( this.style.paddingBottom, "3px", "padding-bottom was animated again" );
- equal( _default_count, 0, "per-animation default easing not called" );
- equal( _special_count, 4, "special easing called for each property" );
+ equal( easeAnimation_count, 0, "per-animation default easing not called" );
+ equal( easeProperty_count, 4, "special easing called for each property" );
jQuery(this).css("padding", "0");
- delete jQuery.easing._default;
- delete jQuery.easing._special;
+ delete jQuery.easing.animationScope;
+ delete jQuery.easing.propertyScope;
});
this.clock.tick( 400 );
});
@@ -2212,5 +2212,25 @@ test( "Animation should go to its end state if document.hidden = true", 1, funct
}
});
+test( "jQuery.easing._default (#2218)", 2, function() {
+ jQuery( "#foo" )
+ .animate({ width: "5px" }, {
+ duration: 5,
+ start: function( anim ) {
+ equal( anim.opts.easing, jQuery.easing._default,
+ "anim.opts.easing should be equal to jQuery.easing._default when the easing argument is not given" );
+ }
+ })
+ .animate({ height: "5px" }, {
+ duration: 5,
+ easing: "linear",
+ start: function( anim ) {
+ equal( anim.opts.easing, "linear",
+ "anim.opts.easing should be equal to the easing argument" );
+ }
+ })
+ .stop();
+ this.clock.tick( 25 );
+});
})();