mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-03 12:37:40 +08:00
chore: setup js interops for tests (#4066)
* setup js interops * add more setup * fix test
This commit is contained in:
parent
6124687ca2
commit
63223455d1
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using AntDesign.JsInterop;
|
||||
using Bunit;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -10,10 +11,10 @@ namespace AntDesign.Tests
|
||||
{
|
||||
public class AntDesignTestBase : TestContext, IDisposable
|
||||
{
|
||||
protected string DateFormat => "dd/MM/yyyy";
|
||||
protected string TimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
protected const string DateFormat = "dd/MM/yyyy";
|
||||
protected const string TimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
protected readonly CultureInfo Culture = CultureInfo.InvariantCulture;
|
||||
|
||||
|
||||
public TestContext Context => this;
|
||||
public NavigationManager NavigationManager => Services.GetRequiredService<NavigationManager>();
|
||||
|
||||
@ -24,8 +25,12 @@ namespace AntDesign.Tests
|
||||
Services.AddAntDesign();
|
||||
|
||||
//Needed for Tests using Overlay
|
||||
Services.AddScoped<AntDesign.JsInterop.DomEventService>(sp => new TestDomEventService(Context.JSInterop.JSRuntime, MockedDomEventListener));
|
||||
Services.AddScoped<DomEventService>(sp => new TestDomEventService(Context.JSInterop.JSRuntime, MockedDomEventListener));
|
||||
JSInterop.SetupVoid(JSInteropConstants.OverlayComponentHelper.DeleteOverlayFromContainer, _ => true);
|
||||
JSInterop.SetupVoid("AntDesign.interop.tableHelper.bindTableScroll", _ => true);
|
||||
JSInterop.Setup<Task>("AntDesign.interop.domManipulationHelper.blur").SetResult(Task.CompletedTask);
|
||||
JSInterop.SetupVoid("AntDesign.interop.domManipulationHelper.smoothScrollTo", _ => true);
|
||||
|
||||
JSInterop.Mode = JSRuntimeMode.Strict;
|
||||
|
||||
LocaleProvider.SetLocale("en-US");
|
||||
|
Loading…
Reference in New Issue
Block a user