diff --git a/COMET.Web.Common.Tests/Components/LoginTestFixture.cs b/COMET.Web.Common.Tests/Components/LoginTestFixture.cs index e7569f32..7e195a70 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; @@ -41,12 +39,11 @@ 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; - using TestContext = Bunit.TestContext; [TestFixture] @@ -117,22 +114,27 @@ public void 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 cccb13e2..377bd1e6 100644 --- a/COMET.Web.Common/Components/Login.razor +++ b/COMET.Web.Common/Components/Login.razor @@ -87,7 +87,6 @@ } - @if (!string.IsNullOrEmpty(this.ErrorMessage)) {
diff --git a/COMET.Web.Common/Components/Login.razor.cs b/COMET.Web.Common/Components/Login.razor.cs index 712a4a1b..dc402af2 100644 --- a/COMET.Web.Common/Components/Login.razor.cs +++ b/COMET.Web.Common/Components/Login.razor.cs @@ -66,10 +66,9 @@ public partial class Login public bool LoginEnabled { get; set; } = true; /// - /// The dictionary of focus status from the fields + /// The dictionary of focus status from the form fields /// - public Dictionary FieldsFocusedStatus; - + public Dictionary FieldsFocusedStatus { get; private set; } /// /// Method invoked when the component is ready to start, having received its