We've got some code in use in tests that worked in jsdom 7 but appears not to work in jsdom 8.
Our JSDom setup:
const doc = jsdom.jsdom('<html><body></body></html>', {
referrer: 'https://example.com/baz',
url: 'https://example.com/foo'
});
global.document = doc;
global.window = doc.defaultView;
And the test itself:
window.location.href = 'https://newurl.com/foo';
// some assertions that depend on window.location
Adding some logging immediately after setting window.location.href shows that the value wasn't actually updated or changed, and other means overriding (e.g. stubbing with sinon) don't seem to work either since it's implemented via getters/setters rather than an actual property. What's the best way to override this value?
It looks like setting is supposed to do something based on https://github.com/tmpvar/jsdom/blob/master/lib/jsdom/living/window/Location-impl.js#L46 but I can't figure out what the final effect of that is supposed to be.
We've got some code in use in tests that worked in jsdom 7 but appears not to work in jsdom 8.
Our JSDom setup:
And the test itself:
Adding some logging immediately after setting
window.location.hrefshows that the value wasn't actually updated or changed, and other means overriding (e.g. stubbing withsinon) don't seem to work either since it's implemented via getters/setters rather than an actual property. What's the best way to override this value?It looks like setting is supposed to do something based on https://github.com/tmpvar/jsdom/blob/master/lib/jsdom/living/window/Location-impl.js#L46 but I can't figure out what the final effect of that is supposed to be.