-
-
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.
* feat: Added navigation interception * Use parameter instead of field Co-authored-by: Egil Hansen <egil@assimilated.dk> * Remove whitespace Co-authored-by: Egil Hansen <egil@assimilated.dk> * fix: use static import to remove noise * feat: Added exception handling for NavigationLock * fix: remove obsolete property for test * add: Changelog entry * add: Documentation for NavigationLock * refactor: Renamed Failed to Faulted for state * fix: small tweaks to code docs and names * fix: spelling * remve lutconfig Co-authored-by: Egil Hansen <egil@assimilated.dk>
- Loading branch information
1 parent
586bd91
commit 2931a45
Showing
9 changed files
with
452 additions
and
120 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
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
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
14 changes: 14 additions & 0 deletions
14
...vocationHandlers/Implementation/NavigationLockDisableNavigationPromptInvocationHandler.cs
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,14 @@ | ||
#if NET7_0_OR_GREATER | ||
namespace Bunit.JSInterop.InvocationHandlers.Implementation; | ||
|
||
internal sealed class NavigationLockDisableNavigationPromptInvocationHandler : JSRuntimeInvocationHandler | ||
{ | ||
private const string Identifier = "Blazor._internal.NavigationLock.disableNavigationPrompt"; | ||
|
||
internal NavigationLockDisableNavigationPromptInvocationHandler() | ||
: base(inv => inv.Identifier.Equals(Identifier, StringComparison.Ordinal), isCatchAllHandler: true) | ||
{ | ||
SetVoidResult(); | ||
} | ||
} | ||
#endif |
14 changes: 14 additions & 0 deletions
14
...nvocationHandlers/Implementation/NavigationLockEnableNavigationPromptInvocationHandler.cs
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,14 @@ | ||
#if NET7_0_OR_GREATER | ||
namespace Bunit.JSInterop.InvocationHandlers.Implementation; | ||
|
||
internal sealed class NavigationLockEnableNavigationPromptInvocationHandler : JSRuntimeInvocationHandler | ||
{ | ||
private const string Identifier = "Blazor._internal.NavigationLock.enableNavigationPrompt"; | ||
|
||
internal NavigationLockEnableNavigationPromptInvocationHandler() | ||
: base(inv => inv.Identifier.Equals(Identifier, StringComparison.Ordinal), isCatchAllHandler: true) | ||
{ | ||
SetVoidResult(); | ||
} | ||
} | ||
#endif |
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
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
24 changes: 24 additions & 0 deletions
24
src/bunit.web/TestDoubles/NavigationManager/NavigationState.cs
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,24 @@ | ||
#if NET7_0_OR_GREATER | ||
namespace Bunit.TestDoubles; | ||
|
||
/// <summary> | ||
/// Describes the possible enumerations when a navigation gets intercepted. | ||
/// </summary> | ||
public enum NavigationState | ||
{ | ||
/// <summary> | ||
/// The navigation was successfully executed. | ||
/// </summary> | ||
Succeeded, | ||
|
||
/// <summary> | ||
/// The navigation was prevented. | ||
/// </summary> | ||
Prevented, | ||
|
||
/// <summary> | ||
/// The OnBeforeInternalNavigation event handler threw an exception and the navigation did not complete. | ||
/// </summary> | ||
Faulted | ||
} | ||
#endif |
Oops, something went wrong.