Skip to content

Commit

Permalink
Fix vuejs#140
Browse files Browse the repository at this point in the history
  • Loading branch information
AkimotoAkari committed Aug 18, 2018
1 parent 2a584ec commit 3f41af3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ module.exports = function (babel) {
hasJsx: false
}
path.traverse({
'ObjectMethod|ClassMethod' (path) {
path.skip()
},
JSXElement () {
this.hasJsx = true
}
Expand Down
17 changes: 8 additions & 9 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,21 @@ describe('babel-plugin-transform-vue-jsx', () => {
})

it('duplicate h from this should be skipped', () => {
const fun = (obj) => {
const vnode = render(h => obj.rende.call({ $createElement: h }))
expect(vnode.tag).to.equal('div')
expect(vnode.children[0].text).to.equal('test')
const my = {}
my.fun = (obj) => {
const vnode = render(h => obj.render.call({ $createElement: h }, h))
}

const exported = {
methods: {
callFun () {
fun({
my.fun({
testProp: 1,
rende () {
/* eslint-disable no-unused-vars */
const h = this.$createElement
render () {
return (
<div>test</div>
<div>
<div>test</div>
</div>
)
}
})
Expand Down

0 comments on commit 3f41af3

Please sign in to comment.