Skip to content

Commit 9f6df01

Browse files
committed
Make sure that interactive tests work only when interactivity is on.
1 parent 1c2dcae commit 9f6df01

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/Components/test/testassets/Components.WasmMinimal/Pages/NotFound/RedirectionNotFound-Interactive.razor

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@page "/redirection-not-found"
22
@page "/reexecution/redirection-not-found"
33

4-
<RedirectionNotFoundComponent @rendermode="@RenderModeHelper.GetRenderMode(_renderMode)" />
4+
<RedirectionNotFoundComponent @rendermode="@RenderModeHelper.GetRenderMode(_renderMode)" WaitForInteractivity="true"/>
55

66
@code{
77
[Parameter, SupplyParameterFromQuery(Name = "renderMode")]
@@ -15,5 +15,9 @@
1515
{
1616
_renderMode = RenderModeHelper.ParseRenderMode(RenderModeStr);
1717
}
18+
else
19+
{
20+
throw new ArgumentException("RenderModeStr cannot be null or empty. Did you mean to redirect to /redirection-not-found-ssr?", nameof(RenderModeStr));
21+
}
1822
}
19-
}
23+
}

src/Components/test/testassets/Components.WasmMinimal/Pages/NotFound/RedirectionNotFoundComponent.razor

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
2-
@inject NavigationManager NavigationManager
1+
@inject NavigationManager NavigationManager
32

4-
<h1>Original page</h1>
3+
@if (!WaitForInteractivity || RendererInfo.IsInteractive)
4+
{
5+
<h1>Original page</h1>
56

6-
<p id="test-info">Any content</p>
7-
<a id="link-to-not-existing-page" href="@_nonExistingPath">
8-
Go to not-existing-page
9-
</a>
7+
<p id="test-info">Any content</p>
8+
<a id="link-to-not-existing-page" href="@_nonExistingPath">
9+
Go to not-existing-page
10+
</a>
11+
}
1012

1113
@code{
1214
[Parameter]
@@ -16,6 +18,9 @@
1618
[Parameter]
1719
public bool StartStreaming { get; set; } = false;
1820

21+
[Parameter]
22+
public bool WaitForInteractivity { get; set; } = false;
23+
1924
private string _nonExistingPath = string.Empty;
2025

2126
protected override async Task OnInitializedAsync()

0 commit comments

Comments
 (0)