2015-04-06 16:56:07 +00:00
|
|
|
define( [
|
2016-04-03 16:45:40 +00:00
|
|
|
"qunit",
|
2015-04-06 16:56:07 +00:00
|
|
|
"jquery",
|
|
|
|
"lib/common",
|
|
|
|
"ui/effect",
|
2015-07-15 02:01:41 +00:00
|
|
|
"ui/effects/effect-blind",
|
|
|
|
"ui/effects/effect-bounce",
|
|
|
|
"ui/effects/effect-clip",
|
|
|
|
"ui/effects/effect-drop",
|
|
|
|
"ui/effects/effect-explode",
|
|
|
|
"ui/effects/effect-fade",
|
|
|
|
"ui/effects/effect-fold",
|
|
|
|
"ui/effects/effect-highlight",
|
|
|
|
"ui/effects/effect-puff",
|
|
|
|
"ui/effects/effect-pulsate",
|
|
|
|
"ui/effects/effect-scale",
|
|
|
|
"ui/effects/effect-shake",
|
|
|
|
"ui/effects/effect-size",
|
|
|
|
"ui/effects/effect-slide",
|
|
|
|
"ui/effects/effect-transfer"
|
2016-04-03 16:45:40 +00:00
|
|
|
], function( QUnit, $, common ) {
|
2011-03-29 20:32:48 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.assert.present = function( value, array, message ) {
|
|
|
|
this.push( jQuery.inArray( value, array ) !== -1, value, array, message );
|
|
|
|
};
|
2011-05-12 15:22:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.assert.notPresent = function( value, array, message ) {
|
|
|
|
this.push( jQuery.inArray( value, array ) === -1, value, array, message );
|
|
|
|
};
|
2011-05-12 15:22:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
// MinDuration is used for "short" animate tests where we are only concerned about the final
|
2011-05-16 22:19:57 +00:00
|
|
|
var minDuration = 15,
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Duration is used for "long" animates where we plan on testing properties during animation
|
2012-10-23 14:36:42 +00:00
|
|
|
duration = 200;
|
2011-03-29 20:32:48 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.module( "effects.core" );
|
2011-05-01 11:23:19 +00:00
|
|
|
|
2013-02-28 18:34:49 +00:00
|
|
|
// TODO: test all signatures of .show(), .hide(), .toggle().
|
|
|
|
// Look at core's signatures and UI's signatures.
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( ".hide() with step", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 1 );
|
2013-02-28 18:34:49 +00:00
|
|
|
var element = $( "#elem" ),
|
|
|
|
step = function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( true, "step callback invoked" );
|
2013-02-28 18:34:49 +00:00
|
|
|
step = $.noop;
|
|
|
|
};
|
|
|
|
|
2015-08-24 13:32:42 +00:00
|
|
|
element.hide( {
|
2013-02-28 18:34:49 +00:00
|
|
|
step: function() {
|
|
|
|
step();
|
|
|
|
},
|
2016-04-03 16:45:40 +00:00
|
|
|
complete: ready
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2013-02-28 18:34:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "Immediate Return Conditions", function( assert ) {
|
2011-06-23 12:22:34 +00:00
|
|
|
var hidden = $( "div.hidden" ),
|
|
|
|
count = 0;
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 3 );
|
2011-06-23 12:22:34 +00:00
|
|
|
hidden.hide( "blind", function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( ++count, 1, "Hide on hidden returned immediately" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} ).show().show( "blind", function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( ++count, 2, "Show on shown returned immediately" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( ++count, 3, "Both Functions worked properly" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2011-06-23 12:22:34 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( ".hide() with hidden parent", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2013-02-26 15:36:03 +00:00
|
|
|
var element = $( "div.hidden" ).children();
|
|
|
|
element.hide( "blind", function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( element.css( "display" ), "none", "display: none" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2013-02-26 15:36:03 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "Parse of null for options", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2012-10-21 21:46:38 +00:00
|
|
|
var hidden = $( "div.hidden" ),
|
|
|
|
count = 0;
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 1 );
|
2012-10-21 21:46:38 +00:00
|
|
|
hidden.show( "blind", null, 1, function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( ++count, 1, "null for options still works" );
|
|
|
|
ready();
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2012-10-21 21:46:38 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "removeClass", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2013-01-26 17:59:08 +00:00
|
|
|
|
|
|
|
var element = $( "<div>" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( "", element[ 0 ].className );
|
2013-01-26 17:59:08 +00:00
|
|
|
element.addClass( "destroyed" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( "destroyed", element[ 0 ].className );
|
2013-01-26 17:59:08 +00:00
|
|
|
element.removeClass();
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( "", element[ 0 ].className );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2013-01-26 17:59:08 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.module( "effects.core: animateClass" );
|
2011-05-12 15:22:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass works with borderStyle", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2015-08-24 13:32:42 +00:00
|
|
|
var test = $( "div.animateClass" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 3 );
|
2015-08-24 13:32:42 +00:00
|
|
|
test.toggleClass( "testAddBorder", minDuration, function() {
|
|
|
|
test.toggleClass( "testAddBorder", minDuration, function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test.css( "borderLeftStyle" ), "none", "None border set" );
|
|
|
|
ready();
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test.css( "borderLeftStyle" ), "solid", "None border not immedately set" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test.css( "borderLeftStyle" ), "solid", "Solid border immedately set" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2011-05-12 15:22:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass works with colors", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2015-08-24 13:32:42 +00:00
|
|
|
var test = $( "div.animateClass" ),
|
2012-04-30 05:19:52 +00:00
|
|
|
oldStep = jQuery.fx.step.backgroundColor;
|
2012-10-23 14:36:42 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 2 );
|
2012-04-30 05:19:52 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// We want to catch the first frame of animation
|
2012-04-30 05:19:52 +00:00
|
|
|
jQuery.fx.step.backgroundColor = function( fx ) {
|
|
|
|
oldStep.apply( this, arguments );
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Make sure it has animated somewhere we can detect
|
2012-04-30 05:19:52 +00:00
|
|
|
if ( fx.pos > 255 / 2000 ) {
|
|
|
|
jQuery.fx.step.backgroundColor = oldStep;
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.notPresent( test.css( "backgroundColor" ),
|
2012-04-30 05:19:52 +00:00
|
|
|
[ "#000000", "#ffffff", "#000", "#fff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
|
|
|
|
"Color is not endpoints in middle." );
|
|
|
|
test.stop( true, true );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-24 13:32:42 +00:00
|
|
|
test.toggleClass( "testChangeBackground", {
|
2012-04-30 05:19:52 +00:00
|
|
|
duration: 2000,
|
|
|
|
complete: function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.present( test.css( "backgroundColor" ), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" );
|
|
|
|
ready();
|
2012-04-30 05:19:52 +00:00
|
|
|
}
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-05-12 15:22:49 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass calls step option", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
|
|
|
var ready = assert.async();
|
2012-06-25 17:05:01 +00:00
|
|
|
var test = jQuery( "div.animateClass" ),
|
2012-10-23 14:36:42 +00:00
|
|
|
step = function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( true, "Step Function Called" );
|
2012-04-30 05:19:52 +00:00
|
|
|
test.stop();
|
2016-04-03 16:45:40 +00:00
|
|
|
ready();
|
2012-06-25 17:05:01 +00:00
|
|
|
step = $.noop;
|
2012-04-30 05:19:52 +00:00
|
|
|
};
|
|
|
|
test.toggleClass( "testChangeBackground", {
|
2012-06-25 17:05:01 +00:00
|
|
|
step: function() {
|
|
|
|
step();
|
2012-04-30 05:19:52 +00:00
|
|
|
}
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-05-16 22:19:57 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass works with children", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
|
|
|
var ready = assert.async();
|
2012-04-30 05:19:52 +00:00
|
|
|
var animatedChild,
|
2015-08-24 13:32:42 +00:00
|
|
|
test = $( "div.animateClass" ),
|
|
|
|
h2 = test.find( "h2" );
|
2011-05-18 23:13:37 +00:00
|
|
|
|
2015-08-24 13:32:42 +00:00
|
|
|
test.toggleClass( "testChildren", {
|
2012-04-30 05:19:52 +00:00
|
|
|
children: true,
|
|
|
|
duration: duration,
|
|
|
|
complete: function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( h2.css( "fontSize" ), "20px", "Text size is final during complete" );
|
2015-08-24 13:32:42 +00:00
|
|
|
test.toggleClass( "testChildren", {
|
2012-04-30 05:19:52 +00:00
|
|
|
duration: duration,
|
|
|
|
complete: function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( h2.css( "fontSize" ), "10px", "Text size revertted after class removed" );
|
2012-04-30 05:19:52 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
ready();
|
2012-04-30 05:19:52 +00:00
|
|
|
},
|
|
|
|
step: function( val, fx ) {
|
|
|
|
if ( fx.elem === h2[ 0 ] ) {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( false, "Error - Animating property on h2" );
|
2012-04-30 05:19:52 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2012-04-30 05:19:52 +00:00
|
|
|
},
|
|
|
|
step: function( val, fx ) {
|
|
|
|
if ( fx.prop === "fontSize" && fx.elem === h2[ 0 ] && !animatedChild ) {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( fx.end, 20, "animating font size on child" );
|
2012-04-30 05:19:52 +00:00
|
|
|
animatedChild = true;
|
|
|
|
}
|
|
|
|
}
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-05-12 16:13:25 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass clears style properties when stopped", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2015-08-24 13:32:42 +00:00
|
|
|
var test = $( "div.animateClass" ),
|
|
|
|
style = test[ 0 ].style,
|
2011-06-23 10:29:09 +00:00
|
|
|
orig = style.cssText;
|
2012-04-19 13:39:21 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 2 );
|
2011-06-23 10:29:09 +00:00
|
|
|
|
|
|
|
test.addClass( "testChangeBackground", duration );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.notEqual( orig, style.cssText, "cssText is not the same after starting animation" );
|
2011-06-23 10:29:09 +00:00
|
|
|
|
|
|
|
test.stop( true, true );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" );
|
|
|
|
ready();
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2011-06-23 10:29:09 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "animateClass: css and class changes during animation are not lost (#7106)",
|
2015-02-03 00:35:16 +00:00
|
|
|
function( assert ) {
|
2016-04-03 16:45:40 +00:00
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 2 );
|
2011-10-25 22:40:37 +00:00
|
|
|
var test = $( "div.ticket7106" );
|
2011-08-02 21:54:24 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Ensure the class stays and that the css property stays
|
2011-10-25 22:40:37 +00:00
|
|
|
function animationComplete() {
|
2015-02-03 00:35:16 +00:00
|
|
|
assert.hasClasses( test, "testClass", "class change during animateClass was not lost" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test.height(), 100, "css change during animateClass was not lost" );
|
|
|
|
ready();
|
2011-10-25 22:40:37 +00:00
|
|
|
}
|
2012-04-19 13:39:21 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Add a class and change a style property after starting an animated class
|
2012-04-19 13:39:21 +00:00
|
|
|
test.addClass( "animate", minDuration, animationComplete )
|
|
|
|
.addClass( "testClass" )
|
|
|
|
.height( 100 );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2011-10-25 22:40:37 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "createPlaceholder: only created for static or relative elements", function( assert ) {
|
|
|
|
assert.expect( 4 );
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( $.effects.createPlaceholder( $( ".relative" ) ).length, "placeholder created for relative element" );
|
|
|
|
assert.ok( $.effects.createPlaceholder( $( ".static" ) ).length, "placeholder created for static element" );
|
|
|
|
assert.ok( !$.effects.createPlaceholder( $( ".absolute" ) ), "placeholder not created for absolute element" );
|
|
|
|
assert.ok( !$.effects.createPlaceholder( $( ".fixed" ) ), "placeholder not created for fixed element" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "createPlaceholder: preserves layout affecting properties", function( assert ) {
|
|
|
|
assert.expect( 7 );
|
2012-12-26 13:35:42 +00:00
|
|
|
|
|
|
|
var position = 5,
|
2015-08-24 13:32:42 +00:00
|
|
|
element = $( ".relative" ).css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
top: position,
|
|
|
|
left: position
|
2015-08-24 13:32:42 +00:00
|
|
|
} ),
|
2012-12-26 13:35:42 +00:00
|
|
|
before = {
|
|
|
|
offset: element.offset(),
|
|
|
|
outerWidth: element.outerWidth( true ),
|
|
|
|
outerHeight: element.outerHeight( true ),
|
|
|
|
"float": element.css( "float" ),
|
|
|
|
position: element.position()
|
|
|
|
},
|
|
|
|
placeholder = $.effects.createPlaceholder( element );
|
|
|
|
|
|
|
|
// Placeholders are only placed to preserve the effect on layout. Considering
|
|
|
|
// top and left do not change layout, they are not preserved, which makes some
|
|
|
|
// of the math simpler in the implementation.
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.deepEqual( before.offset.top - position, placeholder.offset().top, "offset top preserved" );
|
|
|
|
assert.deepEqual( before.offset.left - position, placeholder.offset().left, "offset left preserved" );
|
|
|
|
assert.deepEqual( before.position.top - position, placeholder.position().top, "position top preserved" );
|
|
|
|
assert.deepEqual( before.position.left - position, placeholder.position().left, "position left preserved" );
|
|
|
|
|
|
|
|
assert.deepEqual( before[ "float" ], placeholder.css( "float" ), "float preserved" );
|
|
|
|
assert.deepEqual( before.outerWidth, placeholder.outerWidth( true ), "width preserved" );
|
|
|
|
assert.deepEqual( before.outerHeight, placeholder.outerHeight( true ), "height preserved" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2011-10-25 22:40:37 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.module( "transfer" );
|
2015-04-22 13:50:43 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "transfer() without callback", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 0 );
|
2015-04-22 13:50:43 +00:00
|
|
|
|
|
|
|
// Verify that the effect works without a callback
|
|
|
|
$( "#elem" ).transfer( {
|
|
|
|
to: ".animateClass",
|
|
|
|
duration: 1
|
|
|
|
} );
|
|
|
|
setTimeout( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
ready();
|
2015-04-22 13:50:43 +00:00
|
|
|
}, 25 );
|
|
|
|
} );
|
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "transfer() with callback", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 1 );
|
2015-04-22 13:50:43 +00:00
|
|
|
$( "#elem" ).transfer( {
|
|
|
|
to: ".animateClass",
|
|
|
|
duration: 1
|
|
|
|
}, function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( true, "callback invoked" );
|
|
|
|
ready();
|
2015-04-22 13:50:43 +00:00
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
2011-10-25 22:40:37 +00:00
|
|
|
$.each( $.effects.effect, function( effect ) {
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.module( "effects." + effect );
|
2012-04-30 00:22:31 +00:00
|
|
|
|
2015-10-01 10:08:04 +00:00
|
|
|
common.testJshint( "effects/effect-" + effect );
|
2012-04-30 00:22:31 +00:00
|
|
|
|
2011-10-25 22:40:37 +00:00
|
|
|
if ( effect === "transfer" ) {
|
|
|
|
return;
|
|
|
|
}
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "show/hide", function( assert ) {
|
|
|
|
var ready = assert.async();
|
|
|
|
assert.expect( 12 );
|
2012-04-19 13:39:21 +00:00
|
|
|
var hidden = $( "div.hidden" ),
|
|
|
|
count = 0,
|
2011-10-25 22:40:37 +00:00
|
|
|
test = 0;
|
|
|
|
|
|
|
|
function queueTest( fn ) {
|
|
|
|
count++;
|
|
|
|
var point = count;
|
|
|
|
return function( next ) {
|
|
|
|
test++;
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( point, test, "Queue function fired in order" );
|
2011-10-25 22:40:37 +00:00
|
|
|
if ( fn ) {
|
|
|
|
fn();
|
|
|
|
} else {
|
|
|
|
setTimeout( next, minDuration );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
function duringTest( fn ) {
|
|
|
|
return function( next ) {
|
|
|
|
setTimeout( fn );
|
|
|
|
next();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
hidden
|
|
|
|
.queue( queueTest() )
|
2015-08-24 13:32:42 +00:00
|
|
|
.queue( duringTest( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( hidden.is( ":animated" ),
|
2012-12-26 13:35:42 +00:00
|
|
|
"Hidden is seen as animated during .show(\"" + effect + "\", time)" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} ) )
|
|
|
|
.show( effect, minDuration, queueTest( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( hidden.css( "display" ), "block",
|
2012-12-26 13:35:42 +00:00
|
|
|
"Hidden is shown after .show(\"" + effect + "\", time)" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( !$( ".ui-effects-placeholder" ).length,
|
2012-12-26 13:35:42 +00:00
|
|
|
"No placeholder remains after .show(\"" + effect + "\", time)" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} ) )
|
2012-12-26 13:35:42 +00:00
|
|
|
.queue( queueTest() )
|
2015-08-24 13:32:42 +00:00
|
|
|
.queue( duringTest( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( hidden.is( ":animated" ),
|
2012-12-26 13:35:42 +00:00
|
|
|
"Hidden is seen as animated during .hide(\"" + effect + "\", time)" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} ) )
|
|
|
|
.hide( effect, minDuration, queueTest( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( hidden.css( "display" ), "none",
|
2012-12-26 13:35:42 +00:00
|
|
|
"Back to hidden after .hide(\"" + effect + "\", time)" );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.ok( !$( ".ui-effects-placeholder" ).length,
|
2012-12-26 13:35:42 +00:00
|
|
|
"No placeholder remains after .hide(\"" + effect + "\", time)" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} ) )
|
|
|
|
.queue( queueTest( function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.deepEqual( hidden.queue(), [ "inprogress" ], "Only the inprogress sentinel remains" );
|
|
|
|
ready();
|
2015-08-24 13:32:42 +00:00
|
|
|
} ) );
|
|
|
|
} );
|
2011-10-25 22:40:37 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
QUnit.test( "relative width & height - properties are preserved", function( assert ) {
|
|
|
|
var ready = assert.async();
|
2015-08-24 13:32:42 +00:00
|
|
|
var test = $( "div.relWidth.relHeight" ),
|
2011-10-25 22:40:37 +00:00
|
|
|
width = test.width(), height = test.height(),
|
2015-08-24 13:32:42 +00:00
|
|
|
cssWidth = test[ 0 ].style.width, cssHeight = test[ 0 ].style.height;
|
2011-10-25 22:40:37 +00:00
|
|
|
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.expect( 4 );
|
2011-10-25 22:40:37 +00:00
|
|
|
test.toggle( effect, minDuration, function() {
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test[ 0 ].style.width, cssWidth, "Inline CSS Width has been reset after animation ended" );
|
|
|
|
assert.equal( test[ 0 ].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
|
|
|
|
ready();
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
2016-04-03 16:45:40 +00:00
|
|
|
assert.equal( test.width(), width, "Width is the same px after animation started" );
|
|
|
|
assert.equal( test.height(), height, "Height is the same px after animation started" );
|
2015-08-24 13:32:42 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-08-02 21:54:24 +00:00
|
|
|
|
2015-04-06 16:56:07 +00:00
|
|
|
} );
|