Replies: 1 comment 2 replies
-
Hi, I think I need you to reproduce this in a small downloadable sample. My own example below works with an inline lambda eventcallback: @* Index.razor *@
<div @onclick="@(() => Counter++)">@Counter</div>
@code
{
public int Counter { get; set; }
} @* IndexTest.razor *@
@inherits TestContext
@code
{
[Fact]
public void Test()
{
var cut = Render(@<Index />);
cut.Find("div").MarkupMatches(@<div>0</div>);
cut.Find("div").Click();
cut.Find("div").MarkupMatches(@<div>1</div>);
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to test a fairly complex component of AntDesign (datepicker). My current issue is that for some reason bunit blocks(?) raising event if lambda is used to define the handling. Without going deep into details (yet), I wanted to test the result of this
onclick
event:I find this element in my tests and execute click on it
This does not work, the breakpoint on
CellClick
is never reached (here is another minor issue that I have - my understanding is that I should be able to find the div that I want with a css selector like this[title=2021-04-05]
butFind
method cannot find it). I do find the properdiv
, thecellToClick
contains markup I am expecting.So just to do a sanity check, I modified the code to remove lambda (also had to modify
CellClick
)Now the breakpoint in
CellClick
is fired. The problem is that I really need the lambda because I need to pass this extra datacurrentColDate
. Is there a simple explanation to this or shall I try to do a repro?This component works as it is expected when run in browser.
Beta Was this translation helpful? Give feedback.
All reactions