+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();
+ });
+});
+
+test("animate native inline width/height", function() {
+ expect(3);
+ stop();
+ jQuery("#foo").css({ display: "", width: '', height: '' })
+ .append('<span>text</span>')
+ .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();
+ });
+});
+
+test("animate block width/height", function() {
+ expect(3);
+ stop();
+ jQuery("#foo").css({ display: "block", width: 20, height: 20 }).animate({ width: 42, height: 42 }, 100, function() {
+ equals( jQuery(this).css("display"), "block", "inline-block was not set on block element when animating width/height" );
+ equals( this.offsetWidth, 42, "width was animated" );
+ equals( this.offsetHeight, 42, "height was animated" );
+ start();
+ });
+});
+
+test("animate table width/height", function() {
+ expect(1);
+ stop();
+
+ var displayMode = jQuery("#table").css("display") !== "table" ? "block" : "table";
+
+ jQuery("#table").animate({ width: 42, height: 42 }, 100, function() {
+ equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
+ start();
+ });
+});
+
+test("animate table-row width/height", function() {
+ expect(3);
+ stop();
+ var tr = jQuery("#table")
+ .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
+ .html("<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
+ .find("tr");
+
+ // IE<8 uses “block” instead of the correct display type
+ var displayMode = tr.css("display") !== "table-row" ? "block" : "table-row";
+
+ tr.animate({ width: 10, height: 10 }, 100, function() {
+ equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
+ equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
+ equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
+ start();
+ });
+});
+
+test("animate table-cell width/height", function() {
+ expect(3);
+ stop();
+ var td = jQuery("#table")
+ .attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
+ .html("<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
+ .find("td");
+
+ // IE<8 uses “block” instead of the correct display type
+ var displayMode = td.css("display") !== "table-cell" ? "block" : "table-cell";
+
+ td.animate({ width: 10, height: 10 }, 100, function() {
+ equals( jQuery(this).css("display"), displayMode, "display mode is correct" );
+ equals( this.offsetWidth, 20, "width animated to shrink wrap point" );
+ equals( this.offsetHeight, 20, "height animated to shrink wrap point" );
+ start();
+ });
+});
+
+test("animate resets overflow-x and overflow-y when finished", function() {
+ expect(2);
+ stop();
+ jQuery("#foo")
+ .css({ display: "block", width: 20, height: 20, overflowX: "visible", overflowY: "auto" })
+ .animate({ width: 42, height: 42 }, 100, function() {
+ equals( this.style.overflowX, "visible", "overflow-x is visible" );
+ equals( this.style.overflowY, "auto", "overflow-y is auto" );
+ start();
+ });
+});
+