48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using Bunit;
|
|||
|
|
using Heimdall.Web.Components;
|
||
|
|
using Heimdall.Web.Tests.Components.Pages;
|
||
|
|
using MudBlazor;
|
||
|
|
using Shouldly;
|
||
|
|
|
||
|
|
namespace Heimdall.Web.Tests.Components;
|
||
|
|
|
||
|
|
public class StatTileTests : PageTestBase
|
||
|
|
{
|
||
|
|
[Fact]
|
||
|
|
public void StatTile_AfficheValeurLabelEtFooter()
|
||
|
|
{
|
||
|
|
var cut = Render<StatTile>(p => p
|
||
|
|
.Add(x => x.Label, "Caméras")
|
||
|
|
.Add(x => x.Value, "42")
|
||
|
|
.Add(x => x.Icon, Icons.Material.Filled.Videocam)
|
||
|
|
.Add(x => x.Footer, b => b.AddContent(0, "30 en ligne")));
|
||
|
|
|
||
|
|
cut.Markup.ShouldContain("Caméras");
|
||
|
|
cut.Markup.ShouldContain("42");
|
||
|
|
cut.Markup.ShouldContain("30 en ligne");
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public void StatTile_Loading_AfficheSkeletons()
|
||
|
|
{
|
||
|
|
var cut = Render<StatTile>(p => p
|
||
|
|
.Add(x => x.Label, "Caméras")
|
||
|
|
.Add(x => x.Value, "42")
|
||
|
|
.Add(x => x.Loading, true));
|
||
|
|
|
||
|
|
// Le contenu (valeur/label) est remplacé par des skeletons pendant le chargement
|
||
|
|
cut.Markup.ShouldNotContain("42");
|
||
|
|
cut.Markup.ShouldContain("mud-skeleton");
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public void StatTile_ValueStyle_AppliqueCouleurCss()
|
||
|
|
{
|
||
|
|
var cut = Render<StatTile>(p => p
|
||
|
|
.Add(x => x.Label, "En ligne")
|
||
|
|
.Add(x => x.Value, "7")
|
||
|
|
.Add(x => x.ValueStyle, "color:#22C55E"));
|
||
|
|
|
||
|
|
cut.Markup.ShouldContain("color:#22C55E");
|
||
|
|
}
|
||
|
|
}
|