X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Feffects.js;h=6baa0f62d8025bada17888fa69d98e15e4ab0269;hb=40aa95c32097b0bc669ea5b1e127717b54b0335a;hp=2dfe834b25778a964ab56326404a281b55f7e400;hpb=2d5f8666acf9968b0424b196a26fd92a1e48125e;p=jquery.git diff --git a/test/unit/effects.js b/test/unit/effects.js index 2dfe834..6baa0f6 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -127,27 +127,56 @@ test("animate negative height", function() { test("animate block as inline width/height", function() { expect(3); - stop(); - jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() { - equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" ); - equals( this.offsetWidth, 42, "width was animated" ); - equals( this.offsetHeight, 42, "height was animated" ); - start(); - }); + + var span = jQuery("").css("display", "inline-block").appendTo("body"), + expected = span.css("display"); + + span.remove(); + + if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) { + stop(); + + jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() { + equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" ); + equals( this.offsetWidth, 42, "width was animated" ); + equals( this.offsetHeight, 42, "height was animated" ); + start(); + }); + + // Browser doesn't support inline-block + } else { + ok( true, "Browser doesn't support inline-block" ); + ok( true, "Browser doesn't support inline-block" ); + ok( true, "Browser doesn't support inline-block" ); + } }); test("animate native inline width/height", function() { expect(3); - stop(); - jQuery("#foo").css({ display: "", width: '', height: '' }) - .append('text') - .children('span') - .animate({ width: 42, height: 42 }, 100, function() { - equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" ); - equals( this.offsetWidth, 42, "width was animated" ); - equals( this.offsetHeight, 42, "height was animated" ); - start(); - }); + + var span = jQuery("").css("display", "inline-block").appendTo("body"), + expected = span.css("display"); + + span.remove(); + + if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) { + stop(); + jQuery("#foo").css({ display: "", width: '', height: '' }) + .append('text') + .children('span') + .animate({ width: 42, height: 42 }, 100, function() { + equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" ); + equals( this.offsetWidth, 42, "width was animated" ); + equals( this.offsetHeight, 42, "height was animated" ); + start(); + }); + + // Browser doesn't support inline-block + } else { + ok( true, "Browser doesn't support inline-block" ); + ok( true, "Browser doesn't support inline-block" ); + ok( true, "Browser doesn't support inline-block" ); + } }); test("animate block width/height", function() {