germsvel / phoenix_test

MIT License
147 stars 20 forks source link

Select on nested form raises ArgumentError #115

Open rgraff opened 2 weeks ago

rgraff commented 2 weeks ago

Using select(conn, "Users", from: "Metric") will error on fields generated with <inputs_for .../>

      ** (ArgumentError) value for hidden "automation[trigger][_touched]" must be one of ["_form_type,_persistent_id,_touched,name,type"], got: "name,type"
     code: |> select(metric.name, from: "Metric")
     stacktrace:
       (phoenix_live_view 0.20.17) lib/phoenix_live_view/test/live_view_test.ex:1102: Phoenix.LiveViewTest.call/2
       (phoenix_test 0.3.1) lib/phoenix_test/live.ex:219: PhoenixTest.Live.fill_form/3

It works with <inputs_for skip_hidden={true} .../>

germsvel commented 2 weeks ago

Thanks for opening the issue @rgraff!

Any chance you could include some code that makes this easy to reproduce?

rgraff commented 2 weeks ago

Unfortunately, I can't reproduce the error in the test suite. I'm not exactly sure what happens with <.inputs_for .../> so I'm not confident my test setup is correct.

germsvel commented 2 weeks ago

@rgraff can you use reproduce the error in a sample Phoenix app that you can share with us? Would that be easier than trying to add a test in phoenix_test?

rgraff commented 6 days ago

@germsvel yes, I will do that in the next couple weeks. Have a deadline right now and have worked-around this issue for now.

germsvel commented 6 days ago

have worked-around this issue for now.

Excellent! 👍 Glad to hear it's not blocking you