feat(centralui): LoginCard sign-in
Replace hand-rolled Bootstrap card with the shared <LoginCard> from ZB.MOM.WW.Theme. Update ComponentRenderingTests assertions to match LoginCard's rendered structure (h1.login-title, div.panel.notice.login-error, "Sign in" button text).
This commit is contained in:
@@ -3,34 +3,8 @@
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@attribute [AllowAnonymous]
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center min-vh-100">
|
||||
<div class="card shadow-sm" style="max-width: 400px; width: 100%;">
|
||||
<div class="card-body p-4">
|
||||
<h4 class="card-title mb-4 text-center">ScadaBridge</h4>
|
||||
|
||||
@if (!string.IsNullOrEmpty(ErrorMessage))
|
||||
{
|
||||
<div class="alert alert-danger py-2" role="alert">@ErrorMessage</div>
|
||||
}
|
||||
|
||||
<form method="post" action="/auth/login" data-enhance="false">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username"
|
||||
required autocomplete="username" autofocus />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password"
|
||||
required autocomplete="current-password" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100">Sign In</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<LoginCard Product="ScadaBridge" Action="/auth/login" Error="@ErrorMessage" />
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery(Name = "error")]
|
||||
public string? ErrorMessage { get; set; }
|
||||
[SupplyParameterFromQuery(Name = "error")] public string? ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ComponentRenderingTests : BunitContext
|
||||
|
||||
// Verify submit button
|
||||
var submitButton = cut.Find("button[type='submit']");
|
||||
Assert.Contains("Sign In", submitButton.TextContent);
|
||||
Assert.Contains("Sign in", submitButton.TextContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -42,7 +42,7 @@ public class ComponentRenderingTests : BunitContext
|
||||
{
|
||||
var cut = Render<Login>();
|
||||
|
||||
Assert.Throws<Bunit.ElementNotFoundException>(() => cut.Find("div.alert.alert-danger"));
|
||||
Assert.Throws<Bunit.ElementNotFoundException>(() => cut.Find("div.panel.notice.login-error"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,7 +69,7 @@ public class ComponentRenderingTests : BunitContext
|
||||
{
|
||||
var cut = Render<Login>();
|
||||
|
||||
var title = cut.Find("h4.card-title");
|
||||
Assert.Equal("ScadaBridge", title.TextContent);
|
||||
var title = cut.Find("h1.login-title");
|
||||
Assert.Contains("ScadaBridge", title.TextContent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user