Skip to content

Commit

Permalink
test: Add a unit test for "$off event and this event added by $once" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wujieZ authored and yyx990803 committed Feb 28, 2019
1 parent 38825ff commit 1574ade
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/unit/features/instance/methods-events.spec.js
Expand Up @@ -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)

This comment has been minimized.

Copy link
@lixumengit

lixumengit Mar 1, 2019

vm.$emit('test',1,2,3,4)

expect(spy).not.toHaveBeenCalled()
})

it('$off', () => {
vm.$on('test1', spy)
vm.$on('test2', spy)
Expand Down

0 comments on commit 1574ade

Please sign in to comment.