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: fix encoding/matching issues with special chars #9477

Merged
merged 3 commits into from Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -12,6 +12,7 @@ import {
describe("navigate with params", () => {
let node: HTMLDivElement;
beforeEach(() => {
global.history.pushState({}, "", "/");
node = document.createElement("div");
document.body.appendChild(node);
});
Expand Down Expand Up @@ -88,7 +89,8 @@ describe("navigate with params", () => {
let pathname = window.location.pathname.replace(/%20/g, "+");
expect(pathname).toEqual("/blog/react+router");

expect(node.innerHTML).toMatch(/react router/);
// Note decodeURIComponent doesn't decode +
expect(node.innerHTML).toMatch(/react\+router/);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a false positive test previously - and was seemingly only because we weren't resetting history state between tests. decodeURIComponent doesn't decode the + sign

});
});
});