diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2010-03-22 20:11:37 -0400 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2010-03-22 20:11:37 -0400 |
commit | 656fe92178fda539d91fe31965b28bccff484778 (patch) | |
tree | 8a44a5facb9bb8ef805c1f96cbfd4e3cac92c3e0 /test/unit/offset.js | |
parent | 08cf82e88e7a1f88da34ca251335a685889f8765 (diff) | |
download | jquery-656fe92178fda539d91fe31965b28bccff484778.tar.gz jquery-656fe92178fda539d91fe31965b28bccff484778.zip |
Fixed an issue with setting offset of absolutely positioned element that has no position values ("auto"). Fixes #5781.
Diffstat (limited to 'test/unit/offset.js')
-rw-r--r-- | test/unit/offset.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/unit/offset.js b/test/unit/offset.js index ef84e5cd0..3b6af50e1 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." ); |