File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
test/integration/specs/mount/Wrapper Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,9 @@ export default class Wrapper implements BaseWrapper {
206
206
if ( ! this . isVueComponent ) {
207
207
return false
208
208
}
209
- // TODO: Throw error if component does not have name
209
+ if ( typeof selector . name !== 'string' ) {
210
+ throwError ( 'a Component used as a selector must have a name property' )
211
+ }
210
212
return vmCtorMatchesName ( this . vm , selector . name )
211
213
}
212
214
return this . element . getAttribute && this . element . matches ( selector )
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ describe('is', () => {
52
52
expect ( wrapper . is ( '#p' ) ) . to . equal ( false )
53
53
} )
54
54
55
+ it ( 'throws error if component passed to use as identifier does not have a name' , ( ) => {
56
+ const compiled = compileToFunctions ( '<div />' )
57
+ const wrapper = mount ( compiled )
58
+
59
+ const message = '[vue-test-utils]: a Component used as a selector must have a name property'
60
+ const fn = ( ) => wrapper . is ( { render : ( ) => { } } )
61
+ expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
62
+ } )
63
+
55
64
it ( 'throws an error if selector is not a valid selector' , ( ) => {
56
65
const compiled = compileToFunctions ( '<div />' )
57
66
const wrapper = mount ( compiled )
You can’t perform that action at this time.
0 commit comments