chore: cleanup ElementHandle.isIntersectingViewport (#2874)

This patch:
- simplifies test reusing the `offscreenbuttons.html` asset
- aligns IntersectionObserver usage with the one we have for
  `ElementHandle._scrollIntoViewIfNeeded`.
This commit is contained in:
Andrey Lushnikov
2018-07-11 21:04:36 -07:00
committed by GitHub
parent 12bc1e1a62
commit 254bc80811
4 changed files with 24 additions and 60 deletions

View File

@@ -33,7 +33,7 @@ module.exports.addTests = function({testRunner, expect, DeviceDescriptors}) {
await page.goto(server.PREFIX + '/offscreenbuttons.html');
const messages = [];
page.on('console', msg => messages.push(msg.text()));
for (let i = 0; i < 10; ++i) {
for (let i = 0; i < 11; ++i) {
// We might've scrolled to click a button - reset to (0, 0).
await page.evaluate(() => window.scrollTo(0, 0));
await page.click(`#btn${i}`);
@@ -48,7 +48,8 @@ module.exports.addTests = function({testRunner, expect, DeviceDescriptors}) {
'button #6 clicked',
'button #7 clicked',
'button #8 clicked',
'button #9 clicked'
'button #9 clicked',
'button #10 clicked'
]);
});