diff options
author | John Resig <jeresig@gmail.com> | 2010-10-11 07:45:15 -0400 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2010-10-11 07:45:15 -0400 |
commit | 385ca2aa899d2ed953d9e18c95387e72e330b42c (patch) | |
tree | 56fec240be4e1111532fdf9350103ccbc0954abf /test/unit/traversing.js | |
parent | 2c04035cd1d7cb1e73c6e9b2d63fc77e5165b8fc (diff) | |
download | jquery-385ca2aa899d2ed953d9e18c95387e72e330b42c.tar.gz jquery-385ca2aa899d2ed953d9e18c95387e72e330b42c.zip |
Make sure closest works on disconnected DOM nodes. Fixes #7142.
Diffstat (limited to 'test/unit/traversing.js')
-rw-r--r-- | test/unit/traversing.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 0636f0c33..f9e79372a 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -122,7 +122,7 @@ test("filter(jQuery)", function() { }) test("closest()", function() { - expect(10); + expect(11); same( jQuery("body").closest("body").get(), q("body"), "closest(body)" ); same( jQuery("body").closest("html").get(), q("html"), "closest(html)" ); same( jQuery("body").closest("div").get(), [], "closest(div)" ); @@ -139,7 +139,9 @@ test("closest()", function() { //Test that .closest() returns unique'd set equals( jQuery('#main p').closest('#main').length, 1, "Closest should return a unique set" ); - + + // Test on disconnected node + equals( jQuery("<div><p></p></div>").find("p").closest("table").length, 0, "Make sure disconnected closest work." ); }); test("closest(Array)", function() { |