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

Jsdom inconsistencies for 0px in matchInilneSnapshot #922

Closed
belgattitude opened this issue May 14, 2023 · 6 comments
Closed

Jsdom inconsistencies for 0px in matchInilneSnapshot #922

belgattitude opened this issue May 14, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@belgattitude
Copy link

belgattitude commented May 14, 2023

Describe the bug

While experimenting a move from jsdom to happy-dom, I stumbled on a different way to express style in jsdom/happy-dom.

image

To Reproduce

Don't know if it helps enough but you'll find info here: strapi/strapi#16713 (comment)

Example test: https://github.com/strapi/strapi/blob/main/packages/core/admin/admin/src/pages/NotFoundPage/tests/index.test.js#L27

Expected behavior

I'm not sure if it should be changed in happy-dom, but for users migrating from jsdom it can certainly help.

Additional context
Add any other context about the problem here.

@capricorn86
Copy link
Owner

Thank you for reporting @belgattitude! 🙂

Happy DOM aims to work according to spec and behave like a browser as much as possible. Happy DOM behaves according to spec here while JSDOM doesn't.

You can easily test it in dev tools in the browser:

var element = document.createElement('div');
element.style.height = '0';

// Outputs: '<div style="height: 0px;"></div>'
console.log(element.outerHTML);

@capricorn86
Copy link
Owner

I will close this issue as it is working as intended.

@capricorn86
Copy link
Owner

Sorry @belgattitude. I think I was a bit to fast closing this one. Read the snapshot the other way around. I have re-opened it.

@belgattitude
Copy link
Author

Fantastic, thank you

@capricorn86
Copy link
Owner

capricorn86 commented May 18, 2023

@belgattitude this has been fixed now.

"height" was missed somehow as Happy DOM has support for "width". That is why I felt pretty sure that it was already covered 😆

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v9.19.0

@belgattitude
Copy link
Author

Thank you so much @capricorn86 ... I'll test this out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants