From cb473e8ad77d6c42a72f0e81deb5feea55517d38 Mon Sep 17 00:00:00 2001 From: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Date: Fri, 16 Mar 2018 10:53:12 +0000 Subject: [PATCH] Add test case to show base-relative links work --- .../Tests/RoutingTest.cs | 10 ++++++++++ test/testapps/BasicTestApp/RouterTest/Links.cshtml | 1 + 2 files changed, 11 insertions(+) diff --git a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/RoutingTest.cs b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/RoutingTest.cs index 66a4bb1fd07..8970de915cd 100644 --- a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/RoutingTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/RoutingTest.cs @@ -50,6 +50,16 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.Equal("This is another page.", app.FindElement(By.Id("test-info")).Text); } + [Fact] + public void CanFollowLinkToOtherPageWithBaseRelativeUrl() + { + SetUrlViaPushState($"{ServerPathBase}/RouterTest/"); + + var app = MountTestComponent<TestRouter>(); + app.FindElement(By.LinkText("Other with base-relative URL")).Click(); + Assert.Equal("This is another page.", app.FindElement(By.Id("test-info")).Text); + } + [Fact] public void CanFollowLinkToDefaultPage() { diff --git a/test/testapps/BasicTestApp/RouterTest/Links.cshtml b/test/testapps/BasicTestApp/RouterTest/Links.cshtml index 70efead6a4a..e7bbca5d120 100644 --- a/test/testapps/BasicTestApp/RouterTest/Links.cshtml +++ b/test/testapps/BasicTestApp/RouterTest/Links.cshtml @@ -3,6 +3,7 @@ <li><a href="/subdir/RouterTest/?abc=123">Default with query</a></li> <li><a href="/subdir/RouterTest/#blah">Default with hash</a></li> <li><a href="/subdir/RouterTest/Other">Other</a></li> + <li><a href="RouterTest/Other">Other with base-relative URL</a></li> <li><a href="/subdir/RouterTest/Other?abc=123">Other with query</a></li> <li><a href="/subdir/RouterTest/Other#blah">Other with hash</a></li> </ul> -- GitLab