Skip to content

Commit d600d53

Browse files
authored
Tests: Fix offset tests in jQuery 3.0-3.1
`.offset()` in jQuery 3.0.0-3.1.1 sometimes returns an object with more than just `top` & `left` properties. This was fixed in jQuery 3.2.0. Since we're not in a business of fixing older jQuery versions here, this commit updates the test instead. Ref jquery/jquery#3367 Ref jquerygh-352 Closes jquerygh-355
1 parent 5d18769 commit d600d53

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/offset.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
QUnit.module( "offset" );
33

44
QUnit.test( ".offset()", function( assert ) {
5-
assert.expect( 20 );
5+
assert.expect( 21 );
66

77
var bogus = { top: 0, left: 0 };
88

@@ -40,7 +40,8 @@ QUnit.test( ".offset()", function( assert ) {
4040

4141
expectWarning( assert, ".offset() as setter on disconnected node", 2,
4242
function() {
43-
var $elemInitial = jQuery( "<div />" )
43+
var offset,
44+
$elemInitial = jQuery( "<div />" )
4445
.css( "position", "fixed" ),
4546
$elem = $elemInitial
4647
.offset( { top: 42, left: 99 } );
@@ -49,7 +50,9 @@ QUnit.test( ".offset()", function( assert ) {
4950
".offset() returns a proper jQuery object" );
5051

5152
$elem.appendTo( "#qunit-fixture" );
52-
assert.deepEqual( $elem.offset(), { top: 42, left: 99 } );
53+
offset = $elem.offset();
54+
assert.strictEqual( offset.top, 42, "proper top offset" );
55+
assert.strictEqual( offset.left, 99, "proper left offset" );
5356
} );
5457

5558
expectWarning( assert, ".offset() on empty set", 2, function() {

0 commit comments

Comments
 (0)