test: add test that verifies pptr works with SVG nodes (#2805)

References #1247
This commit is contained in:
Andrey Lushnikov 2018-06-26 18:03:00 -07:00 committed by GitHub
parent f55d005cbe
commit d6741eca08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,20 @@ module.exports.addTests = function({testRunner, expect}) {
const box = await elementHandle.boundingBox(); const box = await elementHandle.boundingBox();
expect(box).toEqual({ x: 8, y: 8, width: 100, height: 200 }); expect(box).toEqual({ x: 8, y: 8, width: 100, height: 200 });
}); });
xit('should work with SVG nodes', async({page, server}) => {
await page.setContent(`
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
<rect id="theRect" x="30" y="50" width="200" height="300"></rect>
</svg>
`);
const element = await page.$('#therect');
const pptrBoundingBox = await element.boundingBox();
const webBoundingBox = await page.evaluate(e => {
const rect = e.getBoundingClientRect();
return {x: rect.x, y: rect.y, width: rect.width, height: rect.height};
}, element);
expect(pptrBoundingBox).toEqual(webBoundingBox);
});
}); });
describe('ElementHandle.boxModel', function() { describe('ElementHandle.boxModel', function() {