mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-11-29 18:49:08 +08:00
feat(NumberFilter): support nullable data type (#4261)
* feat: 支持可为空数据类型 * chore: bump version 8.9.2-beta06 * test: 更新单元测试
This commit is contained in:
parent
6f02ab0fe7
commit
9425792f61
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>8.9.2-beta05</Version>
|
||||
<Version>8.9.2-beta06</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||
|
@ -60,22 +60,22 @@ else
|
||||
<DateTimeFilter Count="_count" />
|
||||
break;
|
||||
case nameof(Int16):
|
||||
<NumberFilter TType="Int16" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Int16?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(Int32):
|
||||
<NumberFilter TType="Int32" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Int32?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(Int64):
|
||||
<NumberFilter TType="Int64" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Int64?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(Single):
|
||||
<NumberFilter TType="Single" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Single?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(Double):
|
||||
<NumberFilter TType="Double" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Double?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(Decimal):
|
||||
<NumberFilter TType="Decimal" Count="@_count" Step="@_step" />
|
||||
<NumberFilter TType="Decimal?" Count="@_count" Step="@_step" />
|
||||
break;
|
||||
case nameof(String):
|
||||
<StringFilter Count="_count" />
|
||||
|
@ -73,7 +73,7 @@ public class TableNumberFilterTest : BootstrapBlazorTestBase
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Misc_Ok()
|
||||
public async Task Misc_Ok()
|
||||
{
|
||||
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
|
||||
{
|
||||
@ -93,17 +93,17 @@ public class TableNumberFilterTest : BootstrapBlazorTestBase
|
||||
}));
|
||||
});
|
||||
});
|
||||
var filter = cut.FindComponent<NumberFilter<int>>();
|
||||
var input = filter.FindComponent<BootstrapInputNumber<int>>();
|
||||
var filter = cut.FindComponent<NumberFilter<int?>>();
|
||||
var input = filter.FindComponent<BootstrapInputNumber<int?>>();
|
||||
|
||||
// Click ToDay Cell
|
||||
cut.InvokeAsync(() =>
|
||||
await cut.InvokeAsync(() =>
|
||||
{
|
||||
input.Instance.SetValue(10);
|
||||
});
|
||||
|
||||
var filterButton = cut.FindComponent<FilterButton<FilterAction>>();
|
||||
cut.InvokeAsync(() =>
|
||||
await cut.InvokeAsync(() =>
|
||||
{
|
||||
// OnFilterValueChanged
|
||||
var logics = filterButton.FindAll(".dropdown-item");
|
||||
@ -118,15 +118,13 @@ public class TableNumberFilterTest : BootstrapBlazorTestBase
|
||||
Assert.Equal(FilterAction.LessThanOrEqual, conditions.Filters[0].FilterAction);
|
||||
|
||||
// OnClearFilter
|
||||
cut.InvokeAsync(() =>
|
||||
await cut.InvokeAsync(() =>
|
||||
{
|
||||
filterButton.Find(".fa-ban").Click();
|
||||
});
|
||||
conditions = filter.Instance.GetFilterConditions();
|
||||
Assert.NotNull(conditions.Filters);
|
||||
Assert.Single(conditions.Filters);
|
||||
Assert.Equal(0, conditions.Filters[0].FieldValue);
|
||||
Assert.Equal(FilterAction.GreaterThanOrEqual, conditions.Filters[0].FilterAction);
|
||||
Assert.Empty(conditions.Filters);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Loading…
Reference in New Issue
Block a user