question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add setChecked and setValue methods

See original GitHub issue

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()

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
14nrvcommented, Apr 16, 2018

Hi, you should take a look to mwangaben-vthelpers which provides some helpers for vue-test-utils like b.type(text, selector) :

type(text, input) {
  let node = this.find(input)
  node.element.value = text
  node.trigger('input')
}
1reaction
eddyerburghcommented, Apr 24, 2018

@beyersito I’m not currently working on it, it would be great if you could 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.vaadin.v7.ui.CheckBox.setValue java code examples
How to use. setValue. method. in. com.vaadin.v7.ui.CheckBox ... setValue(true); m_selectedCheckboxes.add((Integer)button.getData()); } }.
Read more >
Change Checkbox value without triggering onCheckChanged
The onCheckedChanged method is called directly from setChecked . What you can do is the following: mCheck.setOnCheckedChangeListener (null); mCheck.
Read more >
PyQt5 - setChecked() method for Check Box - GeeksforGeeks
setChecked method is used to change the state of check box. By default it is un-checked after clicking on the check box widget...
Read more >
Wrapper | Vue Test Utils
Vue Test Utils is a wrapper based API. A Wrapper is an object that contains a mounted component or vnode and methods to...
Read more >
RadioButtonList - How to add a text box to a selected item's ...
To check the required RadioButton in this scenario on the client side, you can use the SetValue method instead of SetChecked and call...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found