Fixes #8509. Makes URL regexp less overzealous and ensures it recognizes URL schemes...
[jquery.git] / test / unit / effects.js
index 7fb1c7d..c0a812f 100644 (file)
@@ -558,21 +558,54 @@ jQuery.checkOverflowDisplay = function(){
        start();
 }
 
-test("support negative values < -10000 (bug #7193)", function () {
-       expect(1);
-       stop();
-
-       jQuery.extend(jQuery.fx.step, {
-               "marginBottom": function(fx) {
-                       equals( fx.cur(), -11000, "Element has margin-bottom of -11000" );
-                       delete jQuery.fx.step.marginBottom;
+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( div, {}, "color" ) ).cur(),
+               jQuery.css( div, "color" ),
+               "Return the same value as jQuery.css for complex properties (bug #7912)"
+       );
+
+       strictEqual(
+               ( 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 "";
                }
-       });
+       };
 
-       jQuery("#main").css("marginBottom", "-11000px").animate({ marginBottom: "-11001px" }, {
-               duration: 1,
-               complete: start
-       });
+       strictEqual(
+               ( new jQuery.fx( div, {}, "backgroundPosition" ) ).cur(),
+               0,
+               "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(
+               ( new jQuery.fx( div, {}, "marginBottom" ) ).cur(),
+               -11000,
+               "support negative values < -10000 (bug #7193)"
+       );
 });
 
 test("JS Overflow and Display", function() {
@@ -922,7 +955,7 @@ test("hide hidden elements, with animation (bug #7141)", function() {
 
 test("animate unit-less properties (#4966)", 2, function() {
        stop();
-       var div = jQuery( "<div style='z-index: 0'></div>" ).appendTo( "body" );
+       var div = jQuery( "<div style='z-index: 0; position: absolute;'></div>" ).appendTo( "#main" );
        equal( div.css( "z-index" ), "0", "z-index is 0" );
        div.animate({ zIndex: 2 }, function() {
                equal( div.css( "z-index" ), "2", "z-index is 2" );