Skip to content

Commit

Permalink
solution rebased again
Browse files Browse the repository at this point in the history
  • Loading branch information
joao4all committed Oct 10, 2023
2 parents 297b3e2 + adb4369 commit 428672d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
30 changes: 16 additions & 14 deletions COMET.Web.Common.Tests/Components/LoginTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

namespace COMET.Web.Common.Tests.Components
{
using AngleSharp.Dom;

using Bunit;

using COMET.Web.Common.Components;
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion COMET.Web.Common/Components/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
}
</ul>


@if (!string.IsNullOrEmpty(this.ErrorMessage))
{
<div class="form-group row m-top-10px">
Expand Down
5 changes: 2 additions & 3 deletions COMET.Web.Common/Components/Login.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ public partial class Login
public bool LoginEnabled { get; set; } = true;

/// <summary>
/// The dictionary of focus status from the fields
/// The dictionary of focus status from the form fields
/// </summary>
public Dictionary<string, bool> FieldsFocusedStatus;

public Dictionary<string, bool> FieldsFocusedStatus { get; private set; }

/// <summary>
/// Method invoked when the component is ready to start, having received its
Expand Down

0 comments on commit 428672d

Please sign in to comment.