mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: toJSON property for Arrays after evaluation in FF (#7016)
This commit is contained in:
parent
13b6d0153d
commit
5157f74bcc
@ -548,7 +548,7 @@ it('should not use toJSON when evaluating', async ({ page }) => {
|
|||||||
expect(result).toEqual({ data: 'data', toJSON: {} });
|
expect(result).toEqual({ data: 'data', toJSON: {} });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not use Array.prototype.toJSON when evaluating', async ({ page, browserName }) => {
|
it('should not use Array.prototype.toJSON when evaluating', async ({ page }) => {
|
||||||
const result = await page.evaluate(() => {
|
const result = await page.evaluate(() => {
|
||||||
(Array.prototype as any).toJSON = () => 'busted';
|
(Array.prototype as any).toJSON = () => 'busted';
|
||||||
return [1, 2, 3];
|
return [1, 2, 3];
|
||||||
@ -556,6 +556,13 @@ it('should not use Array.prototype.toJSON when evaluating', async ({ page, brows
|
|||||||
expect(result).toEqual([1,2,3]);
|
expect(result).toEqual([1,2,3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not add a toJSON property to newly created Arrays after evaluation', async ({ page, browserName }) => {
|
||||||
|
it.fixme(browserName === 'firefox')
|
||||||
|
await page.evaluate(() => []);
|
||||||
|
const hasToJSONProperty = await page.evaluate(() => "toJSON" in []);
|
||||||
|
expect(hasToJSONProperty).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not use toJSON in jsonValue', async ({ page }) => {
|
it('should not use toJSON in jsonValue', async ({ page }) => {
|
||||||
const resultHandle = await page.evaluateHandle(() => ({ toJSON: () => 'string', data: 'data' }));
|
const resultHandle = await page.evaluateHandle(() => ({ toJSON: () => 'string', data: 'data' }));
|
||||||
expect(await resultHandle.jsonValue()).toEqual({ data: 'data', toJSON: {} });
|
expect(await resultHandle.jsonValue()).toEqual({ data: 'data', toJSON: {} });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user