Skip to content

Commit

Permalink
test: add test for Map as eval argument (#1457)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Mar 21, 2020
1 parent 34cc358 commit 60a248e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/evaluation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 60a248e

Please sign in to comment.