mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 11:37:09 +00:00
feat(verifier): decode a container-only scroll
Claude-Session: https://claude.ai/code/session_01A5KmftdEJ49A9z5mF5ESrX
This commit is contained in:
1 parent
73f387f8bd
commit
70573a319e
2 files changed
+8
No files matched your search
@@ -464,6 +464,7 @@ func DecodeAction(raw json.RawMessage) (Action, error) {
|
|||||||
case "Scroll":
|
case "Scroll":
|
||||||
return Action{
|
return Action{
|
||||||
Kind: ActionKindScroll,
|
Kind: ActionKindScroll,
|
||||||
|
On: wire.Selector,
|
||||||
Direction: wire.Direction,
|
Direction: wire.Direction,
|
||||||
FromX: wire.FromX,
|
FromX: wire.FromX,
|
||||||
FromY: wire.FromY,
|
FromY: wire.FromY,
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ func TestDecodeAction_AllKinds(t *testing.T) {
|
|||||||
raw: `{"kind":"Scroll","direction":"down","fromX":1,"fromY":2,"toX":3,"toY":4,"durationMillis":100}`,
|
raw: `{"kind":"Scroll","direction":"down","fromX":1,"fromY":2,"toX":3,"toY":4,"durationMillis":100}`,
|
||||||
want: Action{Kind: ActionKindScroll, Direction: "down", FromX: 1, FromY: 2, ToX: 3, ToY: 4, DurationMillis: 100},
|
want: Action{Kind: ActionKindScroll, Direction: "down", FromX: 1, FromY: 2, ToX: 3, ToY: 4, DurationMillis: 100},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// An author names the container and leaves the drag to the runner,
|
||||||
|
// which needs the selector to size it against the right bounds.
|
||||||
|
name: "Scroll with a container and no endpoints",
|
||||||
|
raw: `{"kind":"Scroll","direction":"up","selector":"id:list","fromX":0,"fromY":0,"toX":0,"toY":0,"durationMillis":250}`,
|
||||||
|
want: Action{Kind: ActionKindScroll, On: "id:list", Direction: "up", DurationMillis: 250},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "PressKey",
|
name: "PressKey",
|
||||||
raw: `{"kind":"PressKey","key":"back"}`,
|
raw: `{"kind":"PressKey","key":"back"}`,
|
||||||
|
|||||||
Reference in new issue
Block a user