From 5a4084be6ebd825528e5a419eaba7f70df23be89 Mon Sep 17 00:00:00 2001 From: joao4all Date: Fri, 6 Oct 2023 16:32:22 +0100 Subject: [PATCH] Requested changes --- .../Components/LoginTestFixture.cs | 29 ++++++++++--------- COMET.Web.Common/Components/Login.razor | 2 +- COMET.Web.Common/Components/Login.razor.cs | 19 ++++-------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/COMET.Web.Common.Tests/Components/LoginTestFixture.cs b/COMET.Web.Common.Tests/Components/LoginTestFixture.cs index ca7e864e..f93b62c4 100644 --- a/COMET.Web.Common.Tests/Components/LoginTestFixture.cs +++ b/COMET.Web.Common.Tests/Components/LoginTestFixture.cs @@ -25,8 +25,6 @@ namespace COMET.Web.Common.Tests.Components { - using AngleSharp.Dom; - using Bunit; using COMET.Web.Common.Components; @@ -40,7 +38,7 @@ namespace COMET.Web.Common.Tests.Components using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Web; using Microsoft.Extensions.DependencyInjection; - using Microsoft.JSInterop; + using Moq; using NUnit.Framework; @@ -85,22 +83,27 @@ public async Task VerifyFocusingAndBluring() { "Password", false } })); - Assert.IsFalse(renderer.Instance.FieldsFocusedStatus["UserName"]); - const string fieldToFocusOn = "Username"; - + const string fieldToFocusOn = "UserName"; + Assert.That(renderer.Instance.FieldsFocusedStatus[fieldToFocusOn], Is.False); renderer.Instance.HandleFieldFocus(fieldToFocusOn); - - foreach (var fieldStatus in renderer.Instance.FieldsFocusedStatus) + + Assert.Multiple(()=> { - Assert.That(fieldStatus.Value, fieldStatus.Key == fieldToFocusOn ? Is.True : Is.False); - } + foreach (var fieldStatus in renderer.Instance.FieldsFocusedStatus) + { + Assert.That(fieldStatus.Value, fieldStatus.Key == fieldToFocusOn ? Is.True : Is.False); + } + }); renderer.Instance.HandleFieldBlur(fieldToFocusOn); - foreach (var fieldStatus in renderer.Instance.FieldsFocusedStatus) + Assert.Multiple(() => { - Assert.That(fieldStatus.Value, Is.False); - } + foreach (var fieldStatus in renderer.Instance.FieldsFocusedStatus) + { + Assert.That(fieldStatus.Value, Is.False); + } + }); } [Test] diff --git a/COMET.Web.Common/Components/Login.razor b/COMET.Web.Common/Components/Login.razor index 938e9948..7ea2bb33 100644 --- a/COMET.Web.Common/Components/Login.razor +++ b/COMET.Web.Common/Components/Login.razor @@ -63,7 +63,7 @@