Skip to content

Commit

Permalink
test(no-navigation-without-base): added namespace import tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Nov 29, 2024
1 parent 23e52f0 commit 1b9b252
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- message: Found a goto() call with a url that isn't prefixed with the base path.
line: 4
column: 18
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import * as navigation from '$app/navigation';
navigation.goto('/foo');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- message: Found a pushState() call with a url that isn't prefixed with the base path.
line: 4
column: 23
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import * as navigation from '$app/navigation';
navigation.pushState('/foo');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- message: Found a replaceState() call with a url that isn't prefixed with the
base path.
line: 4
column: 26
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import * as navigation from '$app/navigation';
navigation.replaceState('/foo');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
import * as paths from '$app/paths';
import { goto } from '$app/navigation';
// eslint-disable-next-line prefer-template -- Testing both variants
goto(paths.base + '/foo/');
goto(`${alias}/foo/`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
import * as paths from '$app/paths';
</script>

<a href={paths.base + '/foo/'}>Click me!</a>;
<a href={`${alias}/foo/`}>Click me!</a>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
import * as paths from '$app/paths';
import { pushState } from '$app/navigation';
// eslint-disable-next-line prefer-template -- Testing both variants
pushState(paths.base + '/foo/');
pushState(`${alias}/foo/`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
import * as paths from '$app/paths';
import { replaceState } from '$app/navigation';
// eslint-disable-next-line prefer-template -- Testing both variants
replaceState(paths.base + '/foo/');
replaceState(`${alias}/foo/`);
</script>

0 comments on commit 1b9b252

Please sign in to comment.