Skip to content

Commit a60b20f

Browse files
authored
chore: serialize None into null instead of undefined (microsoft#694)
1 parent 1066887 commit a60b20f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

playwright/_impl/_js_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def serialize_value(value: Any, handles: List[JSHandle], depth: int) -> Any:
9898
if depth > 100:
9999
raise Error("Maximum argument depth exceeded")
100100
if value is None:
101-
return dict(v="undefined")
101+
return dict(v="null")
102102
if isinstance(value, float):
103103
if value == float("inf"):
104104
return dict(v="Infinity")

tests/async/test_evaluate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async def test_evaluate_return_complex_objects(page):
142142

143143
async def test_evaluate_accept_none_as_one_of_multiple_parameters(page):
144144
result = await page.evaluate(
145-
'({ a, b }) => Object.is(a, undefined) && Object.is(b, "foo")',
145+
'({ a, b }) => Object.is(a, null) && Object.is(b, "foo")',
146146
{"a": None, "b": "foo"},
147147
)
148148
assert result

0 commit comments

Comments
 (0)