Skip to content

Commit b99694f

Browse files
chore(prettier): 🤖 ✨
1 parent ecfe9fe commit b99694f

File tree

8 files changed

+225
-200
lines changed

8 files changed

+225
-200
lines changed

‎src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ export interface CustomBehaviorOptions<T = unknown> extends BaseOptions {
4343

4444
/** @public */
4545
export type CustomScrollBehaviorCallback<T = unknown> = (
46-
actions: ScrollAction[]
46+
actions: ScrollAction[],
4747
) => T
4848

4949
const isStandardScrollBehavior = (
50-
options: any
50+
options: any,
5151
): options is StandardBehaviorOptions =>
5252
options === Object(options) && Object.keys(options).length !== 0
5353

5454
const isCustomScrollBehavior = <T = unknown>(
55-
options: any
55+
options: any,
5656
): options is CustomBehaviorOptions<T> =>
5757
typeof options === 'object' ? typeof options.behavior === 'function' : false
5858

@@ -105,7 +105,7 @@ const isInDocument = (element: Node) => {
105105
*/
106106
function scrollIntoView(
107107
target: Element,
108-
options?: StandardBehaviorOptions | boolean
108+
options?: StandardBehaviorOptions | boolean,
109109
): void
110110
/**
111111
* Scrolls the given element into view, with options for when, and how.
@@ -126,11 +126,11 @@ function scrollIntoView(
126126
*/
127127
function scrollIntoView<T>(
128128
target: Element,
129-
options: CustomBehaviorOptions<T>
129+
options: CustomBehaviorOptions<T>,
130130
): T
131131
function scrollIntoView<T = unknown>(
132132
target: Element,
133-
options?: StandardBehaviorOptions | CustomBehaviorOptions<T> | boolean
133+
options?: StandardBehaviorOptions | CustomBehaviorOptions<T> | boolean,
134134
): T | void {
135135
// Browsers treats targets that aren't in the dom as a no-op and so should we
136136
if (!target.isConnected || !isInDocument(target)) {

‎src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export interface CustomScrollAction {
2424
left: number
2525
}
2626
export type CustomScrollBehaviorCallback<T> = (
27-
actions: CustomScrollAction[]
27+
actions: CustomScrollAction[],
2828
) => T

‎tests/web-platform/css/cssom-view/scrollIntoView-shadow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<script src="/node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.js"></script>
33
<script src="/resources/testharness.js"></script>
44
<script src="/resources/testharnessreport.js"></script>

‎tests/web-platform/css/cssom-view/scrollIntoView-smooth.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<script src="/node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.js"></script>
33
<script src="/resources/testharness.js"></script>
44
<script src="/resources/testharnessreport.js"></script>

‎tests/web-platform/css/cssom-view/scrollintoview.html

Lines changed: 85 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<title>CSSOM View - scrollIntoView</title>
33
<meta charset="utf-8" />
44
<meta
@@ -59,81 +59,93 @@
5959
expectedX = _ref[1],
6060
expectedY = _ref[2]
6161

62-
test(function () {
63-
window.scrollTo(0, 0)
64-
testScrollIntoView(input)
65-
var x = expectedX === 'nearest' ? expectedXRight : expectedX
66-
var y = expectedY === 'nearest' ? expectedYBottom : expectedY
67-
assert_approx_equals(
68-
window.scrollX || window.pageXOffset,
69-
x,
70-
0.5,
71-
'scrollX'
72-
)
73-
assert_approx_equals(
74-
window.scrollY || window.pageYOffset,
75-
y,
76-
0.5,
77-
'scrollY'
78-
)
79-
}, 'scrollIntoView(' + format_input(input) + ') starting at left,top')
62+
test(
63+
function () {
64+
window.scrollTo(0, 0)
65+
testScrollIntoView(input)
66+
var x = expectedX === 'nearest' ? expectedXRight : expectedX
67+
var y = expectedY === 'nearest' ? expectedYBottom : expectedY
68+
assert_approx_equals(
69+
window.scrollX || window.pageXOffset,
70+
x,
71+
0.5,
72+
'scrollX',
73+
)
74+
assert_approx_equals(
75+
window.scrollY || window.pageYOffset,
76+
y,
77+
0.5,
78+
'scrollY',
79+
)
80+
},
81+
'scrollIntoView(' + format_input(input) + ') starting at left,top',
82+
)
8083

81-
test(function () {
82-
window.scrollTo(0, 12000)
83-
testScrollIntoView(input)
84-
var x = expectedX === 'nearest' ? expectedXRight : expectedX
85-
var y = expectedY === 'nearest' ? expectedYTop : expectedY
86-
assert_approx_equals(
87-
window.scrollX || window.pageXOffset,
88-
x,
89-
0.5,
90-
'scrollX'
91-
)
92-
assert_approx_equals(
93-
window.scrollY || window.pageYOffset,
94-
y,
95-
0.5,
96-
'scrollY'
97-
)
98-
}, 'scrollIntoView(' + format_input(input) + ') starting at left,bottom')
84+
test(
85+
function () {
86+
window.scrollTo(0, 12000)
87+
testScrollIntoView(input)
88+
var x = expectedX === 'nearest' ? expectedXRight : expectedX
89+
var y = expectedY === 'nearest' ? expectedYTop : expectedY
90+
assert_approx_equals(
91+
window.scrollX || window.pageXOffset,
92+
x,
93+
0.5,
94+
'scrollX',
95+
)
96+
assert_approx_equals(
97+
window.scrollY || window.pageYOffset,
98+
y,
99+
0.5,
100+
'scrollY',
101+
)
102+
},
103+
'scrollIntoView(' + format_input(input) + ') starting at left,bottom',
104+
)
99105

100-
test(function () {
101-
window.scrollTo(12000, 0)
102-
testScrollIntoView(input)
103-
var x = expectedX === 'nearest' ? expectedXLeft : expectedX
104-
var y = expectedY === 'nearest' ? expectedYBottom : expectedY
105-
assert_approx_equals(
106-
window.scrollX || window.pageXOffset,
107-
x,
108-
0.5,
109-
'scrollX'
110-
)
111-
assert_approx_equals(
112-
window.scrollY || window.pageYOffset,
113-
y,
114-
0.5,
115-
'scrollY'
116-
)
117-
}, 'scrollIntoView(' + format_input(input) + ') starting at right,top')
106+
test(
107+
function () {
108+
window.scrollTo(12000, 0)
109+
testScrollIntoView(input)
110+
var x = expectedX === 'nearest' ? expectedXLeft : expectedX
111+
var y = expectedY === 'nearest' ? expectedYBottom : expectedY
112+
assert_approx_equals(
113+
window.scrollX || window.pageXOffset,
114+
x,
115+
0.5,
116+
'scrollX',
117+
)
118+
assert_approx_equals(
119+
window.scrollY || window.pageYOffset,
120+
y,
121+
0.5,
122+
'scrollY',
123+
)
124+
},
125+
'scrollIntoView(' + format_input(input) + ') starting at right,top',
126+
)
118127

119-
test(function () {
120-
window.scrollTo(12000, 12000)
121-
testScrollIntoView(input)
122-
var x = expectedX === 'nearest' ? expectedXLeft : expectedX
123-
var y = expectedY === 'nearest' ? expectedYTop : expectedY
124-
assert_approx_equals(
125-
window.scrollX || window.pageXOffset,
126-
x,
127-
0.5,
128-
'scrollX'
129-
)
130-
assert_approx_equals(
131-
window.scrollY || window.pageYOffset,
132-
y,
133-
0.5,
134-
'scrollY'
135-
)
136-
}, 'scrollIntoView(' + format_input(input) + ') starting at right,bottom')
128+
test(
129+
function () {
130+
window.scrollTo(12000, 12000)
131+
testScrollIntoView(input)
132+
var x = expectedX === 'nearest' ? expectedXLeft : expectedX
133+
var y = expectedY === 'nearest' ? expectedYTop : expectedY
134+
assert_approx_equals(
135+
window.scrollX || window.pageXOffset,
136+
x,
137+
0.5,
138+
'scrollX',
139+
)
140+
assert_approx_equals(
141+
window.scrollY || window.pageYOffset,
142+
y,
143+
0.5,
144+
'scrollY',
145+
)
146+
},
147+
'scrollIntoView(' + format_input(input) + ') starting at right,bottom',
148+
)
137149
})
138150

139151
function testScrollIntoView(input) {

‎tests/web-platform/custom/borders.html

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<title>Border widths</title>
33
<meta charset="utf-8" />
44
<link
@@ -279,42 +279,45 @@
279279
var outer = suite[3][0]
280280
var inner = suite[3][1]
281281

282-
test(function () {
283-
window.scrollTo(0, 0)
284-
outerContainer.scrollTop = 0
285-
outerContainer.scrollLeft = 0
286-
innerContainer.scrollTop = 0
287-
innerContainer.scrollLeft = 0
288-
scrollIntoView(tiles[target], { block: block, inline: inline })
289-
//tiles[target].scrollIntoView({block, inline});
282+
test(
283+
function () {
284+
window.scrollTo(0, 0)
285+
outerContainer.scrollTop = 0
286+
outerContainer.scrollLeft = 0
287+
innerContainer.scrollTop = 0
288+
innerContainer.scrollLeft = 0
289+
scrollIntoView(tiles[target], { block: block, inline: inline })
290+
//tiles[target].scrollIntoView({block, inline});
290291

291-
assert_approx_equals(
292-
outerContainer.scrollLeft,
293-
outer.x,
294-
1,
295-
'outerContainer.scrollLeft'
296-
)
297-
assert_approx_equals(
298-
outerContainer.scrollTop,
299-
outer.y,
300-
1,
301-
'outerContainer.scrollTop'
302-
)
303-
assert_approx_equals(
304-
innerContainer.scrollLeft,
305-
inner.x,
306-
1,
307-
'innerContainer.scrollLeft'
308-
)
309-
assert_approx_equals(
310-
innerContainer.scrollTop,
311-
inner.y,
312-
1,
313-
'innerContainer.scrollTop'
314-
)
315-
}, 'scrollIntoView(' +
316-
JSON.stringify({ block: block, inline: inline }) +
317-
')')
292+
assert_approx_equals(
293+
outerContainer.scrollLeft,
294+
outer.x,
295+
1,
296+
'outerContainer.scrollLeft',
297+
)
298+
assert_approx_equals(
299+
outerContainer.scrollTop,
300+
outer.y,
301+
1,
302+
'outerContainer.scrollTop',
303+
)
304+
assert_approx_equals(
305+
innerContainer.scrollLeft,
306+
inner.x,
307+
1,
308+
'innerContainer.scrollLeft',
309+
)
310+
assert_approx_equals(
311+
innerContainer.scrollTop,
312+
inner.y,
313+
1,
314+
'innerContainer.scrollTop',
315+
)
316+
},
317+
'scrollIntoView(' +
318+
JSON.stringify({ block: block, inline: inline }) +
319+
')',
320+
)
318321
})
319322

320323
document.body.classList.remove('running')

‎tests/web-platform/resources/testharness.css

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
html {
2-
font-family: DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
2+
font-family:
3+
DejaVu Sans,
4+
Bitstream Vera Sans,
5+
Arial,
6+
Sans;
37
}
48

59
#log .warning,
@@ -79,12 +83,18 @@ table#results span {
7983
}
8084

8185
table#results span.expected {
82-
font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
86+
font-family:
87+
DejaVu Sans Mono,
88+
Bitstream Vera Sans Mono,
89+
Monospace;
8390
white-space: pre;
8491
}
8592

8693
table#results span.actual {
87-
font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
94+
font-family:
95+
DejaVu Sans Mono,
96+
Bitstream Vera Sans Mono,
97+
Monospace;
8898
white-space: pre;
8999
}
90100

0 commit comments

Comments
 (0)