-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Added test for MarkupMatches to render fragment when renderer …
…is in use (#1157)
- Loading branch information
1 parent
4cb7458
commit ffd6fa7
Showing
3 changed files
with
51 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/bunit.testassets/SampleComponents/LoadingComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<span>@text</span> | ||
@code { | ||
[Parameter] | ||
public Task Task { get; set; } | ||
|
||
private string text = "loading"; | ||
protected override async Task OnInitializedAsync() | ||
{ | ||
await Task; | ||
text = "done"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@using Bunit.TestAssets.SampleComponents | ||
@inherits TestContext | ||
|
||
@code { | ||
[Fact] | ||
public void MarkupMatchesShouldNotBeBlockedByRenderer() | ||
{ | ||
var tcs = new TaskCompletionSource<object?>(); | ||
|
||
var cut = Render(@<LoadingComponent Task="@tcs.Task"/> ); | ||
|
||
cut.MarkupMatches(@<span>loading</span>); | ||
|
||
tcs.SetResult(true); | ||
|
||
cut.WaitForAssertion(() => cut.MarkupMatches(@<span>done</span>)); | ||
} | ||
} |