Skip to content

Commit

Permalink
Merge pull request #7 from universal-ember/ignore-hash-urls
Browse files Browse the repository at this point in the history
Ignore hash URLs
  • Loading branch information
NullVoxPopuli authored Mar 11, 2024
2 parents 7afeaf2 + b0229b0 commit 90cb426
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test-app/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
{{outlet}}

<a href="/foo">here</a>
<a href="/does-not-exist">here</a>
<a href="/does-not-exist">here</a>
<a href="#title">here</a>
<a href="/#title">/ here</a>
16 changes: 15 additions & 1 deletion test-support/src/routing/visit-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,21 @@ export async function visitAllLinks() {
continue;
}

const key = `${currentURL()}::${toVisit}`;
// In-page links are on the page we're already on.
// As long as we haven't already encountered an error,
// this is silly to check.
if (toVisit.startsWith('#')) {
continue;
}

const [nonHashPart] = toVisit.split('#');

// This was our first page, we've already been here
if (nonHashPart === '/') {
continue;
}

const key = `${currentURL()}::${nonHashPart}`;

if (visited.has(key)) continue;

Expand Down

0 comments on commit 90cb426

Please sign in to comment.