test: add test for Map as eval argument (#1457)

This commit is contained in:
Dmitry Gozman 2020-03-20 21:24:34 -07:00 committed by GitHub
parent 34cc358ad3
commit 60a248ef42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,10 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
const result = await page.evaluate(a => Array.isArray(a), [1, 2, 3]);
expect(result).toBe(true);
});
it('should transfer maps as empty objects', async({page, server}) => {
const result = await page.evaluate(a => a.x.constructor.name + ' ' + JSON.stringify(a.x), {x: new Map([[1, 2]])});
expect(result).toBe('Object {}');
});
it('should modify global environment', async({page}) => {
await page.evaluate(() => window.globalVar = 123);
expect(await page.evaluate('globalVar')).toBe(123);