File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function vmMatchesName(vm, name) {
1010 // We want to mirror how Vue resolves component names in SFCs:
1111 // For example, <test-component />, <TestComponent /> and `<testComponent />
1212 // all resolve to the same component
13- const componentName = ( vm . $options && vm . $options . name ) || ''
13+ const componentName = vm . name || ( vm . $options && vm . $options . name ) || ''
1414 return (
1515 ! ! name &&
1616 ( componentName === name ||
@@ -56,13 +56,7 @@ export function matches(node, selector) {
5656 return element && element . matches && element . matches ( selector . value )
5757 }
5858
59- const isFunctionalSelector = isConstructor ( selector . value )
60- ? selector . value . options . functional
61- : selector . value . functional
62-
63- const componentInstance = isFunctionalSelector
64- ? node [ FUNCTIONAL_OPTIONS ]
65- : node . child
59+ const componentInstance = node [ FUNCTIONAL_OPTIONS ] || node . child
6660
6761 if ( ! componentInstance ) {
6862 return false
Original file line number Diff line number Diff line change @@ -257,6 +257,28 @@ describeWithShallowAndMount('find', mountingMethod => {
257257 }
258258 } )
259259
260+ itSkipIf (
261+ vueVersion < 2.3 ,
262+ 'returns functional component with name by name' ,
263+ ( ) => {
264+ const TestFunctionalComponent = {
265+ render : h => h ( 'div' ) ,
266+ functional : true ,
267+ name : 'test-functional-component'
268+ }
269+ const TestComponent = {
270+ template : '<div><test-functional-component /></div>' ,
271+ components : {
272+ TestFunctionalComponent
273+ }
274+ }
275+ const wrapper = mountingMethod ( TestComponent )
276+ expect (
277+ wrapper . find ( { name : 'test-functional-component' } ) . exists ( )
278+ ) . toEqual ( true )
279+ }
280+ )
281+
260282 it ( 'returns extended functional component' , ( ) => {
261283 const TestFunctionalComponent = Vue . extend ( {
262284 render : h => h ( 'div' ) ,
You can’t perform that action at this time.
0 commit comments