Skip to content

Commit

Permalink
Use ~p instead of Routes (#3264)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayuapi committed May 25, 2024
1 parent 8212c97 commit 4ac5c18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion guides/client/form-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
```
Expand Down
8 changes: 4 additions & 4 deletions test/phoenix_live_view/html_formatter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do
)

assert_formatter_doesnt_change("""
<span><%= link("Edit", to: Routes.post_path(@conn, :edit, @post)) %></span>
| <span><%= link("Back", to: Routes.post_path(@conn, :index)) %></span>
<span><%= link("Edit", to: ~p"/posts/:id/edit") %></span>
| <span><%= link("Back", to: ~p"/posts") %></span>
""")
end

Expand Down Expand Up @@ -813,7 +813,7 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do
test "handle void elements" do
input = """
<div>
<link rel="shortcut icon" href={Routes.static_path(@conn, "/images/favicon.png")} type="image/x-icon">
<link rel="shortcut icon" href={~p"/images/favicon.png"} type="image/x-icon">
<p>some text</p>
<br>
<hr>
Expand All @@ -826,7 +826,7 @@ defmodule Phoenix.LiveView.HTMLFormatterTest do
<div>
<link
rel="shortcut icon"
href={Routes.static_path(@conn, "/images/favicon.png")}
href={~p"/images/favicon.png"}
type="image/x-icon"
/>
<p>some text</p>
Expand Down
2 changes: 1 addition & 1 deletion test/support/layout_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Phoenix.LiveViewTest.LayoutView do
<head>
<title>Styled</title>
<link rel="stylesheet" href="/css/custom.css"/>
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")}/>
<link rel="stylesheet" href={~p"/css/app.css"}/>

Check failure on line 58 in test/support/layout_view.ex

View workflow job for this annotation

GitHub Actions / mix test (OTP 24.3 | Elixir 1.13.4)

** (CompileError) test/support/layout_view.ex:58: undefined function sigil_p/2 (expected Phoenix.LiveViewTest.LayoutView to define such a function or for it to be imported, but none are available)
<link rel="stylesheet" href="//example.com/a.css"/>
<link rel="stylesheet" href="https://example.com/b.css"/>
<style>body { background-color: #eee; }</style>
Expand Down

0 comments on commit 4ac5c18

Please sign in to comment.