+ // set offset
+ tests = [
+ { id: '#static-2', top: 200, left: 200 },
+ { id: '#static-2', top: 100, left: 100 },
+ { id: '#static-2', top: -2, left: -2 },
+ { id: '#static-2', top: 121, left: 6 },
+ { id: '#static-1-1-1', top: 50, left: 50 },
+ { id: '#static-1-1-1', top: 10, left: 10 },
+ { id: '#static-1-1-1', top: -1, left: -1 },
+ { id: '#static-1-1-1', top: 22, left: 22 },
+ { id: '#static-1-1', top: 25, left: 25 },
+ { id: '#static-1-1', top: 10, left: 10 },
+ { id: '#static-1-1', top: -3, left: -3 },
+ { id: '#static-1-1', top: 14, left: 14 },
+ { id: '#static-1', top: 30, left: 30 },
+ { id: '#static-1', top: 2, left: 2 },
+ { id: '#static-1', top: -2, left: -2 },
+ { id: '#static-1', top: 7, left: 7 }
+ ];
+ jQuery.each( tests, function() {
+ jQuery( this.id ).offset({ top: this.top, left: this.left });
+ equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
+ equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
+
+ jQuery( this.id ).offset({ top: this.top, left: this.left, using: function( props ) {
+ jQuery( this ).css({
+ top: props.top + 1,
+ left: props.left + 1
+ });
+ }});
+ equals( jQuery( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + (this.top + 1) + ", using: fn })" );
+ equals( jQuery( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + (this.left + 1) + ", using: fn })" );
+ });
+});
+
+testoffset("fixed", function( jQuery ) {
+ expect(28);
+
+ jQuery.offset.initialize();
+
+ var tests = [
+ { id: '#fixed-1', top: 1001, left: 1001 },
+ { id: '#fixed-2', top: 1021, left: 1021 }
+ ];
+ jQuery.each( tests, function() {
+ if ( jQuery.offset.supportsFixedPosition ) {
+ equals( jQuery( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset().top" );
+ equals( jQuery( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset().left" );
+ } else {
+ // need to have same number of assertions
+ ok( true, 'Fixed position is not supported' );
+ ok( true, 'Fixed position is not supported' );
+ }
+ });