Skip to content

Commit 8607c28

Browse files
committed
fix: only match by capitalize
1 parent 82bd743 commit 8607c28

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

packages/test-utils/src/matches.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import {
44
FUNCTIONAL_OPTIONS
55
} from 'shared/consts'
66
import { isConstructor } from 'shared/validators'
7+
import { capitalize } from 'shared/util'
78

89
function vmMatchesName(vm, name) {
9-
const lc = (name = '') => name.toLowerCase()
10-
const lowerCaseName = lc(name)
1110
return (
12-
!!name &&
13-
(lc(vm.name) === lowerCaseName ||
14-
(vm.$options && lc(vm.$options.name) === lowerCaseName))
11+
!!name && (
12+
vm.name === name ||
13+
(vm.$options && vm.$options.name === name) ||
14+
vm.name === capitalize(name) ||
15+
vm.$options && vm.$options.name === capitalize(name)
16+
)
1517
)
1618
}
1719

test/specs/wrapper/find.spec.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,7 @@ describeWithShallowAndMount('find', mountingMethod => {
431431
)
432432
})
433433

434-
it('returns a Wrapper matching a component camel case name in options object', () => {
435-
const wrapper = mountingMethod(ComponentWithChild)
436-
expect(wrapper.find({ name: 'test-Component' }).name()).to.equal(
437-
'test-component'
438-
)
439-
})
440-
441-
it('returns a Wrapper matching a name disregarding case in options object', () => {
434+
it('returns a Wrapper matching a camelCase name option and a Pascal Case component name ', () => {
442435
const component = {
443436
name: 'CamelCase',
444437
render: h => h('div')

0 commit comments

Comments
 (0)