diff --git a/HVZ.Tests/HVZ.Web.Components.Tests/ImageUploadTest.razor b/HVZ.Tests/HVZ.Web.Components.Tests/ImageUploadTest.razor index 5e89a7c6..c758757f 100644 --- a/HVZ.Tests/HVZ.Web.Components.Tests/ImageUploadTest.razor +++ b/HVZ.Tests/HVZ.Web.Components.Tests/ImageUploadTest.razor @@ -78,7 +78,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); var imgName = cut.Find("#img-name"); @@ -109,7 +109,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); var imgName = cut.Find("#img-name"); diff --git a/HVZ.Tests/HVZ.Web.Components.Tests/LoginDisplayTest.razor b/HVZ.Tests/HVZ.Web.Components.Tests/LoginDisplayTest.razor index e6155ce8..1ed7f925 100644 --- a/HVZ.Tests/HVZ.Web.Components.Tests/LoginDisplayTest.razor +++ b/HVZ.Tests/HVZ.Web.Components.Tests/LoginDisplayTest.razor @@ -6,10 +6,17 @@ @code { TestAuthorizationContext? authContext; + Mock mockOrgRepo = new Mock(); + Mock mockUserRepo = new Mock(); + Mock mockImageService = new Mock(); [OneTimeSetUp] public void Setup() { + mockUserRepo.Setup(repo => repo.GetUserById(It.IsAny())).ReturnsAsync(new User("", "", "")); + Services.AddSingleton(mockOrgRepo.Object); + Services.AddSingleton(mockUserRepo.Object); + Services.AddSingleton(mockImageService.Object); authContext = this.AddTestAuthorization(); } @@ -30,6 +37,9 @@ public void Test_LoggedInSeesLogOutButton() { authContext?.SetAuthorized("TEST USER"); + authContext?.SetClaims( + new System.Security.Claims.Claim("DatabaseId", "1234") + ); var cut = Render( @ diff --git a/HVZ.Tests/HVZ.Web.Components.Tests/ThemeToggleTest.razor b/HVZ.Tests/HVZ.Web.Components.Tests/ThemeToggleTest.razor new file mode 100644 index 00000000..78d98446 --- /dev/null +++ b/HVZ.Tests/HVZ.Web.Components.Tests/ThemeToggleTest.razor @@ -0,0 +1,70 @@ +@using HVZ.Web.Shared.Ui_Helpers + +@inherits Bunit.TestContext + +@code { + + [OneTimeSetUp] + public void Setup() + { + + } + + [Test] + public void Test_LightMode() + { + JSInterop.Setup("getThemePreference", _ => true).SetResult("light"); + + var cut = RenderComponent(); + + cut.Render(); + + var icon = cut.Find("i"); + var toggle = cut.Find("button"); + icon.MarkupMatches(@); + toggle.MarkupMatches(@); + } + + [Test] + public void Test_DarkMode() + { + JSInterop.Setup("getThemePreference", _ => true).SetResult("dark"); + + var cut = RenderComponent(); + + cut.Render(); + + var icon = cut.Find("i"); + var toggle = cut.Find("button"); + icon.MarkupMatches(@); + toggle.MarkupMatches(@); + } + + [Test] + public void Test_ToggleTheme() + { + JSInterop.Setup("getThemePreference", _ => true).SetResult("light"); + var savePref = JSInterop.SetupVoid("saveThemePreference", _ => true); + var applyTheme = JSInterop.SetupVoid("applyTheme", _ => true); + + var cut = RenderComponent(); + + cut.Render(); + + var toggle = cut.Find("button"); + toggle.MarkupMatches( + @); + + toggle.Click(); + savePref.SetVoidResult(); + applyTheme.SetVoidResult(); + + toggle.MarkupMatches( + @); + } + +} diff --git a/HVZ.Tests/HVZ.Web.Components.Tests/ThumbnailTest.razor b/HVZ.Tests/HVZ.Web.Components.Tests/ThumbnailTest.razor index 4e240b65..5f5cf8b5 100644 --- a/HVZ.Tests/HVZ.Web.Components.Tests/ThumbnailTest.razor +++ b/HVZ.Tests/HVZ.Web.Components.Tests/ThumbnailTest.razor @@ -58,7 +58,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); } @@ -74,7 +74,7 @@ var img = cut.Find("img"); string expectedsrc = $"https://ui-avatars.com/api/?name=Kevin+Smith&size={(int)size}"; img.MarkupMatches( - @ + @ ); } @@ -87,7 +87,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); } @@ -103,7 +103,7 @@ var img = cut.Find("img"); string expectedsrc = $"https://ui-avatars.com/api/?name=Test+Org&size={(int)size}"; img.MarkupMatches( - @ + @ ); } @@ -116,7 +116,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); } @@ -132,7 +132,7 @@ var img = cut.Find("img"); string expectedsrc = $"images/users/3_thumbnail_{(int)size}.jpeg"; img.MarkupMatches( - @ + @ ); } @@ -145,7 +145,7 @@ var img = cut.Find("img"); img.MarkupMatches( - @ + @ ); } @@ -161,26 +161,7 @@ var img = cut.Find("img"); string expectedsrc = $"images/orgs/1_thumbnail_{(int)size}.jpeg"; img.MarkupMatches( - @ - ); - } - - [Test] - public void Test_AttributeSplatting() - { - var cut = Render( - @ - ); - - var imgById = cut.Find("#thumbnail"); - var imgByClass = cut.Find(".img"); - - imgById.MarkupMatches( - @ - ); - - imgByClass.MarkupMatches( - @ + @ ); } } \ No newline at end of file diff --git a/HVZ.Web/Pages/About.razor b/HVZ.Web/Pages/About.razor new file mode 100644 index 00000000..79e40f8d --- /dev/null +++ b/HVZ.Web/Pages/About.razor @@ -0,0 +1,52 @@ +@using Microsoft.AspNetCore.Components.Authorization +@using HVZ.Web.Services +@inject NavigationManager Navigation +@inject AuthenticationStateProvider AuthenticationStateProvider +@inject EmailService Email +@page "/about" + +PlayHVZ + +
+

