-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test(useIntersectionObserver): Add browser tests for useIntersectionObserver #5136
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
base: main
Are you sure you want to change the base?
test(useIntersectionObserver): Add browser tests for useIntersectionObserver #5136
Conversation
@vueuse/components
@vueuse/core
@vueuse/electron
@vueuse/firebase
@vueuse/integrations
@vueuse/math
@vueuse/metadata
@vueuse/nuxt
@vueuse/router
@vueuse/rxjs
@vueuse/shared
commit: |
OrbisK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR 🙏🏽
I think we only need the browser tests. We should also use rendered Vue components to test more than just the browsers intersection observer.
|
I think the way |
|
btw, I keep seeing the warning in raised in every test, but I have no idea what it is... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5136 +/- ##
==========================================
+ Coverage 63.95% 64.01% +0.06%
==========================================
Files 343 343
Lines 7838 7832 -6
Branches 2424 2406 -18
==========================================
+ Hits 5013 5014 +1
+ Misses 2286 2279 -7
Partials 539 539 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Before submitting the PR, please make sure you do the following
fixes #123).Description
Add the tests for
useIntersectionObserver, and it should be easier for developers to add new features to this composable.Additional context
This PR add both unit test and browser test.
Unit Test
Why does it still have a unit test while JSDom doesn't have
IntersectionObserver? First, it can check ifisSupportedworks. Second, I think Vueuse doesn't need to know ifIntersectionObserverworks correctly; that should be the browser's responsibility. Therefore, verifying the messages sent to theIntersectionObserverfromuseIntersectionObservermakes more sense.Browser Test
Again, while we don't need to check the correctness of the
IntersectionObserver, it should check the reactivity and the exposed properties, which are implemented uniquely byuseIntersectionObserver