-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #493 liveview for outline & inbox
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule RadiatorWeb.OutlineLive.Index do | ||
use RadiatorWeb, :live_view | ||
|
||
@impl true | ||
def mount(_params, _session, socket) do | ||
{:ok, socket} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<section> | ||
<h1>Outline</h1> | ||
<h2>Inbox</h2> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule RadiatorWeb.OutlineLiveTest do | ||
use RadiatorWeb.ConnCase | ||
|
||
import Phoenix.LiveViewTest | ||
import Radiator.AccountsFixtures | ||
|
||
describe "Outline show page" do | ||
test "can render page if user is logged in", %{conn: conn} do | ||
{:ok, _live, html} = conn |> log_in_user(user_fixture()) |> live(~p"/outline") | ||
|
||
assert html =~ "Outline</h1>" | ||
end | ||
|
||
test "redirects if user is not logged in", %{conn: conn} do | ||
assert {:error, redirect} = live(conn, ~p"/outline") | ||
|
||
assert {:redirect, %{to: path, flash: flash}} = redirect | ||
assert path == ~p"/users/log_in" | ||
assert %{"error" => "You must log in to access this page."} = flash | ||
end | ||
end | ||
|
||
describe "Outline has an inbox" do | ||
setup %{conn: conn} do | ||
user = user_fixture() | ||
%{conn: log_in_user(conn, user)} | ||
end | ||
|
||
test "inbox has a haeadline", %{conn: conn} do | ||
{:ok, live, _html} = live(conn, ~p"/outline") | ||
|
||
assert live | ||
|> element("h2", "Inbox") | ||
|> render() =~ "Inbox" | ||
end | ||
end | ||
end |