mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: add test that verifies pptr works with SVG nodes (#2805)
References #1247
This commit is contained in:
parent
f55d005cbe
commit
d6741eca08
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user