Add a test for LOG_IN_OR_OUT route and add a missing `^`
Release-Notes: skip
Change-Id: I5ecc40ee13dc238c6e80236a52f391c1c746e142
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index 88bacdf..e75bc32 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -118,7 +118,9 @@
// Pattern for login and logout URLs intended to be passed-through. May
// include a return URL.
- LOG_IN_OR_OUT: /\/log(in|out)(\/(.+))?$/,
+ // TODO: Maybe this pattern and its handler can just be removed, because
+ // passing through is what the default router would eventually do anyway.
+ LOG_IN_OR_OUT: /^\/log(in|out)(\/(.+))?$/,
// Pattern for a catchall route when no other pattern is matched.
DEFAULT: /.*/,
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
index e1ba42c..35ce54c 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
@@ -1016,6 +1016,12 @@
});
});
+ test('LOG_IN_OR_OUT pass through', async () => {
+ // LOG_IN_OR_OUT: /^\/log(in|out)(\/(.+))?$/,
+ await checkUrlNotMatched('/login/asdf');
+ await checkUrlNotMatched('/logout/asdf');
+ });
+
test('PLUGIN_SCREEN', async () => {
// PLUGIN_SCREEN: /^\/x\/([\w-]+)\/([\w-]+)\/?/,
await checkUrlToState('/x/foo/bar', {