mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 13:37:35 +08:00
713eb6fd94
test: add general overlay disposal method mock
31 lines
957 B
C#
31 lines
957 B
C#
using System;
|
|
using System.Globalization;
|
|
using Bunit;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace AntDesign.Tests
|
|
{
|
|
public class AntDesignTestBase : TestContext, IDisposable
|
|
{
|
|
public TestContext Context => this;
|
|
public NavigationManager NavigationManager => Services.GetRequiredService<NavigationManager>();
|
|
|
|
public AntDesignTestBase()
|
|
{
|
|
Services.AddAntDesign();
|
|
|
|
//Needed for Tests using Overlay
|
|
Services.AddScoped<AntDesign.JsInterop.DomEventService>(sp => new TestDomEventService(Context.JSInterop.JSRuntime));
|
|
JSInterop.SetupVoid(JSInteropConstants.OverlayComponentHelper.DeleteOverlayFromContainer, _ => true);
|
|
|
|
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US");
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Context?.Dispose();
|
|
}
|
|
}
|
|
}
|