Skip to content

Allow for submit_form and update_form to take in date type input.#25

Merged
sax merged 1 commit into
synchronal:mainfrom
DuldR:add-date-to-update-values
Jul 15, 2025
Merged

Allow for submit_form and update_form to take in date type input.#25
sax merged 1 commit into
synchronal:mainfrom
DuldR:add-date-to-update-values

Conversation

@DuldR
Copy link
Copy Markdown
Contributor

@DuldR DuldR commented Jul 15, 2025

Trying to submit a form with a type of "date" would raise the following error:

 1) test submit_form/2 submit form handles dates (Pages.Driver.ConnTest)
     test/pages/driver/conn_test.exs:64
     ** (FunctionClauseError) no function clause matching in Pages.Form.update_value/3

     The following arguments were given to Pages.Form.update_value/3:

         # 1
         [{"id", "form_date_value"}, {"name", "form[date_value]"}, {"type", "date"}, {"value", "2021-01-01"}]

         # 2
         "date"

         # 3
         %{"form[date_value]" => "2021-08-15"}

     Attempted function clauses (showing 3 out of 3):

         defp update_value(attrs, type, inputs) when type === "email" or type === "number" or type === "password" or type === "search" or type === "tel" or type === "text" or type === "textarea" or type === "url"
         defp update_value(attrs, "checkbox", inputs)
         defp update_value(attrs, "radio", inputs)

     code: |> Pages.update_form("#form", :form, date_value: "2021-08-15")

This is due to the valid types for update_value not include date. This PR adds in the date type and a corresponding test.

Co-authored-by: Chet Bortz <184307+cbortz@users.noreply.github.com>
@sax sax merged commit cff66b7 into synchronal:main Jul 15, 2025
10 checks passed
@sax
Copy link
Copy Markdown
Member

sax commented Jul 15, 2025

Awesome possum. Shipping it.

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