Welcome to PlayHVZ.org

+ @*This lives here for now until we create a settings page*@ + +

PlayHVZ is a tool for managing games of Humans vs Zombies.

+ + + + + +

Welcome back

+
+ +
+
+

New to PlayHVZ?

+ Register +
+
+

Returning user?

+ Login +
+
+
+ +
+ +
+ + +

Features

+
    +
  • + Organization management +
  • +
  • + OZs +
  • +
  • + Discord integration +
  • +
+
\ No newline at end of file diff --git a/HVZ.Web/Pages/Account/Login.cshtml b/HVZ.Web/Pages/Account/Login.cshtml index c17145f5..67d21b99 100644 --- a/HVZ.Web/Pages/Account/Login.cshtml +++ b/HVZ.Web/Pages/Account/Login.cshtml @@ -6,14 +6,15 @@ @{ } - + - + + @@ -64,7 +65,8 @@ - - + + - \ No newline at end of file + + \ No newline at end of file diff --git a/HVZ.Web/Pages/Account/Register.cshtml b/HVZ.Web/Pages/Account/Register.cshtml index f9a0e7e4..bd4f2a72 100644 --- a/HVZ.Web/Pages/Account/Register.cshtml +++ b/HVZ.Web/Pages/Account/Register.cshtml @@ -7,13 +7,15 @@ @{ } + - + + @@ -71,5 +73,8 @@ + + + \ No newline at end of file diff --git a/HVZ.Web/Pages/Account/Reset.cshtml b/HVZ.Web/Pages/Account/Reset.cshtml index 793cde0c..93f5341a 100644 --- a/HVZ.Web/Pages/Account/Reset.cshtml +++ b/HVZ.Web/Pages/Account/Reset.cshtml @@ -9,9 +9,10 @@ - + + Reset Password @@ -55,7 +56,9 @@ } + + \ No newline at end of file diff --git a/HVZ.Web/Pages/Account/ResetRequest.cshtml b/HVZ.Web/Pages/Account/ResetRequest.cshtml index 204ae81b..d457bc57 100644 --- a/HVZ.Web/Pages/Account/ResetRequest.cshtml +++ b/HVZ.Web/Pages/Account/ResetRequest.cshtml @@ -9,9 +9,10 @@ - + + Reset Password @@ -45,7 +46,7 @@

Success! Please check your email.

} - - + + - \ No newline at end of file + diff --git a/HVZ.Web/Pages/Explore.razor b/HVZ.Web/Pages/Explore.razor new file mode 100644 index 00000000..da23cecd --- /dev/null +++ b/HVZ.Web/Pages/Explore.razor @@ -0,0 +1,7 @@ +@page "/explore" + +

Explore

+ +@code { + +} diff --git a/HVZ.Web/Pages/Index.razor b/HVZ.Web/Pages/Index.razor index 0ed1b368..fb15ef93 100644 --- a/HVZ.Web/Pages/Index.razor +++ b/HVZ.Web/Pages/Index.razor @@ -3,24 +3,21 @@ @inject NavigationManager Navigation @inject AuthenticationStateProvider AuthenticationStateProvider @inject EmailService Email -@* @inject ImageService Image *@ @page "/" -Index +PlayHVZ Home - +
+ @*Home*@ +

Home

+ @*This lives here for now until we create a settings page*@ + + + + + + + + - - - -

- Hello, @context.User.Claims.FirstOrDefault(c => c.Type == "FullName")?.Value! -

-
- - Login - - -
- - +
\ No newline at end of file diff --git a/HVZ.Web/Pages/_Layout.cshtml b/HVZ.Web/Pages/_Layout.cshtml index 198236ff..b44d01c3 100644 --- a/HVZ.Web/Pages/_Layout.cshtml +++ b/HVZ.Web/Pages/_Layout.cshtml @@ -3,14 +3,15 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - + - + + @@ -28,5 +29,8 @@ + + @**@ + diff --git a/HVZ.Web/Shared/LoginDisplay.razor b/HVZ.Web/Shared/LoginDisplay.razor index 8ed3d64d..ee96d228 100644 --- a/HVZ.Web/Shared/LoginDisplay.razor +++ b/HVZ.Web/Shared/LoginDisplay.razor @@ -2,17 +2,21 @@ @inject NavigationManager Navigation @inject AuthenticationStateProvider AuthenticationStateProvider - - - - Logout - - - Login - - - - +
+ + + + Logout +
+ +
+
+ + Login + +
+
+
@code { private string? id = "1234"; diff --git a/HVZ.Web/Shared/MainLayout.razor b/HVZ.Web/Shared/MainLayout.razor index 84a16aa2..e888be3b 100644 --- a/HVZ.Web/Shared/MainLayout.razor +++ b/HVZ.Web/Shared/MainLayout.razor @@ -1,20 +1,19 @@ -@inherits LayoutComponentBase +@using HVZ.Web.Shared.Navigation +@inherits LayoutComponentBase HVZ.Web
-
-
- - About -
+ +
@Body
+ +
+
diff --git a/HVZ.Web/Shared/NavMenu.razor b/HVZ.Web/Shared/NavMenu.razor index 1b3df88c..76823d70 100644 --- a/HVZ.Web/Shared/NavMenu.razor +++ b/HVZ.Web/Shared/NavMenu.razor @@ -1,6 +1,6 @@ -