From 47d1ffce052c60a5c3068225f897bb4b6f511947 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 27 Sep 2019 11:49:48 +0100 Subject: [PATCH] E2E scenario code for preventDefault+navigation --- .../BasicTestApp/RouterTest/Links.razor | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor index b2addca14b..5851ae068c 100644 --- a/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor +++ b/src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor @@ -39,3 +39,41 @@ Not a component Cannot route to me + +

Interactions with preventDefault

+ +

+ Note that navigation actions are independent of event bubbling. Stopping click event propagation before + it reaches an <a> element does not stop navigation from happening. This is by design, + because the same is true natively in JavaScript. Navigation only responds to preventDefault. +

+ +

+ + External navigation + [Descendant element] + +

+

+ + Internal navigation + [Descendant element] + +

+ +
+ Prevent default on... + + + + + @* So we can assert that navigation didn't happen *@ + +
+ +@code { + bool ancestorPreventDefault; + bool targetPreventDefault; + bool descendantPreventDefault; + int counter; +}