Skip to content

preventDefault:true option overwrites method #211

@mokkabonna

Description

@mokkabonna

I have a listener like this:

<input @keydown.enter.prevent="enter">

And dispatch the event like this:

wrapper.trigger('keydown.enter', {
  preventDefault: true
})

And get the following error

Uncaught TypeError: $event.preventDefault is not a function

It iterates over all options and set them:
https://github.com/vuejs/vue-test-utils/blob/dev/src/wrappers/wrapper.js#L533

preventDefault should not be set to true. Suggest either changing the option name to a non conflicting one, or removing it from the iterated keys. Or set it to a noop function.

I know I am doing preventDefault twice, but it shouldn't fail anyway imo.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions