With the recent merge of this PR: dotnet/aspnetcore#42638 (here the issue which tracks the topic: dotnet/aspnetcore#42877) users can intercept the NavigationManager and prevent redirects. To make it work we have to add some logic in the NavigateToCore function.
Here is an inspiration how it is done in the PR for the RemoteNavigationManager: https://github.com/dotnet/aspnetcore/blob/d1558107b97d2471e9a0aa5d008b511ead908fa7/src/Components/Server/src/Circuits/RemoteNavigationManager.cs#L84
Goal
The user should have means to simulate the cancellation behaviour in a bUnit test. That said if he has a NavigationLock component which would prevent the navigation, we should have the same behaviour in bUnit. That includes also no new item on the NavigationHistory stack. No change of BaseUri or Uri.
Analysis
I tried to use the feature as it is already merged to main, but unfortunately the nightly builds don't include this function at the moment.
With the recent merge of this PR: dotnet/aspnetcore#42638 (here the issue which tracks the topic: dotnet/aspnetcore#42877) users can intercept the
NavigationManagerand prevent redirects. To make it work we have to add some logic in theNavigateToCorefunction.Here is an inspiration how it is done in the PR for the
RemoteNavigationManager: https://github.com/dotnet/aspnetcore/blob/d1558107b97d2471e9a0aa5d008b511ead908fa7/src/Components/Server/src/Circuits/RemoteNavigationManager.cs#L84Goal
The user should have means to simulate the cancellation behaviour in a bUnit test. That said if he has a
NavigationLockcomponent which would prevent the navigation, we should have the same behaviour in bUnit. That includes also no new item on theNavigationHistorystack. No change ofBaseUriorUri.Analysis
I tried to use the feature as it is already merged to main, but unfortunately the nightly builds don't include this function at the moment.