2026-07-23 19:38:30 +00:00
|
|
|
using Bunit;
|
|
|
|
|
using Heimdall.Web.Components.Shared;
|
|
|
|
|
using Shouldly;
|
|
|
|
|
|
|
|
|
|
namespace Heimdall.Web.Tests.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// bUnit tests for shared Blazor components.
|
|
|
|
|
/// Tests PaginationBar, EmptyState, LoadingSkeleton, SectionCard.
|
|
|
|
|
/// StatusChip is omitted because MudChip requires complex MudBlazor DI setup.
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
2026-10-25 06:17:43 +01:00
|
|
|
public class PaginationBarTests : MudTestBase
|
2026-07-23 19:38:30 +00:00
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_page_info()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<PaginationBar>();
|
|
|
|
|
cut.Markup.ShouldNotBeNullOrEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_two_buttons()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<PaginationBar>();
|
|
|
|
|
var buttons = cut.FindAll("button");
|
|
|
|
|
buttons.Count.ShouldBe(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class EmptyStateTests : TestContext
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_default()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<EmptyState>();
|
|
|
|
|
cut.Markup.ShouldNotBeNullOrEmpty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LoadingSkeletonTests : TestContext
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_skeletons()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<LoadingSkeleton>();
|
|
|
|
|
var skeletons = cut.FindAll(".mud-skeleton");
|
|
|
|
|
skeletons.Count.ShouldBeGreaterThanOrEqualTo(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_without_title()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<LoadingSkeleton>();
|
|
|
|
|
var text = cut.Markup;
|
|
|
|
|
text.ShouldNotBeNullOrEmpty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SectionCardTests : TestContext
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Should_render_default()
|
|
|
|
|
{
|
|
|
|
|
var cut = Render<SectionCard>();
|
|
|
|
|
cut.Markup.ShouldNotBeNullOrEmpty();
|
|
|
|
|
}
|
|
|
|
|
}
|