@@ -112,8 +112,7 @@ describe('codegen', () => {
112
112
it ( 'generate slot fallback content' , ( ) => {
113
113
assertCodegen (
114
114
'<slot><div>hi</div></slot>' ,
115
- `with(this){return _t("default",[_m(0)])}` ,
116
- [ `with(this){return _h('div',["hi"])}` ]
115
+ `with(this){return _t("default",[_h('div',["hi"])])}`
117
116
)
118
117
} )
119
118
@@ -128,8 +127,7 @@ describe('codegen', () => {
128
127
// static
129
128
assertCodegen (
130
129
'<p class="class1">hello world</p>' ,
131
- 'with(this){return _m(0)}' ,
132
- [ `with(this){return _h('p',{staticClass:"class1"},["hello world"])}` ]
130
+ `with(this){return _h('p',{staticClass:"class1"},["hello world"])}` ,
133
131
)
134
132
// dynamic
135
133
assertCodegen (
@@ -169,8 +167,7 @@ describe('codegen', () => {
169
167
it ( 'generate static attrs' , ( ) => {
170
168
assertCodegen (
171
169
'<input name="field1">' ,
172
- `with(this){return _m(0)}` ,
173
- [ `with(this){return _h('input',{attrs:{"name":"field1"}})}` ]
170
+ `with(this){return _h('input',{attrs:{"name":"field1"}})}`
174
171
)
175
172
} )
176
173
@@ -297,22 +294,22 @@ describe('codegen', () => {
297
294
it ( 'generate component with inline-template' , ( ) => {
298
295
// have "inline-template'"
299
296
assertCodegen (
300
- '<my-component inline-template><p>hello world</p></my-component>' ,
301
- `with(this){return _h('my-component',{inlineTemplate:{render:function(){with(this){return _m(0)}},staticRenderFns:[function(){with(this){return _h('p',["hello world"])}}]}})}`
297
+ '<my-component inline-template><p><span> hello world</span> </p></my-component>' ,
298
+ `with(this){return _h('my-component',{inlineTemplate:{render:function(){with(this){return _m(0)}},staticRenderFns:[function(){with(this){return _h('p',[_h('span',[ "hello world"]) ])}}]}})}`
302
299
)
303
300
// "have inline-template attrs, but not having extactly one child element
304
301
assertCodegen (
305
302
'<my-component inline-template><hr><hr></my-component>' ,
306
- `with(this){return _h('my-component',{inlineTemplate:{render:function(){with(this){return _m(0)}},staticRenderFns:[function(){with(this){return _h('hr')}}]}})}`
303
+ `with(this){return _h('my-component',{inlineTemplate:{render:function(){with(this){return _h('hr')}},staticRenderFns:[ ]}})}`
307
304
)
308
305
expect ( 'Inline-template components must have exactly one child element.' ) . toHaveBeenWarned ( )
309
306
} )
310
307
311
308
it ( 'generate static trees inside v-for' , ( ) => {
312
309
assertCodegen (
313
- `<div><div v-for="i in 10"><span></span></div></div>` ,
310
+ `<div><div v-for="i in 10"><p>< span></span></p ></div></div>` ,
314
311
`with(this){return _h('div',[_l((10),function(i){return _h('div',[_m(0,true)])})])}` ,
315
- [ `with(this){return _h('span')}` ]
312
+ [ `with(this){return _h('p',[_h(' span')] )}` ]
316
313
)
317
314
} )
318
315
0 commit comments