!2661 test(#I531V5): add ShowColumnList unit test on Table

* test: 增加 ShowColumnList 单元测试
* test: 更新 Upload 单元测试增加 await 关键字
This commit is contained in:
Argo 2022-04-16 07:05:56 +00:00
parent 5e582fc9c8
commit e9a55c2b42
2 changed files with 26 additions and 3 deletions

View File

@ -200,6 +200,29 @@ public class TableTest : TableTestBase
condtions = null;
cut.InvokeAsync(() => condtions = cut.FindComponent<StringFilter>().Instance.GetFilterConditions());
Assert.Empty(condtions);
}
[Fact]
public void ShowColumnList_Ok()
{
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
{
pb.AddChildContent<Table<Foo>>(pb =>
{
pb.Add(a => a.ShowToolbar, true);
pb.Add(a => a.ShowColumnList, true);
pb.Add(a => a.ColumnButtonText, "Test_Column_List");
pb.Add(a => a.Items, Foo.GenerateFoo(localizer));
pb.Add(a => a.TableColumns, foo => builder =>
{
builder.OpenComponent<TableColumn<Foo, string>>(0);
builder.AddAttribute(1, "Field", "Name");
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string)));
builder.CloseComponent();
});
});
});
cut.Contains("Test_Column_List");
}
}

View File

@ -594,10 +594,10 @@ public class UploadTest : BootstrapBlazorTestBase
}
[Fact]
public void CardUpload_Reset()
public async Task CardUpload_Reset()
{
var cut = Context.RenderComponent<CardUpload<string>>();
cut.InvokeAsync(() => cut.Instance.Reset());
await cut.InvokeAsync(() => cut.Instance.Reset());
Assert.Null(cut.Instance.DefaultFileList);
cut.SetParametersAndRender(pb =>
@ -607,7 +607,7 @@ public class UploadTest : BootstrapBlazorTestBase
new UploadFile() { FileName = "Test-File1.text" }
});
});
cut.InvokeAsync(() => cut.Instance.Reset());
await cut.InvokeAsync(() => cut.Instance.Reset());
Assert.Empty(cut.Instance.DefaultFileList);
}