Browse Source

test: Add a unit test for "$off event and this event added by $once" (#9550)

dev
Luxiaosong 6 years ago
committed by Evan You
parent
commit
1574ade607
  1. 7
      test/unit/features/instance/methods-events.spec.js

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

@ -56,6 +56,13 @@ describe('Instance methods events', () => {
expect(spy).toHaveBeenCalledWith(1, 2, 3)
})
it('$off event added by $once', () => {
vm.$once('test', spy)
vm.$off('test', spy) // test off event and this event added by once
vm.$emit('test', 1, 2, 3)
expect(spy).not.toHaveBeenCalled()
})
it('$off', () => {
vm.$on('test1', spy)
vm.$on('test2', spy)

Loading…
Cancel
Save