When writing a LiveView test, this is treated as an invalid value for a checkbox
** (ArgumentError) value for checkbox "organization[products][access]" must be one of ["false", "true"], got: ""
code: |> render_change()
stacktrace:
(phoenix_live_view 0.20.11) lib/phoenix_live_view/test/live_view_test.ex:1102: Phoenix.LiveViewTest.call/2
test/myapp_web/live/page_live_test.exs:260: (test)
Expected behavior
I see that this is either a problem with the Javascript or the correct set of possible values in test. So the expected behavior is either:
Checkboxes always return "true" or "false" as values during change events
Empty string "" is a valid checkbox value during tests
Environment
Actual behavior
I have a form defined like so. The underlying data type is an array of
Ecto.Enum
The form looks like this
When we get the params during change events, the checked boxes from the page load will come back as empty strings like so
When writing a LiveView test, this is treated as an invalid value for a checkbox
Expected behavior
I see that this is either a problem with the Javascript or the correct set of possible values in test. So the expected behavior is either:
"true"
or"false"
as values during change events""
is a valid checkbox value during tests