Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To form vs form for #146

Merged
merged 3 commits into from
Jan 29, 2024
Merged

Conversation

jmillxyz
Copy link
Contributor

On master we are failing two tests:

1) test support setting form and field from changeset (new) (LivePhoneTest)
     test/live_phone_test.exs:63
     ** (FunctionClauseError) no function clause matching in PhoenixHTMLHelpers.Form.form_for/4

     The following arguments were given to PhoenixHTMLHelpers.Form.form_for/4:
     
         # 1
         #Ecto.Changeset<action: nil, changes: %{}, errors: [], data: #LivePhoneTestApp.User<>, valid?: true>
     
         # 2
         "/"
     
         # 3
         []
     
         # 4
         []
     
     Attempted function clauses (showing 1 out of 1):
     
         def form_for(form_data, action, options, fun) when is_function(fun, 1)
     
     code: form = form_for(changeset, "/")
     stacktrace:
       (phoenix_html_helpers 1.0.1) lib/phoenix_html_helpers/form.ex:261: PhoenixHTMLHelpers.Form.form_for/4
       test/live_phone_test.exs:70: (test)

.

  2) test support setting form and field from changeset (edit) (LivePhoneTest)
     test/live_phone_test.exs:77
     ** (FunctionClauseError) no function clause matching in PhoenixHTMLHelpers.Form.form_for/4

     The following arguments were given to PhoenixHTMLHelpers.Form.form_for/4:
     
         # 1
         #Ecto.Changeset<action: nil, changes: %{phone: "+16502530000"}, errors: [], data: #LivePhoneTestApp.User<>, valid?: true>
     
         # 2
         "/"
     
         # 3
         []
     
         # 4
         []
     
     Attempted function clauses (showing 1 out of 1):
     
         def form_for(form_data, action, options, fun) when is_function(fun, 1)
     
     code: form = form_for(changeset, "/")
     stacktrace:
       (phoenix_html_helpers 1.0.1) lib/phoenix_html_helpers/form.ex:261: PhoenixHTMLHelpers.Form.form_for/4
       test/live_phone_test.exs:88: (test)

Uses the newer Phoenix.HTML.FormData.to_form/2 as a replacement for Phoenix.HTML.Form.form_for/2.

I'm not completely sure this is a drop-in replacement even though the tests now pass.

@jmillxyz jmillxyz closed this Jan 16, 2024
@jmillxyz jmillxyz deleted the to-form-vs-form-for branch January 16, 2024 21:53
@jmillxyz jmillxyz restored the to-form-vs-form-for branch January 16, 2024 21:54
@nkezhaya
Copy link
Owner

Hi @jmillxyz ! Why was the PR closed?

@jmillxyz
Copy link
Contributor Author

I actually meant to push to a fork, which had already updated some deps. I can reopen with all of those changes!

@nkezhaya
Copy link
Owner

Sounds good, thanks!

@jmillxyz jmillxyz reopened this Jan 17, 2024
@jmillxyz
Copy link
Contributor Author

@nkezhaya I was also considering bumping this to 0.8.0 given the number of dependencies that have changed, but defer to you

version: "0.7.0",
elixir: "~> 1.12",
version: "0.7.1",
elixir: "~> 1.13",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can also keep this at 1.12 if needed

@nkezhaya nkezhaya merged commit 0af0afc into nkezhaya:master Jan 29, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants