test: add menu unit test improve code coverage (#401)

* chore: rename action name

* doc: 增加注释

* test: add IsDisabled unit test

* test: update IsDisabled unit test

Co-authored-by: Argo Zhang <argo@163.com>
Co-authored-by: lambert lee <lish@live.cn>
This commit is contained in:
Lambert Lee 2023-01-27 20:09:07 +08:00 committed by GitHub
parent f3d1c2cda7
commit 90ecae9491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 8 deletions

View File

@ -1,4 +1,4 @@
name: sync issue to PR(bot)
name: auto sync issue to PR(bot)
on:
pull_request:

View File

@ -1,4 +1,4 @@
name: Build Project
name: buid project
on:
push:

View File

@ -1,4 +1,4 @@
name: Deploy To Huawei VM
name: deploy to Huawei VM
on:
push:

View File

@ -1,4 +1,4 @@
name: Docker Image CI
name: build docker image
on:
push:

View File

@ -1,4 +1,4 @@
name: Package to Nuget
name: build nuget package
on:
push:

View File

@ -1,4 +1,4 @@
name: Deploy To Pages
name: deploy to github pages
on:
push:

View File

@ -42,12 +42,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{F07542
.github\workflows\auto_comment_issue.yml = .github\workflows\auto_comment_issue.yml
.github\workflows\auto_pull_request_checks.yml = .github\workflows\auto_pull_request_checks.yml
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\auto_sync_from_issue.yml = .github\workflows\auto_sync_from_issue.yml
.github\workflows\deploy.yml = .github\workflows\deploy.yml
.github\workflows\docker.yml = .github\workflows\docker.yml
.github\workflows\pack.yml = .github\workflows\pack.yml
.github\workflows\publish.yml = .github\workflows\publish.yml
.github\workflows\release.yml = .github\workflows\release.yml
.github\workflows\sync_from_issue.yml = .github\workflows\sync_from_issue.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{9437A6C6-CF87-4B75-916B-C1EF558BD8EF}"

View File

@ -47,7 +47,7 @@ public sealed partial class SubMenu
private IStringLocalizer<Menu>? Localizer { get; set; }
/// <summary>
///
/// 获得 样式字符串
/// </summary>
/// <param name="item"></param>
/// <returns></returns>

View File

@ -227,6 +227,41 @@ public class MenuTest : BootstrapBlazorTestBase
Assert.Contains("is-collapsed", cut.Markup);
}
[Fact]
public void IsDisabled_Ok()
{
var items = new List<MenuItem>()
{
new("Menu1")
{
Icon = "fa-solid fa-font-awesome",
Url = "https://www.blazor.zone",
Items = new List<MenuItem>()
{
new("Menu2")
{
Icon = "fa-solid fa-fw fa-font-awesome",
Items = new List<MenuItem>()
{
new("Menu3")
{
IsActive = true,
IsDisabled = true,
Icon = "fa-solid fa-fw fa-font-awesome"
}
}
}
}
},
};
var cut = Context.RenderComponent<Menu>(pb =>
{
pb.Add(m => m.Items, items);
});
Assert.Contains("disabled", cut.Markup);
Assert.DoesNotContain("active", cut.Markup);
}
[Fact]
public void IsAccordion_Ok()
{