mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-02 03:59:14 +08:00
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:
parent
f3d1c2cda7
commit
90ecae9491
@ -1,4 +1,4 @@
|
||||
name: sync issue to PR(bot)
|
||||
name: auto sync issue to PR(bot)
|
||||
|
||||
on:
|
||||
pull_request:
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Build Project
|
||||
name: buid project
|
||||
|
||||
on:
|
||||
push:
|
||||
|
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Deploy To Huawei VM
|
||||
name: deploy to Huawei VM
|
||||
|
||||
on:
|
||||
push:
|
||||
|
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Docker Image CI
|
||||
name: build docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
|
2
.github/workflows/pack.yml
vendored
2
.github/workflows/pack.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Package to Nuget
|
||||
name: build nuget package
|
||||
|
||||
on:
|
||||
push:
|
||||
|
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Deploy To Pages
|
||||
name: deploy to github pages
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -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}"
|
||||
|
@ -47,7 +47,7 @@ public sealed partial class SubMenu
|
||||
private IStringLocalizer<Menu>? Localizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 获得 样式字符串
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user