Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ function enhancedNavigationIsEnabledForForm(form: HTMLFormElement): boolean {
function retryEnhancedNavAsFullPageLoad(internalDestinationHref: string) {
// The ? trick here is the same workaround as described in #10839, and without it, the user
// would not be able to use the back button afterwards.
console.warn(`Enhanced navigation failed for destination ${internalDestinationHref}. Falling back to full page load.`);
history.replaceState(null, '', internalDestinationHref + '?');
location.replace(internalDestinationHref);
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public void CanNavigateToNonHtmlResponse()
Navigate($"{ServerPathBase}/nav");
Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-HTML page")).Click();
Browser.Equal("Hello, this is plain text", () => Browser.Exists(By.TagName("html")).Text);

//Check if the fall back because of the non-html response sends a warning
var logs = Browser.GetBrowserLogs(LogLevel.Warning);
Assert.Contains(logs, log => log.Message.Contains("Enhanced navigation failed for destination") && log.Message.Contains("Falling back to full page load.") && !log.Message.Contains("Error"));
}

[Fact]
Expand Down Expand Up @@ -465,6 +469,11 @@ public void EnhancedNavNotUsedForNonBlazorDestinations()
Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-Blazor HTML page")).Click();
Browser.Equal("This is a non-Blazor endpoint", () => Browser.Exists(By.TagName("h1")).Text);
Assert.Equal("undefined", Browser.ExecuteJavaScript<string>("return typeof Blazor")); // Blazor JS is NOT loaded

//Check if the fall back because of the non-blazor endpoint navigation sends a warning
var logs = Browser.GetBrowserLogs(LogLevel.Warning);
Assert.Contains(logs, log => log.Message.Contains("Enhanced navigation failed for destination") && log.Message.Contains("Falling back to full page load.") && !log.Message.Contains("Error"));

}

[Theory]
Expand Down
Loading