@@ -207,7 +207,7 @@ describe('babel-plugin-transform-vue-jsx', () => {
207
207
expect ( vnode . data . class ) . to . deep . equal ( { a : true , b : true } )
208
208
} )
209
209
210
- it ( 'h self-defining in object methods' , ( ) => {
210
+ it ( 'h injection in object methods' , ( ) => {
211
211
const obj = {
212
212
method ( ) {
213
213
return < div > test</ div >
@@ -218,7 +218,24 @@ describe('babel-plugin-transform-vue-jsx', () => {
218
218
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'test' )
219
219
} )
220
220
221
- it ( 'h self-defining in object getters' , ( ) => {
221
+ it ( 'h should not be injected in nested JSX expressions' , ( ) => {
222
+ const obj = {
223
+ method ( ) {
224
+ return < div foo = { {
225
+ render ( ) {
226
+ return < div > bar</ div >
227
+ }
228
+ } } > test</ div >
229
+ }
230
+ }
231
+ const vnode = render ( h => obj . method . call ( { $createElement : h } ) )
232
+ expect ( vnode . tag ) . to . equal ( 'div' )
233
+ const nested = vnode . data . attrs . foo . render ( )
234
+ expect ( nested . tag ) . to . equal ( 'div' )
235
+ expect ( nested . children [ 0 ] . text ) . to . equal ( 'bar' )
236
+ } )
237
+
238
+ it ( 'h injection in object getters' , ( ) => {
222
239
const obj = {
223
240
get computed ( ) {
224
241
return < div > test</ div >
@@ -232,7 +249,7 @@ describe('babel-plugin-transform-vue-jsx', () => {
232
249
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'test' )
233
250
} )
234
251
235
- it ( 'h self-defining in multi-level object getters' , ( ) => {
252
+ it ( 'h injection in multi-level object getters' , ( ) => {
236
253
const obj = {
237
254
inherited : {
238
255
get computed ( ) {
@@ -248,7 +265,7 @@ describe('babel-plugin-transform-vue-jsx', () => {
248
265
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'test' )
249
266
} )
250
267
251
- it ( 'h self-defining in class methods' , ( ) => {
268
+ it ( 'h injection in class methods' , ( ) => {
252
269
class Test {
253
270
constructor ( h ) {
254
271
this . $createElement = h
@@ -262,7 +279,7 @@ describe('babel-plugin-transform-vue-jsx', () => {
262
279
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'test' )
263
280
} )
264
281
265
- it ( 'h self-defining in class getters' , ( ) => {
282
+ it ( 'h injection in class getters' , ( ) => {
266
283
class Test {
267
284
constructor ( h ) {
268
285
this . $createElement = h
@@ -276,7 +293,7 @@ describe('babel-plugin-transform-vue-jsx', () => {
276
293
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'test' )
277
294
} )
278
295
279
- it ( 'h self-defining in methods with parameters' , ( ) => {
296
+ it ( 'h injection in methods with parameters' , ( ) => {
280
297
class Test {
281
298
constructor ( h ) {
282
299
this . $createElement = h
0 commit comments