From 4ac5c18e32c19dfabe406aee18cfb7bad316e7a4 Mon Sep 17 00:00:00 2001 From: ZC Date: Sat, 25 May 2024 21:37:34 +0800 Subject: [PATCH] Use ~p instead of Routes (#3264) --- guides/client/form-bindings.md | 2 +- test/phoenix_live_view/html_formatter_test.exs | 8 ++++---- test/support/layout_view.ex | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/guides/client/form-bindings.md b/guides/client/form-bindings.md index 9d4895f68..944525cab 100644 --- a/guides/client/form-bindings.md +++ b/guides/client/form-bindings.md @@ -196,7 +196,7 @@ annotate the `phx-trigger-action` with a boolean assign: ```heex <.form :let={f} for={@changeset} - action={Routes.reset_password_path(@socket, :create)} + action={~p"/users/reset_password"} phx-submit="save" phx-trigger-action={@trigger_submit}> ``` diff --git a/test/phoenix_live_view/html_formatter_test.exs b/test/phoenix_live_view/html_formatter_test.exs index 10f4ccba9..86a98fecb 100644 --- a/test/phoenix_live_view/html_formatter_test.exs +++ b/test/phoenix_live_view/html_formatter_test.exs @@ -535,8 +535,8 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do ) assert_formatter_doesnt_change(""" - <%= link("Edit", to: Routes.post_path(@conn, :edit, @post)) %> - | <%= link("Back", to: Routes.post_path(@conn, :index)) %> + <%= link("Edit", to: ~p"/posts/:id/edit") %> + | <%= link("Back", to: ~p"/posts") %> """) end @@ -813,7 +813,7 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do test "handle void elements" do input = """
- +

some text



@@ -826,7 +826,7 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do

some text

diff --git a/test/support/layout_view.ex b/test/support/layout_view.ex index 9c3172b3c..1738b8e12 100644 --- a/test/support/layout_view.ex +++ b/test/support/layout_view.ex @@ -55,7 +55,7 @@ defmodule Phoenix.LiveViewTest.LayoutView do Styled - +