-
Notifications
You must be signed in to change notification settings - Fork 412
/
scroll_restoration_tests.ts
33 lines (27 loc) · 1.16 KB
/
scroll_restoration_tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { TurboDriveTestCase } from "../helpers/turbo_drive_test_case"
export class ScrollRestorationTests extends TurboDriveTestCase {
async "test landing on an anchor"() {
await this.goToLocation("/src/tests/fixtures/scroll_restoration.html#three")
await this.nextBody
const { y: yAfterLoading } = await this.scrollPosition
this.assert.notEqual(yAfterLoading, 0)
}
async "test reloading after scrolling"() {
await this.goToLocation("/src/tests/fixtures/scroll_restoration.html")
await this.scrollToSelector("#three")
const { y: yAfterScrolling } = await this.scrollPosition
this.assert.notEqual(yAfterScrolling, 0)
await this.reload()
const { y: yAfterReloading } = await this.scrollPosition
this.assert.notEqual(yAfterReloading, 0)
}
async "test returning from history"() {
await this.goToLocation("/src/tests/fixtures/scroll_restoration.html")
await this.scrollToSelector("#three")
await this.goToLocation("/src/tests/fixtures/bare.html")
await this.goBack()
const { y: yAfterReturning } = await this.scrollPosition
this.assert.notEqual(yAfterReturning, 0)
}
}
ScrollRestorationTests.registerSuite()