Skip to content

Commit 1574ade

Browse files
wujieZyyx990803
authored andcommitted
test: Add a unit test for "$off event and this event added by $once" (#9550)
1 parent 38825ff commit 1574ade

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/unit/features/instance/methods-events.spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ describe('Instance methods events', () => {
5656
expect(spy).toHaveBeenCalledWith(1, 2, 3)
5757
})
5858

59+
it('$off event added by $once', () => {
60+
vm.$once('test', spy)
61+
vm.$off('test', spy) // test off event and this event added by once
62+
vm.$emit('test', 1, 2, 3)
63+
expect(spy).not.toHaveBeenCalled()
64+
})
65+
5966
it('$off', () => {
6067
vm.$on('test1', spy)
6168
vm.$on('test2', spy)

0 commit comments

Comments
 (0)