mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Add user profile hub with account, settings and data export (#103)
This commit is contained in:
@@ -3,8 +3,33 @@ defmodule ChesstrainerWeb.LayoutsTest do
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
alias Chesstrainer.Accounts.Scope
|
||||
alias Chesstrainer.Accounts.User
|
||||
alias ChesstrainerWeb.Layouts
|
||||
|
||||
describe "navbar/1" do
|
||||
test "signed-in users get a profile menu" do
|
||||
scope = Scope.for_user(%User{username: "alice"})
|
||||
|
||||
html = render_component(&Layouts.navbar/1, %{current_scope: scope})
|
||||
|
||||
assert html =~ "alice"
|
||||
assert html =~ ~s(class="nav-user-menu")
|
||||
assert html =~ ~p"/users/profile"
|
||||
assert html =~ ~p"/users/profile/settings"
|
||||
assert html =~ ~p"/users/profile/data"
|
||||
assert html =~ ~p"/users/log-out"
|
||||
end
|
||||
|
||||
test "guests get log in and register links" do
|
||||
html = render_component(&Layouts.navbar/1, %{current_scope: nil})
|
||||
|
||||
assert html =~ ~p"/users/log-in"
|
||||
assert html =~ ~p"/users/register"
|
||||
refute html =~ ~s(class="nav-user-menu")
|
||||
end
|
||||
end
|
||||
|
||||
describe "colour_mode_toggle/1" do
|
||||
test "renders all three modes as a labelled radiogroup" do
|
||||
html = render_component(&Layouts.colour_mode_toggle/1, %{})
|
||||
|
||||
Reference in New Issue
Block a user