@@ -30,12 +30,29 @@ describe('contains', () => {
30
30
expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
31
31
} )
32
32
33
- it ( 'returns false if wrapper does not contain element' , ( ) => {
33
+ it ( 'returns true when wrapper contains root element' , ( ) => {
34
34
const compiled = compileToFunctions ( '<div><input /></div>' )
35
35
const wrapper = mount ( compiled )
36
36
expect ( wrapper . contains ( 'doesntexist' ) ) . to . equal ( false )
37
37
} )
38
38
39
+ it ( 'returns true if wrapper root element matches contains' , ( ) => {
40
+ const compiled = compileToFunctions ( '<div><input /></div>' )
41
+ const wrapper = mount ( compiled )
42
+ expect ( wrapper . contains ( 'doesntexist' ) ) . to . equal ( false )
43
+ } )
44
+
45
+ it ( 'returns true if wrapper root Component matches selector' , ( ) => {
46
+ const wrapper = mount ( Component )
47
+ expect ( wrapper . contains ( Component ) ) . to . equal ( true )
48
+ } )
49
+
50
+ it ( 'returns false if wrapper does not contain element' , ( ) => {
51
+ const compiled = compileToFunctions ( '<div></div>' )
52
+ const wrapper = mount ( compiled )
53
+ expect ( wrapper . contains ( 'div' ) ) . to . equal ( true )
54
+ } )
55
+
39
56
it ( 'returns false if wrapper does not contain element specified by ref selector' , ( ) => {
40
57
const compiled = compileToFunctions ( '<div><input ref="bar" /></div>' )
41
58
const wrapper = mount ( compiled )
0 commit comments