Skip to content

Commit 0590b4c

Browse files
authored
fix: update context after setMethods (#696)
1 parent 583d819 commit 0590b4c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: packages/test-utils/src/wrapper.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ export default class Wrapper implements BaseWrapper {
501501
// $FlowIgnore : Problem with possibly null this.vm
502502
this.vm.$options.methods[key] = methods[key]
503503
})
504+
505+
if (this.vnode) {
506+
const context = this.vnode.context
507+
if (context.$options.render) context._update(context._render())
508+
}
504509
}
505510

506511
/**
@@ -743,13 +748,6 @@ export default class Wrapper implements BaseWrapper {
743748
eventObject.keyCode = modifiers[event[1]]
744749
}
745750

746-
// If this element's event handler has been reset by setMethod, it won't trigger
747-
// Make sure that this element is updated with the latest event handler
748-
if (this.vnode) {
749-
const context = this.vnode.context
750-
if (context.$options.render) context._update(context._render())
751-
}
752-
753751
this.element.dispatchEvent(eventObject)
754752
if (this.vnode) {
755753
orderWatchers(this.vm || this.vnode.context.$root)

0 commit comments

Comments
 (0)