File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -93,14 +93,18 @@ export function createStubFromComponent(
9393 $_vueTestUtils_original : originalComponent ,
9494 $_doNotStubChildren : true ,
9595 render ( h , context ) {
96-
97- const renderFns = this && this . $options &&
98- this . $options . parent . _vnode &&
99- this . $options . parent . _vnode . data &&
100- this . $options . parent . _vnode . data . scopedSlots &&
101- Object . keys ( this . $options . parent . _vnode . data . scopedSlots ) . filter ( x =>
102- x [ 0 ] !== '_' && ! x . includes ( '$' )
103- )
96+ // In Vue 2.6+ a new v-slot syntax was introduced
97+ // scopedSlots are now saved in parent._vnode.data.scopedSlots
98+ // We filter out the _normalized and $stable key
99+ const renderFns =
100+ this &&
101+ this . $options &&
102+ this . $options . parent . _vnode &&
103+ this . $options . parent . _vnode . data &&
104+ this . $options . parent . _vnode . data . scopedSlots &&
105+ Object . keys ( this . $options . parent . _vnode . data . scopedSlots ) . filter (
106+ x => x [ 0 ] !== '_' && ! x . includes ( '$' )
107+ )
104108 return h (
105109 tagName ,
106110 {
@@ -120,8 +124,10 @@ export function createStubFromComponent(
120124 context
121125 ? context . children
122126 : this . $options . _renderChildren ||
123- // support 2.6+ scopedSlots
124- renderFns && renderFns . map ( x => this . $options . parent . _vnode . data . scopedSlots [ x ] ( ) )
127+ ( renderFns &&
128+ renderFns . map ( x =>
129+ this . $options . parent . _vnode . data . scopedSlots [ x ] ( )
130+ ) )
125131 )
126132 }
127133 }
You can’t perform that action at this time.
0 commit comments