You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -109,17 +117,40 @@ it('loads the image when the component is in the viewport', () => {
109
117
110
118
`mockIntersectionObserver` returns an object, that has several useful methods:
111
119
112
-
#### .enterNode(node, desc) and .leaveNode(node, desc)
120
+
#### .enterNode(node, desc)
121
+
122
+
Triggers all IntersectionObservers observing the `node`, with `isIntersected` set to `true` and `intersectionRatio` set to `1`. Other `IntersectionObserverEntry` params can be passed as `desc` argument, you can override any parameter except `isIntersected`
123
+
124
+
#### .leaveNode(node, desc)
125
+
126
+
Triggers all IntersectionObservers observing the `node`, with `isIntersected` set to `false` and `intersectionRatio` set to `0`. Other `IntersectionObserverEntry` params can be passed as `desc` argument, you can override any parameter except `isIntersected`
127
+
128
+
#### .enterNodes(nodeDescriptions)
129
+
130
+
Triggers all IntersectionObservers observing the nodes in `nodeDescriptions` with multiple nodes entering at once. Each IntersectionObserver callback will receive only the nodes it's observing:
131
+
132
+
```js
133
+
io.enterNodes([
134
+
// you can pass multiple nodes each with its own state
Triggers all IntersectionObservers observing the nodes in `nodeDescriptions` with multiple nodes leaving at once. Each IntersectionObserver callback will receive only the nodes it's observing.
146
+
147
+
#### .triggerNodes(nodeDescriptions)
113
148
114
-
Triggers the intersection observer callback with only one node
115
-
and `isIntersected` set to `true` (for `enterNode`) or `false` (for `leaveNode`).
116
-
Other `IntersectionObserverEntry` params can be passed as `desc` argument
149
+
Triggers all IntersectionObservers observing the nodes in `nodeDescriptions` with multiple nodes at once with custom descriptions (`isIntersected` is not enforced). Each IntersectionObserver callback will receive only the nodes it's observing
117
150
118
151
#### .enterAll(desc) and .leaveAll(desc)
119
152
120
-
Triggers the intersection observer callback for all of the observed nodes
121
-
and `isIntersected` set to `true` (for `enterAll`) or `false` (for `leaveAll`).
122
-
Other `IntersectionObserverEntry` params can be passed as `desc` argument
153
+
Triggers all IntersectionObservers for each of the observed nodes
0 commit comments