File tree Expand file tree Collapse file tree
tests/bunit.web.tests/JSInterop/InvocationHandlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#if NET5_0
2+ using System;
23using System.Threading.Tasks;
4+ using Bunit.TestAssets.SampleComponents;
35using Microsoft.AspNetCore.Components;
46using Microsoft.AspNetCore.Components.Rendering;
57using 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;
You can’t perform that action at this time.
0 commit comments