Skip to content

Commit 40aa95c

Browse files
committed
Don't test inline-block in browsers that don't support it (or an approximation of it, like IE).
1 parent 2d5f866 commit 40aa95c

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

test/unit/effects.js

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,56 @@ test("animate negative height", function() {
127127

128128
test("animate block as inline width/height", function() {
129129
expect(3);
130-
stop();
131-
jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() {
132-
equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
133-
equals( this.offsetWidth, 42, "width was animated" );
134-
equals( this.offsetHeight, 42, "height was animated" );
135-
start();
136-
});
130+
131+
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
132+
expected = span.css("display");
133+
134+
span.remove();
135+
136+
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
137+
stop();
138+
139+
jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() {
140+
equals( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
141+
equals( this.offsetWidth, 42, "width was animated" );
142+
equals( this.offsetHeight, 42, "height was animated" );
143+
start();
144+
});
145+
146+
// Browser doesn't support inline-block
147+
} else {
148+
ok( true, "Browser doesn't support inline-block" );
149+
ok( true, "Browser doesn't support inline-block" );
150+
ok( true, "Browser doesn't support inline-block" );
151+
}
137152
});
138153

139154
test("animate native inline width/height", function() {
140155
expect(3);
141-
stop();
142-
jQuery("#foo").css({ display: "", width: '', height: '' })
143-
.append('<span>text</span>')
144-
.children('span')
145-
.animate({ width: 42, height: 42 }, 100, function() {
146-
equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
147-
equals( this.offsetWidth, 42, "width was animated" );
148-
equals( this.offsetHeight, 42, "height was animated" );
149-
start();
150-
});
156+
157+
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
158+
expected = span.css("display");
159+
160+
span.remove();
161+
162+
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
163+
stop();
164+
jQuery("#foo").css({ display: "", width: '', height: '' })
165+
.append('<span>text</span>')
166+
.children('span')
167+
.animate({ width: 42, height: 42 }, 100, function() {
168+
equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
169+
equals( this.offsetWidth, 42, "width was animated" );
170+
equals( this.offsetHeight, 42, "height was animated" );
171+
start();
172+
});
173+
174+
// Browser doesn't support inline-block
175+
} else {
176+
ok( true, "Browser doesn't support inline-block" );
177+
ok( true, "Browser doesn't support inline-block" );
178+
ok( true, "Browser doesn't support inline-block" );
179+
}
151180
});
152181

153182
test("animate block width/height", function() {

0 commit comments

Comments
 (0)