Skip to content

Is there a way to assert that StateHasChanged method has been called? #226

Answered by egil
MiBuena asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MiBuena

Not directly. But hopefully you are not triggering a render through StateHasChanged without that render changing the render tree, so I would use the usual ways to see if the spinner (im guessing) is now showing, e.g. by using the cut.Find("css selector that finds the spinner").

If you really need to just see that a render has occurred, you can inspect the cut.RenderCount property, which will increment each time the component under test renders.

Hope this is helpful, Egil.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MiBuena
Comment options

Answer selected by MiBuena
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants