Skip to content
Merged
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.8.0-beta02</Version>
<Version>9.8.0-beta03</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@namespace BootstrapBlazor.Components
@inherits FilterBase

<div>@NotSupportedMessage</div>
51 changes: 51 additions & 0 deletions src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone

using Microsoft.Extensions.Localization;

namespace BootstrapBlazor.Components;

/// <summary>
/// NotSupportFilter component
/// </summary>
public partial class NotSupportFilter
{
[Inject]
[NotNull]
private IStringLocalizer<TableColumnFilter>? Localizer { get; set; }

Check warning on line 17 in src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs

View workflow job for this annotation

GitHub Actions / run test

'NotSupportFilter.Localizer' hides inherited member 'FilterBase.Localizer'. Use the new keyword if hiding was intended.

/// <summary>
/// 获得/设置 不支持过滤类型提示信息 默认 null 读取资源文件内容
/// </summary>
[Parameter]
public string? NotSupportedMessage { get; set; }

/// <summary>
/// <inheritdoc/>
/// </summary>
protected override void OnParametersSet()
{
base.OnParametersSet();

NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)];
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
public override FilterKeyValueAction GetFilterConditions()
{
return new();
}

Check warning on line 42 in src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs#L40-L42

Added lines #L40 - L42 were not covered by tests

/// <summary>
/// <inheritdoc/>
/// </summary>
public override void Reset()
{

Check warning on line 48 in src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs#L48

Added line #L48 was not covered by tests

}

Check warning on line 50 in src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs#L50

Added line #L50 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ else
</FilterProvider>
break;
default:
<div>@NotSupportedMessage</div>
<FilterProvider>
<NotSupportFilter NotSupportedMessage="@NotSupportedMessage"></NotSupportFilter>
</FilterProvider>
break;
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ protected override void OnInitialized()
_fieldKey = Column.GetFieldName();
}

/// <summary>
/// <inheritdoc/>
/// </summary>
protected override void OnParametersSet()
{
base.OnParametersSet();

NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)];
}

/// <summary>
/// <inheritdoc/>
/// </summary>
Expand Down
16 changes: 8 additions & 8 deletions test/UnitTest/Components/TabTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ public async Task IsLoopSwitchTabItem_Ok()
pb.Add(a => a.ChildContent, "Tab2-Content");
});
});
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

// Click Prev
var button = cut.Find(".nav-link-bar.left .nav-link-bar-button");
await cut.InvokeAsync(() => button.Click());
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

// Click Next
button = cut.Find(".nav-link-bar.right .nav-link-bar-button");
await cut.InvokeAsync(() => button.Click());
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

await cut.InvokeAsync(() => button.Click());
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);
}

[Fact]
Expand Down Expand Up @@ -240,7 +240,7 @@ public void ClickTab_Ok()
pb.Add(a => a.ChildContent, "Tab2-Content");
});
});
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

// Click TabItem
cut.Find(".tabs-item").Click();
Expand All @@ -251,14 +251,14 @@ public void ClickTab_Ok()
button.Click();
button.Click();
button.Click();
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab1-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

// Click Next
button = cut.Find(".nav-link-bar.right .nav-link-bar-button");
button.Click();
button.Click();
button.Click();
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none").InnerHtml);
Assert.Equal("Tab2-Content", cut.Find(".tabs-body .d-none .tabs-body-content-wrap").InnerHtml);

// Close
Assert.Null(closedItem);
Expand Down Expand Up @@ -342,7 +342,7 @@ public void AddTab_Ok()

cut.InvokeAsync(() => tab.AddTab("/", "Tab2", "fa-solid fa-font-awesome", false, true));
cut.InvokeAsync(() => tab.CloseOtherTabs());
Assert.Equal("Tab1-Body", cut.Find(".tabs-body-content").InnerHtml);
Assert.Equal("Tab1-Body", cut.Find(".tabs-body-content .tabs-body-content-wrap").InnerHtml);

// NotFound
cut.InvokeAsync(() => tab.AddTab("/Test", "Tab3", "fa-solid fa-font-awesome", false, true));
Expand Down