aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/offset.js
diff options
context:
space:
mode:
authorKarl Swedberg <karl@englishrules.com>2010-01-21 23:18:54 +0800
committerJohn Resig <jeresig@gmail.com>2010-01-24 01:26:35 +0800
commit2c28f229e5eb49f1469fd36ee979529a492f0f42 (patch)
tree6a77ec6fee0525fd398dfea75ec69bd95d82b7d5 /test/unit/offset.js
parenta63754aa4e4e430007208d6b5cb76f9ca8c279f5 (diff)
downloadjquery-2c28f229e5eb49f1469fd36ee979529a492f0f42.tar.gz
jquery-2c28f229e5eb49f1469fd36ee979529a492f0f42.zip
fixed offset(coordinates) returns null when no matching elements in jQuery object (fixes ticket #5888)
Diffstat (limited to 'test/unit/offset.js')
-rw-r--r--test/unit/offset.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/offset.js b/test/unit/offset.js
index dc03bc2e2..dbaddc862 100644
--- a/test/unit/offset.js
+++ b/test/unit/offset.js
@@ -305,6 +305,13 @@ testoffset("body", function( jQuery ) {
equals( jQuery('body').offset().left, 1, "jQuery('#body').offset().left" );
});
+test("Chaining offset(coords) returns jQuery object", function() {
+ expect(2);
+ var coords = { top: 1, left: 1 };
+ equals( jQuery("#absolute-1").offset(coords).selector, "#absolute-1", "offset(coords) returns jQuery object" );
+ equals( jQuery("#non-existent").offset(coords).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
+});
+
test("offsetParent", function(){
expect(11);