File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,12 @@ import {
66import { isConstructor } from 'shared/validators'
77
88export function vmMatchesName ( vm , name ) {
9+ const normalize = ( name = '' ) => name . replace ( / - / gi, '' ) . toLowerCase ( )
10+ const normalizedName = normalize ( name )
911 return (
10- ! ! name && ( vm . name === name || ( vm . $options && vm . $options . name === name ) )
12+ ! ! name &&
13+ ( normalize ( vm . name ) === normalizedName ||
14+ ( vm . $options && normalize ( vm . $options . name ) === normalizedName ) )
1115 )
1216}
1317
Original file line number Diff line number Diff line change @@ -431,6 +431,20 @@ describeWithShallowAndMount('find', mountingMethod => {
431431 )
432432 } )
433433
434+ it ( 'returns a Wrapper matching a component pascal case name in options object' , ( ) => {
435+ const wrapper = mountingMethod ( ComponentWithChild )
436+ expect ( wrapper . find ( { name : 'TestComponent' } ) . name ( ) ) . to . equal (
437+ 'test-component'
438+ )
439+ } )
440+
441+ it ( 'returns a Wrapper matching a component camel case name in options object' , ( ) => {
442+ const wrapper = mountingMethod ( ComponentWithChild )
443+ expect ( wrapper . find ( { name : 'testComponent' } ) . name ( ) ) . to . equal (
444+ 'test-component'
445+ )
446+ } )
447+
434448 it ( 'returns Wrapper of Vue Component matching the ref in options object' , ( ) => {
435449 const wrapper = mountingMethod ( ComponentWithChild )
436450 expect ( wrapper . find ( { ref : 'child' } ) . isVueInstance ( ) ) . to . equal ( true )
You can’t perform that action at this time.
0 commit comments