X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Ffx.js;h=b9597993863b391f82f276673282b2eaa779ed47;hb=93fdbeb963a9c350f807818c7cc99982942a92f3;hp=da22de229593394078f039227b57c4d8922ebac0;hpb=25c188b6d2b8a8758c2bd97ca45e0fb14b869431;p=jquery.git diff --git a/test/unit/fx.js b/test/unit/fx.js index da22de2..b959799 100644 --- a/test/unit/fx.js +++ b/test/unit/fx.js @@ -41,6 +41,43 @@ test("show()", function() { }); }); +test("show(Number) - other displays", function() { + expect(15); + reset(); + stop(); + + jQuery("#main").append('

'); + + var old = jQuery("#show-tests table").show().css("display") !== "table", + num = 0; + + var test = { + "div" : "block", + "p" : "block", + "a" : "inline", + "code" : "inline", + "pre" : "block", + "span" : "inline", + "table" : old ? "block" : "table", + "thead" : old ? "block" : "table-header-group", + "tbody" : old ? "block" : "table-row-group", + "tr" : old ? "block" : "table-row", + "th" : old ? "block" : "table-cell", + "td" : old ? "block" : "table-cell", + "ul" : "block", + "li" : old ? "block" : "list-item" + }; + + jQuery.each(test, function(selector, expected) { + var elem = jQuery(selector, "#show-tests").show(1, function() { + equals( elem.css("display"), expected, "Show using correct display type for " + selector ); + if ( ++num === 15 ) { + start(); + } + }); + }); +}); + test("animate(Hash, Object, Function)", function() { expect(1); stop(); @@ -52,6 +89,15 @@ test("animate(Hash, Object, Function)", function() { }); }); +test("animate negative height", function() { + expect(1); + stop(); + jQuery("#foo").animate({ height: -100 }, 100, function() { + equals( this.offsetHeight, 0, "Verify height." ); + start(); + }); +}); + /* // This test ends up being flaky depending upon the CPU load test("animate option (queue === false)", function () { expect(1); @@ -525,3 +571,52 @@ jQuery.makeTest = function( text ){ } jQuery.makeTest.id = 1; + +test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function () { + expect(4); + stop(); + + var $checkedtest = jQuery("#checkedtest"); + // IE6 was clearing "checked" in jQuery(elem).show("fast"); + $checkedtest.hide().show("fast", function() { + ok( !! jQuery(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." ); + ok( ! jQuery(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." ); + ok( !! jQuery(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." ); + ok( ! jQuery(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." ); + start(); + }); +}); + +test("animate with per-property easing", function(){ + + expect(3); + stop(); + + var _test1_called = false; + var _test2_called = false; + var _default_test_called = false; + + jQuery.easing['_test1'] = function() { + _test1_called = true; + }; + + jQuery.easing['_test2'] = function() { + _test2_called = true; + }; + + jQuery.easing['_default_test'] = function() { + _default_test_called = true; + }; + + jQuery({a:0,b:0,c:0}).animate({ + a: [100, '_test1'], + b: [100, '_test2'], + c: 100 + }, 400, '_default_test', function(){ + start(); + ok(_test1_called, "Easing function (1) called"); + ok(_test2_called, "Easing function (2) called"); + ok(_default_test_called, "Easing function (_default) called"); + }); + +}); \ No newline at end of file