X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Foffset.js;fp=test%2Funit%2Foffset.js;h=3b6af50e1d0cc16c856205bac57c2bb1fc652679;hb=656fe92178fda539d91fe31965b28bccff484778;hp=ef84e5cd0faf1d1558788d1122f113f343ba7262;hpb=08cf82e88e7a1f88da34ca251335a685889f8765;p=jquery.git diff --git a/test/unit/offset.js b/test/unit/offset.js index ef84e5c..3b6af50 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -35,7 +35,7 @@ testoffset("absolute"/* in iframe */, function($, iframe) { }); testoffset("absolute", function( jQuery ) { - expect(176); + expect(178); // get offset tests var tests = [ @@ -62,6 +62,11 @@ testoffset("absolute", function( jQuery ) { equals( jQuery( this.id ).position().left, this.left, "jQuery('" + this.id + "').position().left" ); }); + // test #5781 + var offset = jQuery( '#positionTest' ).offset({ top: 10, left: 10 }).offset(); + equals( offset.top, 10, "Setting offset on element with position absolute but 'auto' values." ) + equals( offset.left, 10, "Setting offset on element with position absolute but 'auto' values." ) + // set offset tests = [ @@ -97,8 +102,9 @@ testoffset("absolute", function( jQuery ) { equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + " })" ); equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + " })" ); - jQuery( this.id ).offset({ top: this.top + 2 }); - jQuery( this.id ).offset({ left: this.left + 2 }); + jQuery( this.id ) + .offset({ left: this.left + 2 }) + .offset({ top: this.top + 2 }); equals( jQuery( this.id ).offset().top, this.top + 2, "Setting one property at a time." ); equals( jQuery( this.id ).offset().left, this.left + 2, "Setting one property at a time." );