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

Default window.innerWidth to 1024 #673

Closed
kalvenschraut opened this issue Dec 7, 2022 · 1 comment · Fixed by #674
Closed

Default window.innerWidth to 1024 #673

kalvenschraut opened this issue Dec 7, 2022 · 1 comment · Fixed by #674
Assignees
Labels
enhancement New feature or request

Comments

@kalvenschraut
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I put off updating for a bit because my tests where broken on anything after 7.0.0. After digging into it I realized it was due to some rendering differences. Tests were expecting desktop HTML output while mobile was being outputted . Then after further investigation I realized that window.innerWidth was set to 0 and that was what was causing the issue.

I found the your notes about setting the innerWidth via window.happyDOM.setInnerWidth() which I am now forced to call in my setup file.

Describe the solution you'd like
I would like to see innerWidth by default set to 1024. Window.screen has width at 1024 currently, so I think it makes sense to match that. If people want to work on a different screen size they could still set it manually.

Describe alternatives you've considered
I would really consider any other screen size that is within the "desktop" size.

@kalvenschraut kalvenschraut added the enhancement New feature or request label Dec 7, 2022
@capricorn86
Copy link
Owner

capricorn86 commented Dec 7, 2022

Hi @kalvenschraut! 🙂

I have looked into it and I agree with you. It was a mistake to set it to "0" by default.

It seems like JSDOM are setting the resolution to 1024x768 and it makes sense to use the same value in case an app changes between the libraries, but also to be compatible with older versions of Happy DOM.

Too bad that it will become a major release.

@capricorn86 capricorn86 self-assigned this Dec 7, 2022
capricorn86 added a commit that referenced this issue Dec 7, 2022
capricorn86 added a commit that referenced this issue Dec 7, 2022
…width-to-1024

#673@major: Changes the default value for window.innerWidth to 1024 a…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants