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);
57 jQuery.each(speeds, function(name, speed) {
59 div.hide().show(speed, function() {
62 ok( pass, "Show with " + name + " does not call animate callback" );
65 // #show-tests * is set display: none in CSS
66 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>');
68 var old = jQuery("#test-table").show().css("display") !== "table";
69 jQuery("#test-table").remove();
78 "table" : old ? "block" : "table",
79 "thead" : old ? "block" : "table-header-group",
80 "tbody" : old ? "block" : "table-row-group",
81 "tr" : old ? "block" : "table-row",
82 "th" : old ? "block" : "table-cell",
83 "td" : old ? "block" : "table-cell",
85 "li" : old ? "block" : "list-item"
88 jQuery.each(test, function(selector, expected) {
89 var elem = jQuery(selector, "#show-tests").show();
90 equals( elem.css("display"), expected, "Show using correct display type for " + selector );
94 test("show(Number) - other displays", function() {
99 // #show-tests * is set display: none in CSS
100 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>');
102 var old = jQuery("#test-table").show().css("display") !== "table",
104 jQuery("#test-table").remove();
113 "table" : old ? "block" : "table",
114 "thead" : old ? "block" : "table-header-group",
115 "tbody" : old ? "block" : "table-row-group",
116 "tr" : old ? "block" : "table-row",
117 "th" : old ? "block" : "table-cell",
118 "td" : old ? "block" : "table-cell",
120 "li" : old ? "block" : "list-item"
123 jQuery.each(test, function(selector, expected) {
124 var elem = jQuery(selector, "#show-tests").show(1, function() {
125 equals( elem.css("display"), expected, "Show using correct display type for " + selector );
126 if ( ++num === 15 ) {
136 test("Persist correct display value", function() {
141 // #show-tests * is set display: none in CSS
142 jQuery("#main").append('<div id="show-tests"><span style="position:absolute;">foo</span></div>');
144 var $span = jQuery("#show-tests span"),
145 displayNone = $span.css("display"),
146 display = '', num = 0;
150 display = $span.css("display");
154 $span.fadeIn(100, function() {
156 equals($span.css("display"), display, "Expecting display: " + display);
158 $span.fadeOut(100, function () {
160 equals($span.css("display"), displayNone, "Expecting display: " + displayNone);
162 $span.fadeIn(100, function() {
164 equals($span.css("display"), display, "Expecting display: " + display);
172 test("animate(Hash, Object, Function)", function() {
175 var hash = {opacity: 'show'};
176 var hashCopy = jQuery.extend({}, hash);
177 jQuery('#foo').animate(hash, 0, function() {
178 equals( hash.opacity, hashCopy.opacity, 'Check if animate changed the hash parameter' );
183 test("animate negative height", function() {
186 jQuery("#foo").animate({ height: -100 }, 100, function() {
187 equals( this.offsetHeight, 0, "Verify height." );
192 test("animate block as inline width/height", function() {
195 var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
196 expected = span.css("display");
200 if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
203 jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() {
204 equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
205 equals( this.offsetWidth, 42, "width was animated" );
206 equals( this.offsetHeight, 42, "height was animated" );
210 // Browser doesn't support inline-block
212 ok( true, "Browser doesn't support inline-block" );
213 ok( true, "Browser doesn't support inline-block" );
214 ok( true, "Browser doesn't support inline-block" );
218 test("animate native inline width/height", function() {
221 var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
222 expected = span.css("display");
226 if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
228 jQuery("#foo").css({ display: "", width: '', height: '' })
229 .append('<span>text</span>')
231 .animate({ width: 42, height: 42 }, 100, function() {
232 equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
233 equals( this.offsetWidth, 42, "width was animated" );
234 equals( this.offsetHeight, 42, "height was animated" );
238 // Browser doesn't support inline-block
240 ok( true, "Browser doesn't support inline-block" );
241 ok( true, "Browser doesn't support inline-block" );
242 ok( true, "Browser doesn't support inline-block" );
246 test("animate block width/height", function() {
249 jQuery("#foo").css({ display: "block", width: 20, height: 20 }).animate({ width: 42, height: 42 }, 100, function() {
250 equals( jQuery(this).css("display"), "block", "inline-block was not set on block element when animating width/height" );
251 equals( this.offsetWidth, 42, "width was animated" );
252 equals( this.offsetHeight, 42, "height was animated" );
257 test("animate table width/height", function() {
261 var displayMode = jQuery("#table").css("display") !== "table" ? "block" : "table";
263 jQuery("#table").animate({ width: 42, height: 42 }, 100, function() {
264 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
269 test("animate table-row width/height", function() {
272 var tr = jQuery("#table")
273 .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
274 .html("<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
277 // IE<8 uses “block” instead of the correct display type
278 var displayMode = tr.css("display") !== "table-row" ? "block" : "table-row";
280 tr.animate({ width: 10, height: 10 }, 100, function() {
281 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
282 equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
283 equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
288 test("animate table-cell width/height", function() {
291 var td = jQuery("#table")
292 .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
293 .html("<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
296 // IE<8 uses “block” instead of the correct display type
297 var displayMode = td.css("display") !== "table-cell" ? "block" : "table-cell";
299 td.animate({ width: 10, height: 10 }, 100, function() {
300 equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
301 equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
302 equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
307 test("animate resets overflow-x and overflow-y when finished", function() {
311 .css({ display: "block", width: 20, height: 20, overflowX: "visible", overflowY: "auto" })
312 .animate({ width: 42, height: 42 }, 100, function() {
313 equals( this.style.overflowX, "visible", "overflow-x is visible" );
314 equals( this.style.overflowY, "auto", "overflow-y is auto" );
319 /* // This test ends up being flaky depending upon the CPU load
320 test("animate option (queue === false)", function () {
326 var $foo = jQuery("#foo");
327 $foo.animate({width:'100px'}, 3000, function () {
328 // should finish after unqueued animation so second
330 same( order, [ 1, 2 ], "Animations finished in the correct order" );
333 $foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () {
334 // short duration and out of queue so should finish first
340 test("animate with no properties", function() {
343 var divs = jQuery("div"), count = 0;
345 divs.animate({}, function(){
349 equals( divs.length, count, "Make sure that callback is called for each element in the set." );
353 var foo = jQuery("#foo");
356 foo.animate({top: 10}, 100, function(){
357 ok( true, "Animation was properly dequeued." );
362 test("animate duration 0", function() {
367 var $elems = jQuery([{ a:0 },{ a:0 }]), counter = 0;
369 equals( jQuery.timers.length, 0, "Make sure no animation was running from another test" );
371 $elems.eq(0).animate( {a:1}, 0, function(){
372 ok( true, "Animate a simple property." );
376 // Failed until [6115]
377 equals( jQuery.timers.length, 0, "Make sure synchronic animations are not left on jQuery.timers" );
379 equals( counter, 1, "One synchronic animations" );
381 $elems.animate( { a:2 }, 0, function(){
382 ok( true, "Animate a second simple property." );
386 equals( counter, 3, "Multiple synchronic animations" );
388 $elems.eq(0).animate( {a:3}, 0, function(){
389 ok( true, "Animate a third simple property." );
392 $elems.eq(1).animate( {a:3}, 200, function(){
394 // Failed until [6115]
395 equals( counter, 5, "One synchronic and one asynchronic" );
399 var $elem = jQuery("<div />");
400 $elem.show(0, function(){
401 ok(true, "Show callback with no duration");
403 $elem.hide(0, function(){
404 ok(true, "Hide callback with no duration");
407 // manually clean up detached elements
411 test("animate hyphenated properties", function(){
416 .css("font-size", 10)
417 .animate({"font-size": 20}, 200, function(){
418 equals( this.style.fontSize, "20px", "The font-size property was animated." );
423 test("animate non-element", function(){
427 var obj = { test: 0 };
429 jQuery(obj).animate({test: 200}, 200, function(){
430 equals( obj.test, 200, "The custom property should be modified." );
435 test("stop()", function() {
439 var $foo = jQuery("#foo");
441 $foo.hide().width(200).width();
443 $foo.animate({ width:'show' }, 1000);
444 setTimeout(function(){
445 var nw = $foo.width();
446 notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
450 notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
451 setTimeout(function(){
453 $foo.removeData(undefined, true);
454 equals( nw, $foo.width(), "The animation didn't continue" );
460 test("stop() - several in queue", function() {
464 var $foo = jQuery("#foo");
466 $foo.hide().width(200).width();
468 $foo.animate({ width:'show' }, 1000);
469 $foo.animate({ width:'hide' }, 1000);
470 $foo.animate({ width:'show' }, 1000);
471 setTimeout(function(){
472 equals( $foo.queue().length, 3, "All 3 still in the queue" );
473 var nw = $foo.width();
474 notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
478 notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
485 test("stop(clearQueue)", function() {
489 var $foo = jQuery("#foo");
491 $foo.hide().width(200).width();
493 $foo.animate({ width:'show' }, 1000);
494 $foo.animate({ width:'hide' }, 1000);
495 $foo.animate({ width:'show' }, 1000);
496 setTimeout(function(){
497 var nw = $foo.width();
498 ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
502 ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
504 equals( $foo.queue().length, 0, "The animation queue was cleared" );
505 setTimeout(function(){
506 equals( nw, $foo.width(), "The animation didn't continue" );
512 test("stop(clearQueue, gotoEnd)", function() {
516 var $foo = jQuery("#foo");
518 $foo.hide().width(200).width();
520 $foo.animate({ width:'show' }, 1000);
521 $foo.animate({ width:'hide' }, 1000);
522 $foo.animate({ width:'show' }, 1000);
523 $foo.animate({ width:'hide' }, 1000);
524 setTimeout(function(){
525 var nw = $foo.width();
526 ok( nw != w, "An animation occurred " + nw + "px " + w + "px");
527 $foo.stop(false, true);
530 // Disabled, being flaky
531 //equals( nw, 1, "Stop() reset the animation" );
533 setTimeout(function(){
534 // Disabled, being flaky
535 //equals( $foo.queue().length, 2, "The next animation continued" );
542 test("toggle()", function() {
544 var x = jQuery("#foo");
545 ok( x.is(":visible"), "is visible" );
547 ok( x.is(":hidden"), "is hidden" );
549 ok( x.is(":visible"), "is visible again" );
552 ok( x.is(":visible"), "is visible" );
554 ok( x.is(":hidden"), "is hidden" );
556 ok( x.is(":visible"), "is visible again" );
559 jQuery.checkOverflowDisplay = function(){
560 var o = jQuery.css( this, "overflow" );
562 equals(o, "visible", "Overflow should be visible: " + o);
563 equals(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
568 test("support negative values < -10000 (bug #7193)", function () {
572 jQuery.extend(jQuery.fx.step, {
573 "marginBottom": function(fx) {
574 equals( fx.cur(), -11000, "Element has margin-bottom of -11000" );
575 delete jQuery.fx.step.marginBottom;
579 jQuery("#main").css("marginBottom", "-11000px").animate({ marginBottom: "-11001px" }, {
585 test("JS Overflow and Display", function() {
588 jQuery.makeTest( "JS Overflow and Display" )
589 .addClass("widewidth")
590 .css({ overflow: "visible", display: "inline" })
591 .addClass("widewidth")
592 .text("Some sample text.")
593 .before("text before")
595 .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
598 test("CSS Overflow and Display", function() {
601 jQuery.makeTest( "CSS Overflow and Display" )
602 .addClass("overflow inline")
603 .addClass("widewidth")
604 .text("Some sample text.")
605 .before("text before")
607 .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay);
611 "CSS Auto": function(elem,prop){
612 jQuery(elem).addClass("auto" + prop)
613 .text("This is a long string of text.");
616 "JS Auto": function(elem,prop){
617 jQuery(elem).css(prop,"")
618 .text("This is a long string of text.");
621 "CSS 100": function(elem,prop){
622 jQuery(elem).addClass("large" + prop);
625 "JS 100": function(elem,prop){
626 jQuery(elem).css(prop,prop == "opacity" ? 1 : "100px");
627 return prop == "opacity" ? 1 : 100;
629 "CSS 50": function(elem,prop){
630 jQuery(elem).addClass("med" + prop);
633 "JS 50": function(elem,prop){
634 jQuery(elem).css(prop,prop == "opacity" ? 0.50 : "50px");
635 return prop == "opacity" ? 0.5 : 50;
637 "CSS 0": function(elem,prop){
638 jQuery(elem).addClass("no" + prop);
641 "JS 0": function(elem,prop){
642 jQuery(elem).css(prop,prop == "opacity" ? 0 : "0px");
647 "show": function(elem,prop){
648 jQuery(elem).hide().addClass("wide"+prop);
651 "hide": function(elem,prop){
652 jQuery(elem).addClass("wide"+prop);
655 "100": function(elem,prop){
656 jQuery(elem).addClass("wide"+prop);
657 return prop == "opacity" ? 1 : 100;
659 "50": function(elem,prop){
660 return prop == "opacity" ? 0.50 : 50;
662 "0": function(elem,prop){
663 jQuery(elem).addClass("noback");
667 test(fn + " to " + tn, function() {
668 var elem = jQuery.makeTest( fn + " to " + tn );
670 var t_w = t( elem, "width" );
671 var f_w = f( elem, "width" );
672 var t_h = t( elem, "height" );
673 var f_h = f( elem, "height" );
674 var t_o = t( elem, "opacity" );
675 var f_o = f( elem, "opacity" );
679 if ( t_h == "show" ) num++;
680 if ( t_w == "show" ) num++;
681 if ( t_w == "hide"||t_w == "show" ) num++;
682 if ( t_h == "hide"||t_h == "show" ) num++;
683 if ( t_o == "hide"||t_o == "show" ) num++;
684 if ( t_w == "hide" ) num++;
685 if ( t_o.constructor == Number ) num += 2;
686 if ( t_w.constructor == Number ) num += 2;
687 if ( t_h.constructor == Number ) num +=2;
692 var anim = { width: t_w, height: t_h, opacity: t_o };
694 elem.animate(anim, 50, function(){
696 equals( this.style.display, "block", "Showing, display should block: " + this.style.display);
698 if ( t_w == "hide"||t_w == "show" )
699 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);
701 if ( t_h == "hide"||t_h == "show" )
702 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);
704 var cur_o = jQuery.style(this, "opacity");
706 if ( t_o == "hide" || t_o == "show" )
707 equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o);
710 equals(this.style.display, "none", "Hiding, display should be none: " + this.style.display);
712 if ( t_o.constructor == Number ) {
713 equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o);
715 ok(jQuery.css(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o);
718 if ( t_w.constructor == Number ) {
719 equals(this.style.width, t_w + "px", "Final width should be " + t_w + ": " + this.style.width);
721 var cur_w = jQuery.css(this,"width");
723 ok(this.style.width != "" || cur_w == t_w, "Width should be explicitly set to " + t_w + ", is instead: " + cur_w);
726 if ( t_h.constructor == Number ) {
727 equals(this.style.height, t_h + "px", "Final height should be " + t_h + ": " + this.style.height);
729 var cur_h = jQuery.css(this,"height");
731 ok(this.style.height != "" || cur_h == t_h, "Height should be explicitly set to " + t_h + ", is instead: " + cur_w);
734 if ( t_h == "show" ) {
735 var old_h = jQuery.css(this, "height");
736 jQuery(this).append("<br/>Some more text<br/>and some more...");
738 if ( /Auto/.test( fn ) ) {
739 notEqual(jQuery.css(this, "height"), old_h, "Make sure height is auto.");
741 equals(jQuery.css(this, "height"), old_h, "Make sure height is not auto.");
745 // manually remove generated element
746 jQuery(this).remove();
754 jQuery.fn.saveState = function(hiddenOverflow){
755 var check = ['opacity','height','width','display','overflow'];
756 expect(check.length);
759 return this.each(function(){
762 jQuery.each(check, function(i,c){
763 self.save[c] = c === "overflow" && hiddenOverflow ? "hidden" : self.style[ c ] || jQuery.css(self,c);
768 jQuery.checkState = function(){
770 jQuery.each(this.save, function(c,v){
771 var cur = self.style[ c ] || jQuery.css(self, c);
772 equals( cur, v, "Make sure that " + c + " is reset (Old: " + v + " Cur: " + cur + ")");
775 // manually clean data on modified element
776 jQuery.removeData(this, 'olddisplay', true);
782 test("Chain fadeOut fadeIn", function() {
783 jQuery('#fadein div').saveState().fadeOut('fast').fadeIn('fast',jQuery.checkState);
785 test("Chain fadeIn fadeOut", function() {
786 jQuery('#fadeout div').saveState().fadeIn('fast').fadeOut('fast',jQuery.checkState);
789 test("Chain hide show", function() {
790 jQuery('#show div').saveState(jQuery.support.shrinkWrapBlocks).hide('fast').show('fast',jQuery.checkState);
792 test("Chain show hide", function() {
793 jQuery('#hide div').saveState(jQuery.support.shrinkWrapBlocks).show('fast').hide('fast',jQuery.checkState);
795 test("Chain show hide with easing and callback", function() {
796 jQuery('#hide div').saveState().show('fast').hide('fast','linear',jQuery.checkState);
799 test("Chain toggle in", function() {
800 jQuery('#togglein div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState);
802 test("Chain toggle out", function() {
803 jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState);
805 test("Chain toggle out with easing and callback", function() {
806 jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast','linear',jQuery.checkState);
808 test("Chain slideDown slideUp", function() {
809 jQuery('#slidedown div').saveState(jQuery.support.shrinkWrapBlocks).slideDown('fast').slideUp('fast',jQuery.checkState);
811 test("Chain slideUp slideDown", function() {
812 jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast',jQuery.checkState);
814 test("Chain slideUp slideDown with easing and callback", function() {
815 jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast','linear',jQuery.checkState);
818 test("Chain slideToggle in", function() {
819 jQuery('#slidetogglein div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState);
821 test("Chain slideToggle out", function() {
822 jQuery('#slidetoggleout div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState);
825 test("Chain fadeToggle in", function() {
826 jQuery('#fadetogglein div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState);
828 test("Chain fadeToggle out", function() {
829 jQuery('#fadetoggleout div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState);
832 test("Chain fadeTo 0.5 1.0 with easing and callback)", function() {
833 jQuery('#fadeto div').saveState().fadeTo('fast',0.5).fadeTo('fast',1.0,'linear',jQuery.checkState);
836 jQuery.makeTest = function( text ){
837 var elem = jQuery("<div></div>")
838 .attr("id", "test" + jQuery.makeTest.id++)
843 .appendTo("#fx-tests")
849 jQuery.makeTest.id = 1;
851 test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function () {
855 var $checkedtest = jQuery("#checkedtest");
856 // IE6 was clearing "checked" in jQuery(elem).show("fast");
857 $checkedtest.hide().show("fast", function() {
858 ok( !! jQuery(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
859 ok( ! jQuery(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
860 ok( !! jQuery(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
861 ok( ! jQuery(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
866 test("animate with per-property easing", function(){
871 var _test1_called = false;
872 var _test2_called = false;
873 var _default_test_called = false;
875 jQuery.easing['_test1'] = function() {
876 _test1_called = true;
879 jQuery.easing['_test2'] = function() {
880 _test2_called = true;
883 jQuery.easing['_default_test'] = function() {
884 _default_test_called = true;
887 jQuery({a:0,b:0,c:0}).animate({
891 }, 400, '_default_test', function(){
893 ok(_test1_called, "Easing function (1) called");
894 ok(_test2_called, "Easing function (2) called");
895 ok(_default_test_called, "Easing function (_default) called");
900 test("hide hidden elements (bug #7141)", function() {
904 var div = jQuery("<div style='display:none'></div>").appendTo("#main");
905 equals( div.css("display"), "none", "Element is hidden by default" );
907 ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
909 equals( div.css("display"), "block", "Show a double-hidden element" );
914 test("hide hidden elements, with animation (bug #7141)", function() {
919 var div = jQuery("<div style='display:none'></div>").appendTo("#main");
920 equals( div.css("display"), "none", "Element is hidden by default" );
921 div.hide(1, function () {
922 ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
923 div.show(1, function () {
924 equals( div.css("display"), "block", "Show a double-hidden element" );