Browse Source

feat: rename page live to home live

main
Inhji Y. 7 months ago
parent
commit
5234dcfb4e
  1. 2
      lib/mirage_web/live/home_live.ex
  2. 0
      lib/mirage_web/live/home_live.html.leex
  3. 2
      lib/mirage_web/router.ex
  4. 8
      test/mirage_web/live/page_live_test.exs
  5. 6
      test/mirage_web/live/show_note_live_test.exs

2
lib/mirage_web/live/page_live.ex → lib/mirage_web/live/home_live.ex

@ -1,4 +1,4 @@
defmodule MirageWeb.PageLive do
defmodule MirageWeb.HomeLive do
use MirageWeb, :live_view
@impl true

0
lib/mirage_web/live/page_live.html.leex → lib/mirage_web/live/home_live.html.leex

2
lib/mirage_web/router.ex

@ -26,7 +26,7 @@ defmodule MirageWeb.Router do
scope "/", MirageWeb do
pipe_through :browser
live "/", PageLive, :index
live "/", HomeLive, :index
resources "/notes", NoteController, except: [:show]
resources "/topics", TopicController

8
test/mirage_web/live/page_live_test.exs

@ -1,13 +1,13 @@
defmodule MirageWeb.PageLiveTest do
defmodule MirageWeb.HomeLiveTest do
use MirageWeb.ConnCase
import Phoenix.LiveViewTest
test "disconnected and connected render", %{conn: conn} do
{:ok, page_live, disconnected_html} = live(conn, "/")
{:ok, home_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Hi"
assert disconnected_html =~ "some tagline"
assert render(page_live) =~ "Hi"
assert render(page_live) =~ "some tagline"
assert render(home_live) =~ "Hi"
assert render(home_live) =~ "some tagline"
end
end

6
test/mirage_web/live/show_note_live_test.exs

@ -8,11 +8,11 @@ defmodule MirageWeb.ShowNoteLiveTest do
setup [:create_note]
test "disconnected and connected render", %{conn: conn, note: note} do
{:ok, page_live, disconnected_html} = live(conn, "/notes/#{note.id}")
{:ok, show_note_live, disconnected_html} = live(conn, "/notes/#{note.id}")
assert disconnected_html =~ note.title
assert disconnected_html =~ note.content
assert render(page_live) =~ note.title
assert render(page_live) =~ note.content
assert render(show_note_live) =~ note.title
assert render(show_note_live) =~ note.content
end
end
end

Loading…
Cancel
Save