File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
test/unit/specs/mount/options Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export default function createConstructor (
74
74
return h (
75
75
clonedComponent ,
76
76
mountingOptions . context || component . FunctionalRenderContext ,
77
- ( mountingOptions . context && mountingOptions . context . children ) || createFunctionalSlots ( mountingOptions . slots , h )
77
+ ( mountingOptions . context && mountingOptions . context . children && mountingOptions . context . children . map ( x => typeof x === 'function' ? x ( h ) : x ) ) || createFunctionalSlots ( mountingOptions . slots , h )
78
78
)
79
79
}
80
80
}
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ describe('context', () => {
66
66
expect ( wrapper . element . textContent ) . to . equal ( defaultValue )
67
67
} )
68
68
69
- it ( 'mounts functional component with a defined context.children' , ( ) => {
69
+ it ( 'mounts functional component with a defined context.children text ' , ( ) => {
70
70
const Component = {
71
71
functional : true ,
72
72
render : ( h , { children } ) => {
@@ -75,9 +75,24 @@ describe('context', () => {
75
75
}
76
76
const wrapper = mount ( Component , {
77
77
context : {
78
- children : [ 'hello ' ]
78
+ children : [ 'render text ' ]
79
79
}
80
80
} )
81
- expect ( wrapper . text ( ) ) . to . equal ( 'hello' )
81
+ expect ( wrapper . text ( ) ) . to . equal ( 'render text' )
82
+ } )
83
+
84
+ it ( 'mounts functional component with a defined context.children element' , ( ) => {
85
+ const Component = {
86
+ functional : true ,
87
+ render : ( h , { children } ) => {
88
+ return h ( 'div' , children )
89
+ }
90
+ }
91
+ const wrapper = mount ( Component , {
92
+ context : {
93
+ children : [ h => h ( 'div' , 'render component' ) ]
94
+ }
95
+ } )
96
+ expect ( wrapper . text ( ) ) . to . equal ( 'render component' )
82
97
} )
83
98
} )
You can’t perform that action at this time.
0 commit comments