@@ -91,14 +91,20 @@ test("filter(jQuery)", function() {
9191} )
9292
9393test ( "closest()" , function ( ) {
94- expect ( 6 ) ;
94+ expect ( 9 ) ;
9595 isSet ( jQuery ( "body" ) . closest ( "body" ) . get ( ) , q ( "body" ) , "closest(body)" ) ;
9696 isSet ( jQuery ( "body" ) . closest ( "html" ) . get ( ) , q ( "html" ) , "closest(html)" ) ;
9797 isSet ( jQuery ( "body" ) . closest ( "div" ) . get ( ) , [ ] , "closest(div)" ) ;
9898 isSet ( jQuery ( "#main" ) . closest ( "span,#html" ) . get ( ) , q ( "html" ) , "closest(span,#html)" ) ;
9999
100100 isSet ( jQuery ( "div:eq(1)" ) . closest ( "div:first" ) . get ( ) , [ ] , "closest(div:first)" ) ;
101101 isSet ( jQuery ( "div" ) . closest ( "body:first div:last" ) . get ( ) , q ( "fx-tests" ) , "closest(body:first div:last)" ) ;
102+
103+ // Test .closest() limited by the context
104+ var jq = jQuery ( "#nothiddendivchild" ) ;
105+ isSet ( jq . closest ( "html" , document . body ) . get ( ) , [ ] , "Context limited." ) ;
106+ isSet ( jq . closest ( "body" , document . body ) . get ( ) , [ ] , "Context limited." ) ;
107+ isSet ( jq . closest ( "#nothiddendiv" , document . body ) . get ( ) , q ( "nothiddendiv" ) , "Context not reached." ) ;
102108} ) ;
103109
104110test ( "not(Selector)" , function ( ) {
0 commit comments