Skip to content

bUnit with MatBlazor components (OnValidSubmit) #248

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

You must be logged in to vote

Moving answer here to make it easier for others to find.

Any nodes found using FindAll is replaced when the component under test re-renders, since the DOM tree is replaced on each render. So you cannot observe changes in elements found using FindAll between renders.

Instead, try to use Find instead. I have some magic behind that which will update the data on the object, and it will work more as expected.

Anyway, I modified Counter slightly to make for a more useful test - I exposed the LoginModel on submit through the SubmittedLogin property. Here it is the full Counter example:

@page "/counter"

@using BugRepro.Classes

<h1>Counter</h1>

<EditForm Model="login" OnValidSubmit="@LoginSubmit"

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@minimalisticMe
Comment options

@minimalisticMe
Comment options

@egil
Comment options

egil Nov 3, 2020
Maintainer

@minimalisticMe
Comment options

@egil
Comment options

egil Nov 4, 2020
Maintainer

Comment options

You must be logged in to vote
0 replies
Answer selected by egil
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
Converted from issue

This discussion was converted from issue #248 on November 02, 2020 20:48.