Skip to content

Commit 2e1e809

Browse files
Kingwlyyx990803
authored andcommitted
fix prevent default unit test (vuejs#5127)
1 parent 303824e commit 2e1e809

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,14 @@ describe('Directive v-on', () => {
8686
vm = new Vue({
8787
el,
8888
template: `
89-
<div @click="bar">
90-
<div @click.stop="foo"></div>
91-
</div>
89+
<input type="checkbox" ref="input" @click.prevent="foo">
9290
`,
93-
methods: { foo: spy, bar: spy2 }
91+
methods: { foo: spy2 }
9492
})
95-
triggerEvent(vm.$el.firstChild, 'click')
96-
expect(spy).toHaveBeenCalled()
97-
expect(spy2).not.toHaveBeenCalled()
93+
vm.$refs.input.checked = false
94+
triggerEvent(vm.$refs.input, 'click')
95+
expect(spy2).toHaveBeenCalled()
96+
expect(vm.$refs.input.checked).toBe(false)
9897
})
9998

10099
it('should support capture', () => {

0 commit comments

Comments
 (0)