Skip to content

Commit a3fc598

Browse files
committed
Added additional test that verifies capture of multiple FocusAsync calls
1 parent c3441cb commit a3fc598

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/bunit.web.tests/JSInterop/InvocationHandlers/FocusAsyncInvocationHandlerTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#if NET5_0
2+
using System;
23
using System.Threading.Tasks;
4+
using Bunit.TestAssets.SampleComponents;
35
using Microsoft.AspNetCore.Components;
46
using Microsoft.AspNetCore.Components.Rendering;
57
using Xunit;
@@ -16,6 +18,21 @@ public void Test001()
1618
JSInterop.VerifyFocusAsyncInvoke().Arguments[0].ShouldBeElementReferenceTo(input);
1719
}
1820

21+
[Fact(DisplayName = "Can capture two FocusAsync calls")]
22+
public void Test002()
23+
{
24+
var cut = RenderComponent<Wrapper>(ps => ps
25+
.AddChildContent<FocusingComponent>()
26+
.AddChildContent<FocusingComponent>()
27+
);
28+
29+
var inputs = cut.FindAll("input");
30+
31+
var invocations = JSInterop.VerifyFocusAsyncInvoke(calledTimes: 2);
32+
invocations[0].Arguments[0].ShouldBeElementReferenceTo(inputs[0]);
33+
invocations[1].Arguments[0].ShouldBeElementReferenceTo(inputs[1]);
34+
}
35+
1936
class FocusingComponent : ComponentBase
2037
{
2138
ElementReference elmRef;

0 commit comments

Comments
 (0)