-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests for
set-property
command
- Loading branch information
1 parent
087edf0
commit 33324c5
Showing
17 changed files
with
228 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error = """type \"object-path\" (`\"b\".\"a\"`) as key is not allowed in this JSON dict, allowed types are: [`string`] (second element of the tuple)""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error = """type \"object-path\" (`\"b\".\"a\"`) as key is not allowed in this JSON dict, allowed types are: [`string`] (second element of the tuple)""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error = """type \"object-path\" (`\"b\".\"a\"`) as key is not allowed in this JSON dict, allowed types are: [`string`] (second element of the tuple)""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error = """type \"object-path\" (`\"b\".\"a\"`) as key is not allowed in this JSON dict, allowed types are: [`string`] (second element of the tuple)""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
instructions = [ | ||
"""let parseSetPropertyElem = await page.$(\"a\"); | ||
if (parseSetPropertyElem === null) { throw '\"a\" not found'; } | ||
await page.evaluate(e => { | ||
function setObjValue(object, path, value) { | ||
for (let i = 0; i < path.length - 1; ++i) { | ||
const subPath = path[i]; | ||
if (object[subPath] === undefined || object[subPath] === null) { | ||
if (value === undefined) { | ||
return; | ||
} | ||
object[subPath] = {}; | ||
} | ||
object = object[subPath]; | ||
} | ||
if (value === undefined) { | ||
delete object[path[path.length - 1]]; | ||
} else { | ||
object[path[path.length - 1]] = value; | ||
} | ||
} | ||
setObjValue(e, [\"b\",\"a\"], \"c\"); | ||
}, parseSetPropertyElem);""", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
instructions = [ | ||
"""let parseSetPropertyElem = await page.$(\"a\"); | ||
if (parseSetPropertyElem === null) { throw '\"a\" not found'; } | ||
await page.evaluate(e => { | ||
function setObjValue(object, path, value) { | ||
for (let i = 0; i < path.length - 1; ++i) { | ||
const subPath = path[i]; | ||
if (object[subPath] === undefined || object[subPath] === null) { | ||
if (value === undefined) { | ||
return; | ||
} | ||
object[subPath] = {}; | ||
} | ||
object = object[subPath]; | ||
} | ||
if (value === undefined) { | ||
delete object[path[path.length - 1]]; | ||
} else { | ||
object[path[path.length - 1]] = value; | ||
} | ||
} | ||
setObjValue(e, [\"b\",\"a\"], \"c\"); | ||
setObjValue(e, [\"d\"], \"x\"); | ||
}, parseSetPropertyElem);""", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters