Fix a some inaccuracies in the original test case for #7912.
- Use fresh div instead of one outside the test-fixture - make sure the empty string test tests actually that (not 0% 0%) - actually test for < -10000 (#7193) - fixed some whitespace issues
This commit is contained in:
parent
85d9343271
commit
4b91b918a3
48
test/unit/effects.js
vendored
48
test/unit/effects.js
vendored
|
@ -558,42 +558,52 @@ jQuery.checkOverflowDisplay = function(){
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
test("jQuery.fx.prototype.cur()", function() {
|
test( "jQuery.fx.prototype.cur()", 6, function() {
|
||||||
expect(5);
|
var div = jQuery( "<div></div>" ).appendTo( "#main" ).css({
|
||||||
var nothiddendiv = jQuery('#nothiddendiv').css({
|
color: "#ABC",
|
||||||
color: '#ABC',
|
border: "5px solid black",
|
||||||
border: '5px solid black',
|
left: "auto",
|
||||||
left: 'auto',
|
marginBottom: "-11000px"
|
||||||
marginBottom: '11000px'
|
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
equals(
|
equals(
|
||||||
(new jQuery.fx( nothiddendiv, {}, 'color' )).cur(),
|
( new jQuery.fx( div, {}, "color" ) ).cur(),
|
||||||
jQuery.css( nothiddendiv,'color' ),
|
jQuery.css( div, "color" ),
|
||||||
"Return the same value as jQuery.css for complex properties (bug #7912)"
|
"Return the same value as jQuery.css for complex properties (bug #7912)"
|
||||||
);
|
);
|
||||||
|
|
||||||
strictEqual(
|
strictEqual(
|
||||||
(new jQuery.fx( nothiddendiv, {}, 'borderLeftWidth' )).cur(),
|
( new jQuery.fx( div, {}, "borderLeftWidth" ) ).cur(),
|
||||||
5,
|
5,
|
||||||
"Return simple values parsed as Float"
|
"Return simple values parsed as Float"
|
||||||
);
|
);
|
||||||
|
|
||||||
strictEqual(
|
// backgroundPosition actually returns 0% 0% in most browser
|
||||||
(new jQuery.fx( nothiddendiv, {}, 'backgroundPosition' )).cur(),
|
// this fakes a "" return
|
||||||
0,
|
jQuery.cssHooks.backgroundPosition = {
|
||||||
'Return 0 when jQuery.css returns an empty string'
|
get: function() {
|
||||||
);
|
ok( true, "hook used" );
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
strictEqual(
|
strictEqual(
|
||||||
(new jQuery.fx( nothiddendiv, {}, 'left' )).cur(),
|
( new jQuery.fx( div, {}, "backgroundPosition" ) ).cur(),
|
||||||
0,
|
0,
|
||||||
'Return 0 when jQuery.css returns "auto"'
|
"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(
|
equals(
|
||||||
(new jQuery.fx( nothiddendiv, {}, 'marginBottom' )).cur(),
|
( new jQuery.fx( div, {}, "marginBottom" ) ).cur(),
|
||||||
11000,
|
-11000,
|
||||||
"support negative values < -10000 (bug #7193)"
|
"support negative values < -10000 (bug #7193)"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue