Skip to content

Commit

Permalink
test: use function assertion for second scrollY test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 16, 2024
1 parent 3d77e26 commit d981c05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/basic.test.ts
Expand Up @@ -759,16 +759,16 @@ describe('nuxt links', () => {
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/nested/foo/test')

await page.locator('#user-test').scrollIntoViewIfNeeded()
expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(0)
await page.waitForFunction(() => window.scrollY > 0)
await page.locator('#user-test').click()
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/nested/foo/user-test')
expect(await page.evaluate(() => window.scrollY)).toBe(0)
await page.waitForFunction(() => window.scrollY === 0)

await page.locator('#test').scrollIntoViewIfNeeded()
expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(0)
await page.waitForFunction(() => window.scrollY > 0)
await page.locator('#test').click()
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/nested/foo/test')
expect(await page.evaluate(() => window.scrollY)).toBe(0)
await page.waitForFunction(() => window.scrollY === 0)
await page.close()
})
})
Expand Down

0 comments on commit d981c05

Please sign in to comment.