File tree Expand file tree Collapse file tree 2 files changed +39
-13
lines changed Expand file tree Collapse file tree 2 files changed +39
-13
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,32 @@ describe('vdomInterop', () => {
214214 describe . todo ( 'dynamic component' , ( ) => { } )
215215
216216 describe ( 'attribute fallthrough' , ( ) => {
217+ it ( 'should fallthrough attrs to vdom child' , ( ) => {
218+ const VDomChild = defineComponent ( {
219+ setup ( ) {
220+ return ( ) => h ( 'div' )
221+ } ,
222+ } )
223+
224+ const VaporChild = defineVaporComponent ( {
225+ setup ( ) {
226+ return createComponent (
227+ VDomChild as any ,
228+ { foo : ( ) => 'vapor foo' } ,
229+ null ,
230+ true ,
231+ )
232+ } ,
233+ } )
234+
235+ const { html } = define ( {
236+ setup ( ) {
237+ return ( ) => h ( VaporChild as any , { foo : 'foo' , bar : 'bar' } )
238+ } ,
239+ } ) . render ( )
240+ expect ( html ( ) ) . toBe ( '<div foo="foo" bar="bar"></div>' )
241+ } )
242+
217243 it ( 'should not fallthrough emit handlers to vdom child' , ( ) => {
218244 const VDomChild = defineComponent ( {
219245 emits : [ 'click' ] ,
Original file line number Diff line number Diff line change @@ -149,19 +149,6 @@ export function createComponent(
149149 resetInsertionState ( )
150150 }
151151
152- // vdom interop enabled and component is not an explicit vapor component
153- if ( appContext . vapor && ! component . __vapor ) {
154- const frag = appContext . vapor . vdomMount (
155- component as any ,
156- rawProps ,
157- rawSlots ,
158- )
159- if ( ! isHydrating && _insertionParent ) {
160- insert ( frag , _insertionParent , _insertionAnchor )
161- }
162- return frag
163- }
164-
165152 if (
166153 isSingleRoot &&
167154 component . inheritAttrs !== false &&
@@ -180,6 +167,19 @@ export function createComponent(
180167 }
181168 }
182169
170+ // vdom interop enabled and component is not an explicit vapor component
171+ if ( appContext . vapor && ! component . __vapor ) {
172+ const frag = appContext . vapor . vdomMount (
173+ component as any ,
174+ rawProps ,
175+ rawSlots ,
176+ )
177+ if ( ! isHydrating && _insertionParent ) {
178+ insert ( frag , _insertionParent , _insertionAnchor )
179+ }
180+ return frag
181+ }
182+
183183 const instance = new VaporComponentInstance (
184184 component ,
185185 rawProps as RawProps ,
You can’t perform that action at this time.
0 commit comments