Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
APB9785 committed Jan 15, 2025
1 parent 032717e commit 9c83a8d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/beacon/live_admin/live/page_editor_live/new_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ defmodule Beacon.LiveAdmin.PageEditorLive.NewTest do
test "create new page and patch to edit page", %{conn: conn} do
{:ok, live, _html} = live(conn, "/admin/site_a/pages/new")

{:ok, live, _html} =
live
|> form("#page-form", page: %{path: "/my/page", title: "My Page", format: "heex"})
|> render_submit(%{page: %{"template" => "<div>test</div>"}, save: "save"})
|> follow_redirect(conn)

assert has_element?(live, "#flash", "Page saved successfully")
assert has_element?(live, "h1", "Edit Page")
assert has_element?(live, "button", "Save Changes")
live
|> form("#page-form", page: %{path: "/my/page", title: "My Page", format: "heex"})
|> render_submit(%{page: %{"template" => "<div>test</div>"}, save: "save"})

{path, flash} = assert_redirect(live)

assert path =~ ~r"^/admin/site_a/pages/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
assert flash["info"] == "Page saved successfully"
end

describe "extra page fields" do
Expand Down

0 comments on commit 9c83a8d

Please sign in to comment.