Skip to content

Commit f092f96

Browse files
chore(prettier): 🤖 ✨
1 parent 77ae1e8 commit f092f96

File tree

2 files changed

+62
-33
lines changed

2 files changed

+62
-33
lines changed

‎integration/viewport-100-percent.test.js

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
88
const actual = await page.evaluate(() => {
99
window.scrollTo(0, 0)
1010
return window
11-
.computeScrollIntoView(document.querySelector('.vertical-scroll .target'), {
12-
scrollMode: 'if-needed',
13-
})
11+
.computeScrollIntoView(
12+
document.querySelector('.vertical-scroll .target'),
13+
{
14+
scrollMode: 'if-needed',
15+
}
16+
)
1417
.map(window.mapActions)
1518
})
1619
expect(actual).toHaveLength(1)
@@ -21,9 +24,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
2124
const actual = await page.evaluate(() => {
2225
window.scrollTo(0, 50)
2326
return window
24-
.computeScrollIntoView(document.querySelector('.vertical-scroll .target'), {
25-
scrollMode: 'if-needed',
26-
})
27+
.computeScrollIntoView(
28+
document.querySelector('.vertical-scroll .target'),
29+
{
30+
scrollMode: 'if-needed',
31+
}
32+
)
2733
.map(window.mapActions)
2834
})
2935
expect(actual).toHaveLength(1)
@@ -32,11 +38,14 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
3238

3339
test('completely in view', async () => {
3440
const actual = await page.evaluate(() => {
35-
window.scrollTo(0, window.innerHeight / 2);
41+
window.scrollTo(0, window.innerHeight / 2)
3642
return window
37-
.computeScrollIntoView(document.querySelector('.vertical-scroll .target'), {
38-
scrollMode: 'if-needed',
39-
})
43+
.computeScrollIntoView(
44+
document.querySelector('.vertical-scroll .target'),
45+
{
46+
scrollMode: 'if-needed',
47+
}
48+
)
4049
.map(window.mapActions)
4150
})
4251
expect(actual).toHaveLength(0)
@@ -47,9 +56,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
4756
const actual = await page.evaluate(() => {
4857
window.scrollTo(0, window.innerHeight + 50)
4958
return window
50-
.computeScrollIntoView(document.querySelector('.vertical-scroll .target'), {
51-
scrollMode: 'if-needed',
52-
})
59+
.computeScrollIntoView(
60+
document.querySelector('.vertical-scroll .target'),
61+
{
62+
scrollMode: 'if-needed',
63+
}
64+
)
5365
.map(window.mapActions)
5466
})
5567
expect(actual).toHaveLength(1)
@@ -60,9 +72,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
6072
const actual = await page.evaluate(() => {
6173
window.scrollTo(0, window.innerHeight + 100)
6274
return window
63-
.computeScrollIntoView(document.querySelector('.vertical-scroll .target'), {
64-
scrollMode: 'if-needed',
65-
})
75+
.computeScrollIntoView(
76+
document.querySelector('.vertical-scroll .target'),
77+
{
78+
scrollMode: 'if-needed',
79+
}
80+
)
6681
.map(window.mapActions)
6782
})
6883
expect(actual).toHaveLength(1)
@@ -75,9 +90,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
7590
const actual = await page.evaluate(() => {
7691
window.scrollTo(0, 0)
7792
return window
78-
.computeScrollIntoView(document.querySelector('.horizontal-scroll .target'), {
79-
scrollMode: 'if-needed',
80-
})
93+
.computeScrollIntoView(
94+
document.querySelector('.horizontal-scroll .target'),
95+
{
96+
scrollMode: 'if-needed',
97+
}
98+
)
8199
.map(window.mapActions)
82100
})
83101
expect(actual).toHaveLength(1)
@@ -88,9 +106,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
88106
const actual = await page.evaluate(() => {
89107
window.scrollTo(50, 0)
90108
return window
91-
.computeScrollIntoView(document.querySelector('.horizontal-scroll .target'), {
92-
scrollMode: 'if-needed',
93-
})
109+
.computeScrollIntoView(
110+
document.querySelector('.horizontal-scroll .target'),
111+
{
112+
scrollMode: 'if-needed',
113+
}
114+
)
94115
.map(window.mapActions)
95116
})
96117
expect(actual).toHaveLength(1)
@@ -99,11 +120,14 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
99120

100121
test('completely in view', async () => {
101122
const actual = await page.evaluate(() => {
102-
window.scrollTo(window.innerWidth / 2, 0);
123+
window.scrollTo(window.innerWidth / 2, 0)
103124
return window
104-
.computeScrollIntoView(document.querySelector('.horizontal-scroll .target'), {
105-
scrollMode: 'if-needed',
106-
})
125+
.computeScrollIntoView(
126+
document.querySelector('.horizontal-scroll .target'),
127+
{
128+
scrollMode: 'if-needed',
129+
}
130+
)
107131
.map(window.mapActions)
108132
})
109133
expect(actual).toHaveLength(0)
@@ -114,9 +138,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
114138
const actual = await page.evaluate(() => {
115139
window.scrollTo(window.innerWidth + 50, 0)
116140
return window
117-
.computeScrollIntoView(document.querySelector('.horizontal-scroll .target'), {
118-
scrollMode: 'if-needed',
119-
})
141+
.computeScrollIntoView(
142+
document.querySelector('.horizontal-scroll .target'),
143+
{
144+
scrollMode: 'if-needed',
145+
}
146+
)
120147
.map(window.mapActions)
121148
})
122149
expect(actual).toHaveLength(1)
@@ -127,9 +154,12 @@ describe('scrollMode: if-needed (outside the scrollingElement bounding box)', ()
127154
const actual = await page.evaluate(() => {
128155
window.scrollTo(window.innerWidth + 100, 0)
129156
return window
130-
.computeScrollIntoView(document.querySelector('.horizontal-scroll .target'), {
131-
scrollMode: 'if-needed',
132-
})
157+
.computeScrollIntoView(
158+
document.querySelector('.horizontal-scroll .target'),
159+
{
160+
scrollMode: 'if-needed',
161+
}
162+
)
133163
.map(window.mapActions)
134164
})
135165
expect(actual).toHaveLength(1)

‎src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ export const compute = (target: Element, options: Options): ScrollAction[] => {
392392
targetLeft >= 0 &&
393393
targetBottom <= viewportHeight &&
394394
targetRight <= viewportWidth &&
395-
396395
// scrollingElement is added to the frames array even if it's not scrollable, in which case checking its bounds is not required
397396
((frame === scrollingElement && !isScrollable(frame)) ||
398397
(targetTop >= top &&

0 commit comments

Comments
 (0)