aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/effects/core.js26
-rw-r--r--ui/effect.js4
2 files changed, 29 insertions, 1 deletions
diff --git a/tests/unit/effects/core.js b/tests/unit/effects/core.js
index 76fcaa062..db83ca093 100644
--- a/tests/unit/effects/core.js
+++ b/tests/unit/effects/core.js
@@ -258,6 +258,32 @@ test( "createPlaceholder: preserves layout affecting properties", function() {
deepEqual( before.outerHeight, placeholder.outerHeight( true ), "height preserved" );
});
+module( "transfer" );
+
+asyncTest( "transfer() without callback", function() {
+ expect( 0 );
+
+ // Verify that the effect works without a callback
+ $( "#elem" ).transfer( {
+ to: ".animateClass",
+ duration: 1
+ } );
+ setTimeout( function() {
+ start();
+ }, 25 );
+} );
+
+asyncTest( "transfer() with callback", function() {
+ expect( 1 );
+ $( "#elem" ).transfer( {
+ to: ".animateClass",
+ duration: 1
+ }, function() {
+ ok( true, "callback invoked" );
+ start();
+ } );
+} );
+
$.each( $.effects.effect, function( effect ) {
module( "effects." + effect );
diff --git a/ui/effect.js b/ui/effect.js
index cc9a91045..a946c6e8b 100644
--- a/ui/effect.js
+++ b/ui/effect.js
@@ -1505,7 +1505,9 @@ $.fn.extend({
})
.animate( animation, options.duration, options.easing, function() {
transfer.remove();
- done();
+ if ( $.isFunction( done ) ) {
+ done();
+ }
});
}
});