Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Error: Not implemented: navigation (except hash changes)" during tests #3980

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

bjoernricks
Copy link
Contributor

What

Fix "Error: Not implemented: navigation (except hash changes)" during tests

Why

JSDOM doesn't implement the navigation API and therefore raises an error in the console if window.location is used and anchors are clicked. As we are using a lot of anchors in our pages this error is raised often during test runs. By mocking the HTMLAnchorElement click handler the console error is silenced.

@bjoernricks bjoernricks requested a review from a team as a code owner March 28, 2024 12:30
Copy link

Conventional Commits Report

😢 No conventional commits found.

👉 Learn more about the conventional commits usage at Greenbone.

@bjoernricks bjoernricks force-pushed the fix-navigation-error-during-tests branch from 8b869e0 to 70c9825 Compare March 28, 2024 12:32
@bjoernricks bjoernricks enabled auto-merge (rebase) March 28, 2024 12:32
… tests

JSDOM doesn't implement the navigation API and therefore raises an error
in the console if `window.location` is used and anchors are clicked. As
we are using a lot of anchors in our pages this error is raised often
during test runs. By mocking the HTMLAnchorElement click handler the
console error is silenced.
@bjoernricks bjoernricks force-pushed the fix-navigation-error-during-tests branch from 70c9825 to c602bc2 Compare March 28, 2024 12:40
Copy link
Member

@jhelmold jhelmold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@bjoernricks bjoernricks merged commit c1e3757 into main Mar 28, 2024
11 checks passed
@bjoernricks bjoernricks deleted the fix-navigation-error-during-tests branch March 28, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants