Skip to content

Commit

Permalink
test: add test that verifies pptr works with SVG nodes (#2805)
Browse files Browse the repository at this point in the history
References #1247
  • Loading branch information
aslushnikov committed Jun 27, 2018
1 parent f55d005 commit d6741ec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/elementhandle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ module.exports.addTests = function({testRunner, expect}) {
const box = await elementHandle.boundingBox();
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() {
Expand Down

0 comments on commit d6741ec

Please sign in to comment.