fe774f8ee4
- layout.css: fix @media sticky selector from #sidebar-collapse → #theme-rail (Fix 1) - NavRailTests/CommonControlsTests: add TDD tests verifying Blazor omits false bool attrs (Fix 2) - TechButton: rename Extra → AdditionalAttributes, move @attributes splat first (Fix 3) - LoginCard: add security contract XML/comment docs on ReturnUrl and ChildContent (Fix 4) - build/pack.sh, push.sh: fix comment from ZB.MOM.WW.Auth → ZB.MOM.WW.Theme (Fix 5)
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
namespace ZB.MOM.WW.Theme.Tests;
|
|
|
|
public class NavRailTests : TestContext
|
|
{
|
|
[Fact]
|
|
public void NavRailItem_renders_rail_link_with_href_and_text()
|
|
{
|
|
var cut = RenderComponent<NavRailItem>(p => p
|
|
.Add(x => x.Href, "/clusters")
|
|
.Add(x => x.Text, "Clusters"));
|
|
var a = cut.Find("a.rail-link");
|
|
Assert.Equal("/clusters", a.GetAttribute("href"));
|
|
Assert.Contains("Clusters", a.TextContent);
|
|
}
|
|
|
|
[Fact]
|
|
public void NavRailSection_renders_title_and_children_open_by_default()
|
|
{
|
|
var cut = RenderComponent<NavRailSection>(p => p
|
|
.Add(x => x.Title, "Navigation")
|
|
.AddChildContent("<a class='rail-link'>X</a>"));
|
|
var details = cut.Find("details.rail-section");
|
|
Assert.True(details.HasAttribute("open"));
|
|
Assert.Contains("Navigation", cut.Find("summary").TextContent);
|
|
Assert.NotNull(cut.Find(".rail-section-body .rail-link"));
|
|
}
|
|
|
|
[Fact]
|
|
public void NavRailSection_collapsed_when_not_expanded()
|
|
{
|
|
var cut = RenderComponent<NavRailSection>(p => p
|
|
.Add(x => x.Title, "Nav").Add(x => x.Expanded, false)
|
|
.AddChildContent("<a class='rail-link'>X</a>"));
|
|
Assert.False(cut.Find("details.rail-section").HasAttribute("open"));
|
|
}
|
|
}
|