Closed vadimdemedes closed 7 years ago
In case of AVA tests, iphone-inline-video
can't be loaded at all, because AVA requires dependencies upfront, before executing test file. As a result, we don't have a chance to even set up jsdom
before iphone-inline-video
is loaded.
It can be done. I already had some Ava tests and this is how I was applying JSdom https://github.com/bfred-it/iphone-inline-video/blob/tests-test/test/helpers/setup-browser-env.js
Yes, but it's more of a workaround than a a fix for the underlying issue. This change isn't breaking, I think, so there shouldn't be any surprises.
Have you tested this change? I don't think it's enough to make it work in node.
I'm not entirely convinced that this code belongs to the client library itself either. Are you going to send PRs to each and every client-only library that uses the DOM?
Have you tested this change? I don't think it's enough to make it work in node.
Yes, I did.
Are you going to send PRs to each and every client-only library that uses the DOM?
No, only the ones I use and highly depend on.
Cool, for a moment I thought it would fail on matchMedia
as well.
Ok the change is small enough. I'd love to know if there are alternative solutions eventually (i.e. have a client-only build)
2.0.2
is out! Thanks :)
Great, thanks!
Hey, thanks for the great lib, very useful!
This PR adds a tiny fix when checking for iOS 8 or 9. By checking if
document
exists at all, it allows loadingiphone-inline-video
in tests (Node.js) without setting upjsdom
.Avoids this: