Skip to content

Commit

Permalink
fix: update context after setMethods (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh authored Jun 9, 2018
1 parent 583d819 commit 0590b4c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ export default class Wrapper implements BaseWrapper {
// $FlowIgnore : Problem with possibly null this.vm
this.vm.$options.methods[key] = methods[key]
})

if (this.vnode) {
const context = this.vnode.context
if (context.$options.render) context._update(context._render())
}
}

/**
Expand Down Expand Up @@ -743,13 +748,6 @@ export default class Wrapper implements BaseWrapper {
eventObject.keyCode = modifiers[event[1]]
}

// If this element's event handler has been reset by setMethod, it won't trigger
// Make sure that this element is updated with the latest event handler
if (this.vnode) {
const context = this.vnode.context
if (context.$options.render) context._update(context._render())
}

this.element.dispatchEvent(eventObject)
if (this.vnode) {
orderWatchers(this.vm || this.vnode.context.$root)
Expand Down

0 comments on commit 0590b4c

Please sign in to comment.