Skip to content

Commit

Permalink
Reorder actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bartblast committed Nov 17, 2024
1 parent aabc3f5 commit f42f5e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions test/features/app/pages/control_flow/case_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ defmodule HologramFeatureTests.ControlFlow.CasePage do
<button $click="vars_matching"> Vars matching </button>
<button $click="vars_scoping"> Vars scoping </button>
<button $click="var_match_in_condition"> Var match in condition </button>
<button $click="error_in_condition"> Error in condition </button>
<button $click="no_matching_clause"> No matching clause </button>
<button $click="error_in_condition"> Error in condition </button>
<button $click="error_in_clause_body"> Error in clause body </button>
</p>
<p>
Expand Down Expand Up @@ -149,6 +149,13 @@ defmodule HologramFeatureTests.ControlFlow.CasePage do
put_state(component, :result, {x, y, result})
end

def action(:no_matching_clause, _params, _component) do
case wrap_term(3) do
1 -> :a
2 -> :b
end
end

def action(:error_in_condition, _params, _component) do
case (
message = "my message"
Expand All @@ -158,13 +165,6 @@ defmodule HologramFeatureTests.ControlFlow.CasePage do
end
end

def action(:no_matching_clause, _params, _component) do
case wrap_term(3) do
1 -> :a
2 -> :b
end
end

def action(:error_in_clause_body, _params, _component) do
case 1 do
1 -> raise ArgumentError, "my message"
Expand Down
12 changes: 6 additions & 6 deletions test/features/test/control_flow/case_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ defmodule HologramFeatureTests.ControlFlow.CaseTest do
|> assert_text(css("#result"), "{1, 2, {3, 2}}")
end

feature "error in condition", %{session: session} do
feature "no matching clause", %{session: session} do
assert_js_error session,
"(RuntimeError) my message",
"(CaseClauseError) no case clause matching: 3",
fn ->
session
|> visit(CasePage)
|> click(button("Error in condition"))
|> click(button("No matching clause"))
end
end

feature "no matching clause", %{session: session} do
feature "error in condition", %{session: session} do
assert_js_error session,
"(CaseClauseError) no case clause matching: 3",
"(RuntimeError) my message",
fn ->
session
|> visit(CasePage)
|> click(button("No matching clause"))
|> click(button("Error in condition"))
end
end

Expand Down

0 comments on commit f42f5e9

Please sign in to comment.