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

Marcel/submit with button #94

Closed
wants to merge 3 commits into from
Closed

Conversation

fatboypunk
Copy link
Contributor

No description provided.

@fatboypunk fatboypunk changed the base branch from master to marcel/submit-form October 20, 2021 18:20
@fatboypunk
Copy link
Contributor Author

Screenshot 2021-10-21 at 11 40 09

Example of the usage.

- This allows users to specify the button they want to submit the form
  with.
- If the button that's submitted has a `name`it will show up in the params.
@fatboypunk fatboypunk force-pushed the marcel/submit-with-button branch from 834c5dc to 89cee46 Compare October 21, 2021 11:49
@codecov-commenter
Copy link

Codecov Report

Merging #94 (89cee46) into marcel/submit-form (a97db01) will decrease coverage by 15.13%.
The diff coverage is 21.95%.

Impacted file tree graph

@@                   Coverage Diff                   @@
##           marcel/submit-form      #94       +/-   ##
=======================================================
- Coverage               93.67%   78.53%   -15.14%     
=======================================================
  Files                       9        9               
  Lines                     158      191       +33     
=======================================================
+ Hits                      148      150        +2     
- Misses                     10       41       +31     
Impacted Files Coverage Δ
lib/test_dispatch/form.ex 70.47% <20.58%> (-24.27%) ⬇️
lib/test_dispatch.ex 75.00% <28.57%> (-12.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a97db01...89cee46. Read the comment docs.

Base automatically changed from marcel/submit-form to master October 21, 2021 12:17
@@ -78,6 +77,14 @@ defmodule TestDispatch do
def submit_form(conn, attrs, entity, test_selector),
do: dispatch_form(conn, attrs, entity, test_selector)

@spec submit_form(Plug.Conn.t(), %{}, binary()) :: Plug.Conn.t()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@spec submit_form(Plug.Conn.t(), %{}, binary()) :: Plug.Conn.t()
@spec submit_with_button(Plug.Conn.t(), %{}, binary()) :: Plug.Conn.t()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice!

input_submit || button_submit
end

def text(html_tree),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def text(html_tree),
defp text(html_tree),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm yeah i'm moving this later in #97.

def text(html_tree),
do: html_tree |> Floki.text() |> String.replace(~r/\s+/, " ") |> String.trim()

defp all_buttons(html_tree) do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
defp all_buttons(html_tree) do
defp all_submit_controls(html_tree) do

or something like it? :p

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah nice i'll update this in #97

@fatboypunk fatboypunk closed this Nov 1, 2021
@fatboypunk fatboypunk deleted the marcel/submit-with-button branch November 1, 2021 19:07
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.

3 participants