File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import {
66import { isConstructor } from 'shared/validators'
77
88function vmMatchesName ( vm , name ) {
9- const normalize = ( name = '' ) => name . replace ( / - / gi , '' ) . toLowerCase ( )
10- const normalizedName = normalize ( name )
9+ const lc = ( name = '' ) => name . toLowerCase ( )
10+ const lowerCaseName = lc ( name )
1111 return (
1212 ! ! name &&
13- ( normalize ( vm . name ) === normalizedName ||
14- ( vm . $options && normalize ( vm . $options . name ) === normalizedName ) )
13+ ( lc ( vm . name ) === lowerCaseName ||
14+ ( vm . $options && lc ( vm . $options . name ) === lowerCaseName ) )
1515 )
1616}
1717
Original file line number Diff line number Diff line change @@ -431,18 +431,20 @@ describeWithShallowAndMount('find', mountingMethod => {
431431 )
432432 } )
433433
434- it ( 'returns a Wrapper matching a component pascal case name in options object' , ( ) => {
434+ it ( 'returns a Wrapper matching a component camel case name in options object' , ( ) => {
435435 const wrapper = mountingMethod ( ComponentWithChild )
436- expect ( wrapper . find ( { name : 'TestComponent ' } ) . name ( ) ) . to . equal (
436+ expect ( wrapper . find ( { name : 'test-Component ' } ) . name ( ) ) . to . equal (
437437 'test-component'
438438 )
439439 } )
440440
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- )
441+ it ( 'returns a Wrapper matching a name disregarding case in options object' , ( ) => {
442+ const component = {
443+ name : 'CamelCase' ,
444+ render : h => h ( 'div' )
445+ }
446+ const wrapper = mountingMethod ( component )
447+ expect ( wrapper . find ( { name : 'camelCase' } ) . name ( ) ) . to . equal ( 'CamelCase' )
446448 } )
447449
448450 it ( 'returns Wrapper of Vue Component matching the ref in options object' , ( ) => {
You can’t perform that action at this time.
0 commit comments