diff options
author | Anton M <obhvsbypqghgc@gmail.com> | 2011-02-17 19:12:57 +0100 |
---|---|---|
committer | Anton M <obhvsbypqghgc@gmail.com> | 2011-02-17 19:14:46 +0100 |
commit | 4b91b918a360d056a6e4a63ee306e97f839dac59 (patch) | |
tree | 9e48eeab866b8ffc04e149a663f4582bac905e00 /test/unit | |
parent | 85d9343271da85fc945bf37a604873eaf247a3a7 (diff) | |
download | jquery-4b91b918a360d056a6e4a63ee306e97f839dac59.tar.gz jquery-4b91b918a360d056a6e4a63ee306e97f839dac59.zip |
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
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/effects.js | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js index 4bb92fc00..c0a812f45 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -558,42 +558,52 @@ jQuery.checkOverflowDisplay = function(){ start(); } -test("jQuery.fx.prototype.cur()", function() { - expect(5); - var nothiddendiv = jQuery('#nothiddendiv').css({ - color: '#ABC', - border: '5px solid black', - left: 'auto', - marginBottom: '11000px' +test( "jQuery.fx.prototype.cur()", 6, function() { + var div = jQuery( "<div></div>" ).appendTo( "#main" ).css({ + color: "#ABC", + border: "5px solid black", + left: "auto", + marginBottom: "-11000px" })[0]; equals( - (new jQuery.fx( nothiddendiv, {}, 'color' )).cur(), - jQuery.css( nothiddendiv,'color' ), + ( 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( nothiddendiv, {}, 'borderLeftWidth' )).cur(), + ( 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 ""; + } + }; + strictEqual( - (new jQuery.fx( nothiddendiv, {}, 'backgroundPosition' )).cur(), + ( new jQuery.fx( div, {}, "backgroundPosition" ) ).cur(), 0, - 'Return 0 when jQuery.css returns an empty string' + "Return 0 when jQuery.css returns an empty string" ); + delete jQuery.cssHooks.backgroundPosition; + strictEqual( - (new jQuery.fx( nothiddendiv, {}, 'left' )).cur(), + ( new jQuery.fx( div, {}, "left" ) ).cur(), 0, - 'Return 0 when jQuery.css returns "auto"' + "Return 0 when jQuery.css returns 'auto'" ); equals( - (new jQuery.fx( nothiddendiv, {}, 'marginBottom' )).cur(), - 11000, + ( new jQuery.fx( div, {}, "marginBottom" ) ).cur(), + -11000, "support negative values < -10000 (bug #7193)" ); }); |