I am trying to set a value for a select component while testing.
For a text input, it is simple as componentName.setValue("some-value")
How can I do it for the select component?
I am trying to set a value for a select component while testing.
For a text input, it is simple as componentName.setValue("some-value")
How can I do it for the select component?
A select component has a setValue()
method. You need to ensure that the value you are setting exists in the select.
Thanks @brettski for the quick response.
I have tried using setValue(). I made sure that the value exists as an option. The value is 0.01. I have passed it in as "0.01" and 0.01. no dice.
My assertions looks like:
await assertEquals(myPostMethod.body['4'].value, 0.01)
When I log out myPostMethod.body['4'] it prints - 1. {key: "sliding_scale_rate_template_override", value: ""}
I am testing other properties no problem, I'm just running in circles trying to get the value into the select component.
Thanks again
I think I would need so see more of what you have setup when using the method as it worked for me when I tested it.
Interesting. I think it may have to do with me trying to set the value in a unit test.
My setup is pretty much what you have there. Nothing fancy at all.
The select component works as expected when I use it normally, but not in the test. Are you able to set it in a unit test?
Hi @alext Is this what you're looking to do via unit test?
If so, could you try toggling on allow custom values on the select just to see if that makes a difference?