Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Aug 15, 2024
1 parent 651e3da commit c075516
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
3 changes: 2 additions & 1 deletion test/e2e/support/issues/issue_2787.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ defmodule Phoenix.LiveViewTest.E2E.Issue2787Live do
@impl Phoenix.LiveView
def render(assigns) do
~H"""
<script src="https://cdn.tailwindcss.com/3.4.3"></script>
<script src="https://cdn.tailwindcss.com/3.4.3">
</script>
<div class="p-20">
<.form for={@form} phx-change="updated" phx-submit="submitted" class="space-y-4">
<.input
Expand Down
8 changes: 2 additions & 6 deletions test/e2e/support/issues/issue_3083.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ defmodule Phoenix.LiveViewTest.E2E.Issue3083Live do
def render(assigns) do
~H"""
<.form id="form" for={@form} phx-change="validate">
<select
id={@form[:ids].id}
name={@form[:ids].name <> "[]"}
multiple={true}
>
<select id={@form[:ids].id} name={@form[:ids].name <> "[]"} multiple={true}>
<%= Phoenix.HTML.Form.options_for_select(@options, @form[:ids].value) %>
</select>
<input type="text" placeholder="focus me!"/>
<input type="text" placeholder="focus me!" />
</.form>
"""
end
Expand Down
7 changes: 3 additions & 4 deletions test/e2e/support/issues/issue_3107.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ defmodule Phoenix.LiveViewTest.E2E.Issue3107Live do
@impl Phoenix.LiveView
def mount(_params, _session, socket) do
{:ok,
socket
|> assign(:form, Phoenix.Component.to_form(%{}))
|> assign(:disabled, true)
}
socket
|> assign(:form, Phoenix.Component.to_form(%{}))
|> assign(:disabled, true)}
end

@impl Phoenix.LiveView
Expand Down
29 changes: 20 additions & 9 deletions test/e2e/support/select_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,19 @@ defmodule Phoenix.LiveViewTest.E2E.SelectLive do
This page contains multiple select inputs to test various behaviors.
Sadly, we cannot test all of them automatically, as there is no way to assert the state of an open select's native UI.
</p>
Tick: <%= @tick %>
<div style="display: flex; flex-direction: column; gap: 8px">
<button phx-click="toggle-tick"><%= if @tick_timer, do: "Disable", else: "Enable" %> ticking</button>
<button :if={!@select2_timer} phx-click="schedule-select2-update">Schedule select2 update</button>
<button phx-click="toggle-tick">
<%= if @tick_timer, do: "Disable", else: "Enable" %> ticking
</button>
<button :if={!@select2_timer} phx-click="schedule-select2-update">
Schedule select2 update
</button>
<span :if={@select2_timer}>Select 2 will update in <%= @select2_countdown %>s</span>
<button :if={!@select4_timer} phx-click="schedule-select4-update">Schedule select4 update</button>
<button :if={!@select4_timer} phx-click="schedule-select4-update">
Schedule select4 update
</button>
<span :if={@select4_timer}>Select 4 will update in <%= @select4_countdown %>s</span>
</div>
Expand All @@ -141,29 +146,35 @@ defmodule Phoenix.LiveViewTest.E2E.SelectLive do
You can simulate patching by enabling ticking above.
</p>
<.input type="select" field={@form[:select1]} label="Select 1" options={@select1_opts} />
<hr/>
<hr />
<h2>Select 2</h2>
<p>
The second select's options will be updated after a 5s timeout (button on top).
This can be used to test the behavior of the select when its options change while it is open.
</p>
<.input type="select" field={@form[:select2]} label="Select 2" options={@select2_opts} />
<hr/>
<hr />
<h2>Select 3</h2>
<p>
Error classes are correctly applied to the third select.
It should have a red border for all values from 1 to 5. The border should disappear when selecting 6 or higher.
</p>
<.input type="select" field={@form[:select3]} label="Select 3" options={@select3_opts} />
<hr/>
<hr />
<h2>Select 4</h2>
<p>
The selected value of this field changes after a 5s timeout (button on top).
This can be used to test the behavior of the select when its value changes while it is open.
We expect the value to be ignored if the select is open, as value changes to focused inputs are ignored.
</p>
<.input type="select" field={@form[:select4]} value={@select4_value} label="Select 4" options={@select4_opts} />
<hr/>
<.input
type="select"
field={@form[:select4]}
value={@select4_value}
label="Select 4"
options={@select4_opts}
/>
<hr />
</.form>
"""
end
Expand Down

0 comments on commit c075516

Please sign in to comment.