File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
test/unit/specs/mount/Wrapper Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,10 @@ export default class Wrapper implements BaseWrapper {
217
217
}
218
218
return vmCtorMatchesName ( this . vm , selector . name )
219
219
}
220
- return this . element . getAttribute && this . element . matches ( selector )
220
+
221
+ return ! ! ( this . element &&
222
+ this . element . getAttribute &&
223
+ this . element . matches ( selector ) )
221
224
}
222
225
223
226
/**
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ describe('is', () => {
22
22
expect ( wrapper . is ( '#div' ) ) . to . equal ( true )
23
23
} )
24
24
25
+ it ( 'returns false if wrapper does not contain element' , ( ) => {
26
+ const wrapper = mount ( ComponentWithChild )
27
+ wrapper . element = null
28
+ expect ( wrapper . is ( 'a' ) ) . to . equal ( false )
29
+ } )
30
+
25
31
it ( 'returns true if root node matches Vue Component selector' , ( ) => {
26
32
const wrapper = mount ( ComponentWithChild )
27
33
const component = wrapper . findAll ( Component ) . at ( 0 )
You can’t perform that action at this time.
0 commit comments