Skip to content

Commit 5351f95

Browse files
committed
Update listen-on-root.spec.js
1 parent 1f6503d commit 5351f95

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/mixins/listen-on-root.spec.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,29 @@ describe('mixins/listen-on-root', () => {
4848
expect(spyOn).toHaveBeenCalledTimes(1)
4949
expect(spyOnce).not.toHaveBeenCalled()
5050

51-
await wrapper.setProps({ destroy: true })
51+
$root.$emit('root-once')
5252
expect(spyOn).toHaveBeenCalledTimes(1)
53-
expect(spyOnce).not.toHaveBeenCalled()
53+
expect(spyOnce).toHaveBeenCalledTimes(1)
5454

5555
$root.$emit('root-on')
56-
expect(spyOn).toHaveBeenCalledTimes(1)
57-
expect(spyOnce).not.toHaveBeenCalled()
56+
expect(spyOn).toHaveBeenCalledTimes(2)
57+
expect(spyOnce).toHaveBeenCalledTimes(1)
5858

5959
$root.$emit('root-once')
60-
expect(spyOn).toHaveBeenCalledTimes(1)
61-
expect(spyOnce).not.toHaveBeenCalled()
60+
expect(spyOn).toHaveBeenCalledTimes(2)
61+
expect(spyOnce).toHaveBeenCalledTimes(1)
62+
63+
await wrapper.setProps({ destroy: true })
64+
expect(spyOn).toHaveBeenCalledTimes(2)
65+
expect(spyOnce).toHaveBeenCalledTimes(1)
66+
67+
$root.$emit('root-on')
68+
expect(spyOn).toHaveBeenCalledTimes(2)
69+
expect(spyOnce).toHaveBeenCalledTimes(1)
70+
71+
$root.$emit('root-once')
72+
expect(spyOn).toHaveBeenCalledTimes(2)
73+
expect(spyOnce).toHaveBeenCalledTimes(1)
6274

6375
wrapper.destroy()
6476
})

0 commit comments

Comments
 (0)