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 {
6
6
import { isConstructor } from 'shared/validators'
7
7
8
8
function 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 )
11
11
return (
12
12
! ! 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 ) )
15
15
)
16
16
}
17
17
Original file line number Diff line number Diff line change @@ -431,18 +431,20 @@ describeWithShallowAndMount('find', mountingMethod => {
431
431
)
432
432
} )
433
433
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' , ( ) => {
435
435
const wrapper = mountingMethod ( ComponentWithChild )
436
- expect ( wrapper . find ( { name : 'TestComponent ' } ) . name ( ) ) . to . equal (
436
+ expect ( wrapper . find ( { name : 'test-Component ' } ) . name ( ) ) . to . equal (
437
437
'test-component'
438
438
)
439
439
} )
440
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
- )
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' )
446
448
} )
447
449
448
450
it ( 'returns Wrapper of Vue Component matching the ref in options object' , ( ) => {
You can’t perform that action at this time.
0 commit comments