Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Try not to clobber formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayphen committed Jul 15, 2020
1 parent 0874397 commit c7f0b56
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions test/apps/scroll/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,37 @@ describe('scroll', function () {
assert.equal(firstScrollY, secondScrollY);
});

it('survives the tests with no server errors', () => {
assert.deepEqual(r.errors, []);
});

it('scrolls to the top when navigating with goto', async () => {
await r.load(`/search-form#search`);
await r.sapper.start();
await r.load(`/search-form#search`);
await r.sapper.start();

let initialScrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(initialScrollY > 0, String(initialScrollY));
let initialScrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(initialScrollY > 0, String(initialScrollY));

await r.page.click("button#scroll");
await r.page.click(`button#scroll`);

let scrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(scrollY === 0, String(scrollY));
let scrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(scrollY === 0, String(scrollY));
});

it('preserves scroll when noscroll: true is passed to goto', async () => {
await r.load(`/search-form#search`);
await r.sapper.start();
await r.load(`/search-form#search`);
await r.sapper.start();

let initialScrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(initialScrollY > 0, String(initialScrollY));
let initialScrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(initialScrollY > 0, String(initialScrollY));

await r.page.click("button#preserve");
await r.page.click(`button#preserve`);

let scrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(scrollY === initialScrollY, String(scrollY));
let scrollY = await r.page.evaluate(() => window.scrollY);
assert.ok(scrollY === initialScrollY, String(scrollY));
});

it('survives the tests with no server errors', () => {
assert.deepEqual(r.errors, []);
assert.deepEqual(r.errors, []);
});
});
});

0 comments on commit c7f0b56

Please sign in to comment.