Skip to content

Add setChecked and setValue methods #530

Closed
@eddyerburgh

Description

@eddyerburgh

What problem does this feature solve?

Changing the value so that the v-model is updated can be confusing:

const input = wrapper.find('input[type="text"]')
input.element.value = 'some value' // input element value is changed, v-model is not
input.trigger('input') // v-model updated
const radioInput = wrapper.find('input[type="radio"]')
radioInput.element.checked = true // input element value is changed, v-model is not
radioInput.trigger('input') // v-model not updated
radioInput.trigger('change') // v-model updated

What does the proposed API look like?

const input = wrapper.find('input[type="text"]')
input.setValue('some value')
const radioInput = wrapper.find('input[type="radio"]')
radioInput.setChecked()
const option = wrapper.find('option')
option.setSelected()

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