X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Feffects.js;h=c0a812f45caabcb49debc2f00380c668b2080225;hb=2ac4067a639856a6035c3bd00aab132c9714b52d;hp=7da814343467bbc9e36364beed1c1b2b6123dded;hpb=bb9408516aa0fc8892f4e07a99b1a47bce06081b;p=jquery.git diff --git a/test/unit/effects.js b/test/unit/effects.js index 7da8143..c0a812f 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -162,18 +162,6 @@ test("Persist correct display value", function() { }); }); -test("show() resolves correct default display #8099", function() { - expect(3); - var bug8099 = jQuery("").appendTo("#main"); - - equals( bug8099.css("display"), "none", "default display override for all tt" ); - equals( bug8099.show().css("display"), "inline", "Correctly resolves display:inline" ); - - bug8099.remove(); - - equals( jQuery("#foo").hide().show().css("display"), "block", "Correctly resolves display:block after hide/show" ); -}); - test("animate(Hash, Object, Function)", function() { expect(1); stop(); @@ -570,21 +558,54 @@ jQuery.checkOverflowDisplay = function(){ start(); } -test("support negative values < -10000 (bug #7193)", function () { - expect(1); - stop(); - - jQuery.extend(jQuery.fx.step, { - "marginBottom": function(fx) { - equals( fx.cur(), -11000, "Element has margin-bottom of -11000" ); - delete jQuery.fx.step.marginBottom; +test( "jQuery.fx.prototype.cur()", 6, function() { + var div = jQuery( "
" ).appendTo( "#main" ).css({ + color: "#ABC", + border: "5px solid black", + left: "auto", + marginBottom: "-11000px" + })[0]; + + equals( + ( new jQuery.fx( div, {}, "color" ) ).cur(), + jQuery.css( div, "color" ), + "Return the same value as jQuery.css for complex properties (bug #7912)" + ); + + strictEqual( + ( new jQuery.fx( div, {}, "borderLeftWidth" ) ).cur(), + 5, + "Return simple values parsed as Float" + ); + + // backgroundPosition actually returns 0% 0% in most browser + // this fakes a "" return + jQuery.cssHooks.backgroundPosition = { + get: function() { + ok( true, "hook used" ); + return ""; } - }); + }; - jQuery("#main").css("marginBottom", "-11000px").animate({ marginBottom: "-11001px" }, { - duration: 1, - complete: start - }); + strictEqual( + ( new jQuery.fx( div, {}, "backgroundPosition" ) ).cur(), + 0, + "Return 0 when jQuery.css returns an empty string" + ); + + delete jQuery.cssHooks.backgroundPosition; + + strictEqual( + ( new jQuery.fx( div, {}, "left" ) ).cur(), + 0, + "Return 0 when jQuery.css returns 'auto'" + ); + + equals( + ( new jQuery.fx( div, {}, "marginBottom" ) ).cur(), + -11000, + "support negative values < -10000 (bug #7193)" + ); }); test("JS Overflow and Display", function() {