@@ -323,7 +323,7 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( "filter() with positional select
323323} ) ;
324324
325325QUnit . test ( "closest()" , function ( assert ) {
326- assert . expect ( 13 ) ;
326+ assert . expect ( 14 ) ;
327327
328328 var jq ;
329329
@@ -344,6 +344,12 @@ QUnit.test( "closest()", function( assert ) {
344344 // Test on disconnected node
345345 assert . equal ( jQuery ( "<div><p></p></div>" ) . find ( "p" ) . closest ( "table" ) . length , 0 , "Make sure disconnected closest work." ) ;
346346
347+ assert . deepEqual (
348+ jQuery ( "#firstp" ) . closest ( q ( "qunit-fixture" ) ) . get ( ) ,
349+ q ( "qunit-fixture" ) ,
350+ "Non-string match target"
351+ ) ;
352+
347353 // Bug #7369
348354 assert . equal ( jQuery ( "<div foo='bar'></div>" ) . closest ( "[foo]" ) . length , 1 , "Disconnected nodes with attribute selector" ) ;
349355 assert . equal ( jQuery ( "<div>text</div>" ) . closest ( "[lang]" ) . length , 0 , "Disconnected nodes with text and non-existent attribute selector" ) ;
@@ -355,10 +361,17 @@ QUnit.test( "closest()", function( assert ) {
355361} ) ;
356362
357363QUnit [ jQuery . find . compile ? "test" : "skip" ] ( "closest() with positional selectors" , function ( assert ) {
358- assert . expect ( 2 ) ;
364+ assert . expect ( 3 ) ;
359365
360- assert . deepEqual ( jQuery ( "#qunit-fixture" ) . closest ( "div:first" ) . get ( ) , [ ] , "closest(div:first)" ) ;
361- assert . deepEqual ( jQuery ( "#qunit-fixture div" ) . closest ( "body:first div:last" ) . get ( ) , q ( "fx-tests" ) , "closest(body:first div:last)" ) ;
366+ assert . deepEqual ( jQuery ( "#qunit-fixture" ) . closest ( "div:first" ) . get ( ) , [ ] ,
367+ "closest(div:first)" ) ;
368+ assert . deepEqual ( jQuery ( "#qunit-fixture div" ) . closest ( "body:first div:last" ) . get ( ) , [ ] ,
369+ "closest(body:first div:last)" ) ;
370+ assert . deepEqual (
371+ jQuery ( "#qunit-fixture div" ) . closest ( "body:first div:last" , document ) . get ( ) ,
372+ [ ] ,
373+ "closest(body:first div:last, document)"
374+ ) ;
362375} ) ;
363376
364377QUnit . test ( "closest(jQuery)" , function ( assert ) {
0 commit comments