@@ -358,7 +358,10 @@ class ReactWrapper {
358358 * @returns {Boolean }
359359 */
360360 matchesElement ( node ) {
361- return this . single ( 'matchesElement' , ( ) => nodeMatches ( node , this . getNodeInternal ( ) , ( a , b ) => a <= b ) ) ;
361+ return this . single ( 'matchesElement' , ( ) => {
362+ const rstNode = getAdapter ( ) . elementToNode ( node ) ;
363+ return nodeMatches ( rstNode , this . getNodeInternal ( ) , ( a , b ) => a <= b ) ;
364+ } ) ;
362365 }
363366
364367 /**
@@ -374,9 +377,16 @@ class ReactWrapper {
374377 * @returns {Boolean }
375378 */
376379 contains ( nodeOrNodes ) {
380+ const adapter = getAdapter ( this [ OPTIONS ] ) ;
381+
377382 const predicate = Array . isArray ( nodeOrNodes )
378- ? other => containsChildrenSubArray ( nodeEqual , other , nodeOrNodes )
379- : other => nodeEqual ( nodeOrNodes , other ) ;
383+ ? other => containsChildrenSubArray (
384+ nodeEqual ,
385+ other ,
386+ nodeOrNodes . map ( node => adapter . elementToNode ( node ) ) ,
387+ )
388+ : other => nodeEqual ( adapter . elementToNode ( nodeOrNodes ) , other ) ;
389+
380390 return findWhereUnwrapped ( this , predicate ) . length > 0 ;
381391 }
382392
@@ -397,7 +407,8 @@ class ReactWrapper {
397407 * @returns {Boolean }
398408 */
399409 containsMatchingElement ( node ) {
400- const predicate = other => nodeMatches ( node , other , ( a , b ) => a <= b ) ;
410+ const rstNode = getAdapter ( this [ OPTIONS ] ) . elementToNode ( node ) ;
411+ const predicate = other => nodeMatches ( rstNode , other , ( a , b ) => a <= b ) ;
401412 return findWhereUnwrapped ( this , predicate ) . length > 0 ;
402413 }
403414
0 commit comments