Skip to content

Commit 7827593

Browse files
committed
custom directive: postupdate -> componentUpdated (ref #3172)
1 parent ac15b04 commit 7827593

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/core/vdom/modules/directives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
applyDirectives(oldVnode, vnode, 'update')
1111
},
1212
postpatch: function postupdateDirectives (oldVnode: VNodeWithData, vnode: VNodeWithData) {
13-
applyDirectives(oldVnode, vnode, 'postupdate')
13+
applyDirectives(oldVnode, vnode, 'componentUpdated')
1414
},
1515
destroy: function unbindDirectives (vnode: VNodeWithData) {
1616
applyDirectives(vnode, vnode, 'unbind')

src/platforms/web/runtime/directives/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default {
4444
}
4545
}
4646
},
47-
postupdate (el, binding, vnode) {
47+
componentUpdated (el, binding, vnode) {
4848
const val = binding.value
4949
if (vnode.tag === 'select') {
5050
setSelected(el, val)

test/unit/features/options/directives.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe('Options directives', () => {
44
it('basic usage', done => {
55
const bindSpy = jasmine.createSpy('bind')
66
const updateSpy = jasmine.createSpy('update')
7-
const postupdateSpy = jasmine.createSpy('postupdate')
7+
const componentUpdatedSpy = jasmine.createSpy('componentUpdated')
88
const unbindSpy = jasmine.createSpy('unbind')
99

1010
const assertContext = (el, binding, vnode) => {
@@ -39,8 +39,8 @@ describe('Options directives', () => {
3939
expect(binding.oldValue).toBe('foo')
4040
expect(binding.expression).toBe('a')
4141
},
42-
postupdate (el, binding, vnode) {
43-
postupdateSpy()
42+
componentUpdated (el, binding, vnode) {
43+
componentUpdatedSpy()
4444
assertContext(el, binding, vnode)
4545
},
4646
unbind (el, binding, vnode) {
@@ -54,16 +54,16 @@ describe('Options directives', () => {
5454
vm.$mount()
5555
expect(bindSpy).toHaveBeenCalled()
5656
expect(updateSpy).not.toHaveBeenCalled()
57-
expect(postupdateSpy).not.toHaveBeenCalled()
57+
expect(componentUpdatedSpy).not.toHaveBeenCalled()
5858
expect(unbindSpy).not.toHaveBeenCalled()
5959
vm.a = 'bar'
6060
waitForUpdate(() => {
6161
expect(updateSpy).toHaveBeenCalled()
62-
expect(postupdateSpy).toHaveBeenCalled()
62+
expect(componentUpdatedSpy).toHaveBeenCalled()
6363
expect(unbindSpy).not.toHaveBeenCalled()
6464
vm.msg = 'bye'
6565
}).then(() => {
66-
expect(postupdateSpy.calls.count()).toBe(2)
66+
expect(componentUpdatedSpy.calls.count()).toBe(2)
6767
vm.ok = false
6868
}).then(() => {
6969
expect(unbindSpy).toHaveBeenCalled()

0 commit comments

Comments
 (0)