-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
document URL parsing #1693
Comments
I was digging and I think that there's no bug about parsing the URL as soon as the jsdom envionment is properly setup1. As I am using jest, one possibility is setting the URL on Does jsdom's Regards, |
I'd suggest using the Jest API, since that ensures it's consistently set up the right way from the beginning. But there's also https://github.com/tmpvar/jsdom#changing-the-url-of-an-existing-jsdom-window-instance |
Hi @domenic, On my use case I need to change the URL per I think we can improve jest+jsdom exposing the jsdom instance on global scope so that the |
We don't add nonstandard properties like changeURL to standard objects like window.location. |
I understand but |
No, you can't; window.location's setter performs a navigation, which is an entirely separate piece of functionality which jsdom does not yet support (and would require a lot of work to add). |
I do not agree that they are "an entirely separate piece of functionality" as when implementing the navigation part you will have to set the URL. I would say that right now it would be quite easy to make a partial implementation, just adding a setter with What do you think? I am checking with the jest guys whether or not the jsdom instance should be exposed on the global scope/environment (issue). |
No, we don't have any intention of implementing a fake navigation that only changes the URL. The most important parts of navigation are things like replacing every object (Window, Document, etc.) and until we can implement that, it's better to just output a not-implemented warning. In the end it sounds like you have a problem not with jsdom, but with jest. jsdom already has a solution to your problem, with jsdom.changeURL. So I am going to close this issue. |
Hi,
I did notice a miss behavior on URL parsing when using Jest (closed issue) which should be bug in or missing feature of jsdom.
I would be glad to help you further but I will need some, perhaps, some guidance.
From the issue I did open for Jest
What is the current behavior?
This is the Firefox and Google Chrome behavior when the source code runs on a page whose document.location is
about:blank
what is not expected as thewindow.location.href
property is defined by (Issue#890)If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.What is the expected behavior?
This is the Firefox and Google Chrome behavior when the source code run on a page whose document.location is other than
about:blank
.This happened with jsdom v9.8.3 (as a Jest dependency).
Regards,
Paulo
The text was updated successfully, but these errors were encountered: