1 module("effects", { teardown: moduleTeardown });
3 test("sanity check", function() {
5 ok( jQuery("#dl:visible, #main:visible, #foo:visible").length === 3, "QUnit state is correct for testing effects" );
8 test("show()", function() {
11 var hiddendiv = jQuery("div.hidden");
13 hiddendiv.hide().show();
15 equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." );
17 var div = jQuery("<div>").hide().appendTo("#main").show();
19 equal( div.css("display"), "block", "Make sure pre-hidden divs show" );
23 hiddendiv = jQuery("div.hidden");
25 equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
27 hiddendiv.css("display", "block");
28 equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
31 equal(jQuery.css( hiddendiv[0], "display"), "block", "hiddendiv is display: block");
33 hiddendiv.css("display","");
35 var pass = true, div = jQuery("#main div");
36 div.show().each(function(){
37 if ( this.style.display == "none" ) pass = false;
43 "undefined speed": undefined,
44 "empty string speed": "",
48 jQuery.each(speeds, function(name, speed) {
50 div.hide().show(speed).each(function() {
51 if ( this.style.display == "none" ) pass = false;
53 ok( pass, "Show with " + name);
56 jQuery.each(speeds, function(name, speed) {
58 div.hide().show(speed, function() {
61 ok( pass, "Show with " + name + " does not call animate callback" );
64 // #show-tests * is set display: none in CSS
65 jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id="test-table"></table>');
67 var old = jQuery("#test-table").show().css("display") !== "table";
68 jQuery("#test-table").remove();
77 "table" : old ? "block" : "table",
78 "thead" : old ? "block" : "table-header-group",
79 "tbody" : old ? "block" : "table-row-group",
80 "tr" : old ? "block" : "table-row",
81 "th" : old ? "block" : "table-cell",
82 "td" : old ? "block" : "table-cell",
84 "li" : old ? "block" : "list-item"
87 jQuery.each(test, function(selector, expected) {
88 var elem = jQuery(selector, "#show-tests").show();
89 equals( elem.css("display"), expected, "Show using correct display type for " + selector );
93 test("show(Number) - other displays", function() {
98 // #show-tests * is set display: none in CSS
99 jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id="test-table"></table>');
101 var old = jQuery("#test-table").show().css("display") !== "table",
103 jQuery("#test-table").remove();
112 "table" : old ? "block" : "table",
113 "thead" : old ? "block" : "table-header-group",
114 "tbody" : old ? "block" : "table-row-group",
115 "tr" : old ? "block" : "table-row",
116 "th" : old ? "block" : "table-cell",
117 "td" : old ? "block" : "table-cell",
119 "li" : old ? "block" : "list-item"
122 jQuery.each(test, function(selector, expected) {
123 var elem = jQuery(selector, "#show-tests").show(1, function() {
124 equals( elem.css("display"), expected, "Show using correct display type for " + selector );
125 if ( ++num === 15 ) {
135 test("Persist correct display value", function() {
140 // #show-tests * is set display: none in CSS
141 jQuery("#main").append('<div id="show-tests"><span style="position:absolute;">foo</span></div>');
143 var $span = jQuery("#show-tests span"),
144 displayNone = $span.css("display"),
145 display = '', num = 0;
149 display = $span.css("display");
153 $span.fadeIn(100, function() {
154 equals($span.css("display"), display, "Expecting display: " + display);
155 $span.fadeOut(100, function () {
156 equals($span.css("display"), displayNone, "Expecting display: " + displayNone);
157 $span.fadeIn(100, function() {
158 equals($span.css("display"), display, "Expecting display: " + display);
165 test("animate(Hash, Object, Function)", function() {
168 var hash = {opacity: 'show'};
169 var hashCopy = jQuery.extend({}, hash);
170 jQuery('#foo').animate(hash, 0, function() {
171 equals( hash.opacity, hashCopy.opacity, 'Check if animate changed the hash parameter' );
176 test("animate negative height", function() {
179 jQuery("#foo").animate({ height: -100 }, 100, function() {
180 equals( this.offsetHeight, 0, "Verify height." );
185 test("animate block as inline width/height", function() {
188 var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
189 expected = span.css("display");
193 if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
196 jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() {
197 equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
198 equals( this.offsetWidth, 42, "width was animated" );
199 equals( this.offsetHeight, 42, "height was animated" );
203 // Browser doesn't support inline-block
205 ok( true, "Browser doesn't support inline-block" );
206 ok( true, "Browser doesn't support inline-block" );
207 ok( true, "Browser doesn't support inline-block" );
211 test("animate native inline width/height", function() {
214 var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
215 expected = span.css("display");
219 if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
221 jQuery("#foo").css({ display: "", width: '', height: '' })
222 .append('<span>text</span>')
224 .animate({ width: 42, height: 42 }, 100, function() {
225 equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
226 equals( this.offsetWidth, 42, "width was animated" );
227 equals( this.offsetHeight, 42, "height was animated" );
231 // Browser doesn't support inline-block
233 ok( true, "Browser doesn't support inline-block" );
234 ok( true, "Browser doesn't support inline-block" );
235 ok( true, "Browser doesn't support inline-block" );
239 test("animate block width/height", function() {
242 jQuery("#foo").css({ display: "block", width: 20, height: 20 }).animate({ width: 42, height: 42 }, 100, function() {
243 equals( jQuery(this).css("display"), "block", "inline-block was not set on block element when animating width/height" );
244 equals( this.offsetWidth, 42, "width was animated" );
245 equals( this.offsetHeight, 42, "height was animated" );
250 test("animate table width/height", function() {
254 var displayMode = jQuery("#table").css("display") !== "table" ? "block" : "table";
256 jQuery("#table").animate({ width: 42, height: 42 }, 100, function() {
257 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
262 test("animate table-row width/height", function() {
265 var tr = jQuery("#table")
266 .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
267 .html("<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
270 // IE<8 uses “block” instead of the correct display type
271 var displayMode = tr.css("display") !== "table-row" ? "block" : "table-row";
273 tr.animate({ width: 10, height: 10 }, 100, function() {
274 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
275 equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
276 equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
281 test("animate table-cell width/height", function() {
284 var td = jQuery("#table")
285 .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
286 .html("<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
289 // IE<8 uses “block” instead of the correct display type
290 var displayMode = td.css("display") !== "table-cell" ? "block" : "table-cell";
292 td.animate({ width: 10, height: 10 }, 100, function() {
293 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
294 equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
295 equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
300 test("animate resets overflow-x and overflow-y when finished", function() {
304 .css({ display: "block", width: 20, height: 20, overflowX: "visible", overflowY: "auto" })
305 .animate({ width: 42, height: 42 }, 100, function() {
306 equals( this.style.overflowX, "visible", "overflow-x is visible" );
307 equals( this.style.overflowY, "auto", "overflow-y is auto" );
312 /* // This test ends up being flaky depending upon the CPU load
313 test("animate option (queue === false)", function () {
319 var $foo = jQuery("#foo");
320 $foo.animate({width:'100px'}, 3000, function () {
321 // should finish after unqueued animation so second
323 same( order, [ 1, 2 ], "Animations finished in the correct order" );
326 $foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () {
327 // short duration and out of queue so should finish first
333 test("animate with no properties", function() {
336 var divs = jQuery("div"), count = 0;
338 divs.animate({}, function(){
342 equals( divs.length, count, "Make sure that callback is called for each element in the set." );
346 var foo = jQuery("#foo");
349 foo.animate({top: 10}, 100, function(){
350 ok( true, "Animation was properly dequeued." );
355 test("animate duration 0", function() {
360 var $elems = jQuery([{ a:0 },{ a:0 }]), counter = 0;
362 equals( jQuery.timers.length, 0, "Make sure no animation was running from another test" );
364 $elems.eq(0).animate( {a:1}, 0, function(){
365 ok( true, "Animate a simple property." );
369 // Failed until [6115]
370 equals( jQuery.timers.length, 0, "Make sure synchronic animations are not left on jQuery.timers" );
372 equals( counter, 1, "One synchronic animations" );
374 $elems.animate( { a:2 }, 0, function(){
375 ok( true, "Animate a second simple property." );
379 equals( counter, 3, "Multiple synchronic animations" );
381 $elems.eq(0).animate( {a:3}, 0, function(){
382 ok( true, "Animate a third simple property." );
385 $elems.eq(1).animate( {a:3}, 200, function(){
387 // Failed until [6115]
388 equals( counter, 5, "One synchronic and one asynchronic" );
392 var $elem = jQuery("<div />");
393 $elem.show(0, function(){
394 ok(true, "Show callback with no duration");
396 $elem.hide(0, function(){
397 ok(true, "Hide callback with no duration");
400 // manually clean up detached elements
404 test("animate hyphenated properties", function(){
409 .css("font-size", 10)
410 .animate({"font-size": 20}, 200, function(){
411 equals( this.style.fontSize, "20px", "The font-size property was animated." );
416 test("animate non-element", function(){
420 var obj = { test: 0 };
422 jQuery(obj).animate({test: 200}, 200, function(){
423 equals( obj.test, 200, "The custom property should be modified." );
428 test("stop()", function() {
432 var $foo = jQuery("#foo");
434 $foo.hide().width(200).width();
436 $foo.animate({ width:'show' }, 1000);
437 setTimeout(function(){
438 var nw = $foo.width();
439 notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
443 notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
444 setTimeout(function(){
446 $foo.removeData(undefined, true);
447 equals( nw, $foo.width(), "The animation didn't continue" );
453 test("stop() - several in queue", function() {
457 var $foo = jQuery("#foo");
459 $foo.hide().width(200).width();
461 $foo.animate({ width:'show' }, 1000);
462 $foo.animate({ width:'hide' }, 1000);
463 $foo.animate({ width:'show' }, 1000);
464 setTimeout(function(){
465 equals( $foo.queue().length, 3, "All 3 still in the queue" );
466 var nw = $foo.width();
467 notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
471 notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
478 test("stop(clearQueue)", function() {
482 var $foo = jQuery("#foo");
484 $foo.hide().width(200).width();
486 $foo.animate({ width:'show' }, 1000);
487 $foo.animate({ width:'hide' }, 1000);
488 $foo.animate({ width:'show' }, 1000);
489 setTimeout(function(){
490 var nw = $foo.width();
491 ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
495 ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
497 equals( $foo.queue().length, 0, "The animation queue was cleared" );
498 setTimeout(function(){
499 equals( nw, $foo.width(), "The animation didn't continue" );
505 test("stop(clearQueue, gotoEnd)", function() {
509 var $foo = jQuery("#foo");
511 $foo.hide().width(200).width();
513 $foo.animate({ width:'show' }, 1000);
514 $foo.animate({ width:'hide' }, 1000);
515 $foo.animate({ width:'show' }, 1000);
516 $foo.animate({ width:'hide' }, 1000);
517 setTimeout(function(){
518 var nw = $foo.width();
519 ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
520 $foo.stop(false, true);
523 // Disabled, being flaky
524 //equals( nw, 1, "Stop() reset the animation" );
526 setTimeout(function(){
527 // Disabled, being flaky
528 //equals( $foo.queue().length, 2, "The next animation continued" );
535 test("toggle()", function() {
537 var x = jQuery("#foo");
538 ok( x.is(":visible"), "is visible" );
540 ok( x.is(":hidden"), "is hidden" );
542 ok( x.is(":visible"), "is visible again" );
545 ok( x.is(":visible"), "is visible" );
547 ok( x.is(":hidden"), "is hidden" );
549 ok( x.is(":visible"), "is visible again" );
552 jQuery.checkOverflowDisplay = function(){
553 var o = jQuery.css( this, "overflow" );
555 equals(o, "visible", "Overflow should be visible: " + o);
556 equals(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
561 test("support negative values < -10000 (bug #7193)", function () {
565 jQuery.extend(jQuery.fx.step, {
566 "marginBottom": function(fx) {
567 equals( fx.cur(), -11000, "Element has margin-bottom of -11000" );
568 delete jQuery.fx.step.marginBottom;
572 jQuery("#main").css("marginBottom", "-11000px").animate({ marginBottom: "-11001px" }, {
578 test("JS Overflow and Display", function() {
581 jQuery.makeTest( "JS Overflow and Display" )
582 .addClass("widewidth")
583 .css({ overflow: "visible", display: "inline" })
584 .addClass("widewidth")
585 .text("Some sample text.")
586 .before("text before")
588 .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
591 test("CSS Overflow and Display", function() {
594 jQuery.makeTest( "CSS Overflow and Display" )
595 .addClass("overflow inline")
596 .addClass("widewidth")
597 .text("Some sample text.")
598 .before("text before")
600 .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
604 "CSS Auto": function(elem,prop){
605 jQuery(elem).addClass("auto" + prop)
606 .text("This is a long string of text.");
609 "JS Auto": function(elem,prop){
610 jQuery(elem).css(prop,"")
611 .text("This is a long string of text.");
614 "CSS 100": function(elem,prop){
615 jQuery(elem).addClass("large" + prop);
618 "JS 100": function(elem,prop){
619 jQuery(elem).css(prop,prop == "opacity" ? 1 : "100px");
620 return prop == "opacity" ? 1 : 100;
622 "CSS 50": function(elem,prop){
623 jQuery(elem).addClass("med" + prop);
626 "JS 50": function(elem,prop){
627 jQuery(elem).css(prop,prop == "opacity" ? 0.50 : "50px");
628 return prop == "opacity" ? 0.5 : 50;
630 "CSS 0": function(elem,prop){
631 jQuery(elem).addClass("no" + prop);
634 "JS 0": function(elem,prop){
635 jQuery(elem).css(prop,prop == "opacity" ? 0 : "0px");
640 "show": function(elem,prop){
641 jQuery(elem).hide().addClass("wide"+prop);
644 "hide": function(elem,prop){
645 jQuery(elem).addClass("wide"+prop);
648 "100": function(elem,prop){
649 jQuery(elem).addClass("wide"+prop);
650 return prop == "opacity" ? 1 : 100;
652 "50": function(elem,prop){
653 return prop == "opacity" ? 0.50 : 50;
655 "0": function(elem,prop){
656 jQuery(elem).addClass("noback");
660 test(fn + " to " + tn, function() {
661 var elem = jQuery.makeTest( fn + " to " + tn );
663 var t_w = t( elem, "width" );
664 var f_w = f( elem, "width" );
665 var t_h = t( elem, "height" );
666 var f_h = f( elem, "height" );
667 var t_o = t( elem, "opacity" );
668 var f_o = f( elem, "opacity" );
672 if ( t_h == "show" ) num++;
673 if ( t_w == "show" ) num++;
674 if ( t_w == "hide"||t_w == "show" ) num++;
675 if ( t_h == "hide"||t_h == "show" ) num++;
676 if ( t_o == "hide"||t_o == "show" ) num++;
677 if ( t_w == "hide" ) num++;
678 if ( t_o.constructor == Number ) num += 2;
679 if ( t_w.constructor == Number ) num += 2;
680 if ( t_h.constructor == Number ) num +=2;
685 var anim = { width: t_w, height: t_h, opacity: t_o };
687 elem.animate(anim, 50, function(){
689 equals( this.style.display, "block", "Showing, display should block: " + this.style.display);
691 if ( t_w == "hide"||t_w == "show" )
692 ok(f_w === "" ? this.style.width === f_w : this.style.width.indexOf(f_w) === 0, "Width must be reset to " + f_w + ": " + this.style.width);
694 if ( t_h == "hide"||t_h == "show" )
695 ok(f_h === "" ? this.style.height === f_h : this.style.height.indexOf(f_h) === 0, "Height must be reset to " + f_h + ": " + this.style.height);
697 var cur_o = jQuery.style(this, "opacity");
699 if ( t_o == "hide" || t_o == "show" )
700 equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o);
703 equals(this.style.display, "none", "Hiding, display should be none: " + this.style.display);
705 if ( t_o.constructor == Number ) {
706 equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o);
708 ok(jQuery.css(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o);
711 if ( t_w.constructor == Number ) {
712 equals(this.style.width, t_w + "px", "Final width should be " + t_w + ": " + this.style.width);
714 var cur_w = jQuery.css(this,"width");
716 ok(this.style.width != "" || cur_w == t_w, "Width should be explicitly set to " + t_w + ", is instead: " + cur_w);
719 if ( t_h.constructor == Number ) {
720 equals(this.style.height, t_h + "px", "Final height should be " + t_h + ": " + this.style.height);
722 var cur_h = jQuery.css(this,"height");
724 ok(this.style.height != "" || cur_h == t_h, "Height should be explicitly set to " + t_h + ", is instead: " + cur_w);
727 if ( t_h == "show" ) {
728 var old_h = jQuery.css(this, "height");
729 jQuery(this).append("<br/>Some more text<br/>and some more...");
731 if ( /Auto/.test( fn ) ) {
732 notEqual(jQuery.css(this, "height"), old_h, "Make sure height is auto.");
734 equals(jQuery.css(this, "height"), old_h, "Make sure height is not auto.");
738 // manually remove generated element
739 jQuery(this).remove();
747 jQuery.fn.saveState = function(hiddenOverflow){
748 var check = ['opacity','height','width','display','overflow'];
749 expect(check.length);
752 return this.each(function(){
755 jQuery.each(check, function(i,c){
756 self.save[c] = c === "overflow" && hiddenOverflow ? "hidden" : self.style[ c ] || jQuery.css(self,c);
761 jQuery.checkState = function(){
763 jQuery.each(this.save, function(c,v){
764 var cur = self.style[ c ] || jQuery.css(self, c);
765 equals( cur, v, "Make sure that " + c + " is reset (Old: " + v + " Cur: " + cur + ")");
768 // manually clean data on modified element
769 jQuery.removeData(this, 'olddisplay', true);
775 test("Chain fadeOut fadeIn", function() {
776 jQuery('#fadein div').saveState().fadeOut('fast').fadeIn('fast',jQuery.checkState);
778 test("Chain fadeIn fadeOut", function() {
779 jQuery('#fadeout div').saveState().fadeIn('fast').fadeOut('fast',jQuery.checkState);
782 test("Chain hide show", function() {
783 jQuery('#show div').saveState(jQuery.support.shrinkWrapBlocks).hide('fast').show('fast',jQuery.checkState);
785 test("Chain show hide", function() {
786 jQuery('#hide div').saveState(jQuery.support.shrinkWrapBlocks).show('fast').hide('fast',jQuery.checkState);
788 test("Chain show hide with easing and callback", function() {
789 jQuery('#hide div').saveState().show('fast').hide('fast','linear',jQuery.checkState);
792 test("Chain toggle in", function() {
793 jQuery('#togglein div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState);
795 test("Chain toggle out", function() {
796 jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState);
798 test("Chain toggle out with easing and callback", function() {
799 jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast','linear',jQuery.checkState);
801 test("Chain slideDown slideUp", function() {
802 jQuery('#slidedown div').saveState(jQuery.support.shrinkWrapBlocks).slideDown('fast').slideUp('fast',jQuery.checkState);
804 test("Chain slideUp slideDown", function() {
805 jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast',jQuery.checkState);
807 test("Chain slideUp slideDown with easing and callback", function() {
808 jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast','linear',jQuery.checkState);
811 test("Chain slideToggle in", function() {
812 jQuery('#slidetogglein div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState);
814 test("Chain slideToggle out", function() {
815 jQuery('#slidetoggleout div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState);
818 test("Chain fadeToggle in", function() {
819 jQuery('#fadetogglein div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState);
821 test("Chain fadeToggle out", function() {
822 jQuery('#fadetoggleout div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState);
825 test("Chain fadeTo 0.5 1.0 with easing and callback)", function() {
826 jQuery('#fadeto div').saveState().fadeTo('fast',0.5).fadeTo('fast',1.0,'linear',jQuery.checkState);
829 jQuery.makeTest = function( text ){
830 var elem = jQuery("<div></div>")
831 .attr("id", "test" + jQuery.makeTest.id++)
836 .appendTo("#fx-tests")
842 jQuery.makeTest.id = 1;
844 test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function () {
848 var $checkedtest = jQuery("#checkedtest");
849 // IE6 was clearing "checked" in jQuery(elem).show("fast");
850 $checkedtest.hide().show("fast", function() {
851 ok( !! jQuery(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
852 ok( ! jQuery(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
853 ok( !! jQuery(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
854 ok( ! jQuery(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
859 test("animate with per-property easing", function(){
864 var _test1_called = false;
865 var _test2_called = false;
866 var _default_test_called = false;
868 jQuery.easing['_test1'] = function() {
869 _test1_called = true;
872 jQuery.easing['_test2'] = function() {
873 _test2_called = true;
876 jQuery.easing['_default_test'] = function() {
877 _default_test_called = true;
880 jQuery({a:0,b:0,c:0}).animate({
884 }, 400, '_default_test', function(){
886 ok(_test1_called, "Easing function (1) called");
887 ok(_test2_called, "Easing function (2) called");
888 ok(_default_test_called, "Easing function (_default) called");
893 test("hide hidden elements (bug #7141)", function() {
897 var div = jQuery("<div style='display:none'></div>").appendTo("#main");
898 equals( div.css("display"), "none", "Element is hidden by default" );
900 ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
902 equals( div.css("display"), "block", "Show a double-hidden element" );
907 test("hide hidden elements, with animation (bug #7141)", function() {
912 var div = jQuery("<div style='display:none'></div>").appendTo("#main");
913 equals( div.css("display"), "none", "Element is hidden by default" );
914 div.hide(1, function () {
915 ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
916 div.show(1, function () {
917 equals( div.css("display"), "block", "Show a double-hidden element" );
923 test("animate unit-less properties (#4966)", 2, function() {
925 var div = jQuery( "<div style='z-index: 0'></div>" ).appendTo( "body" );
926 equal( div.css( "z-index" ), "0", "z-index is 0" );
927 div.animate({ zIndex: 2 }, function() {
928 equal( div.css( "z-index" ), "2", "z-index is 2" );