diff options
| author | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-09-28 19:47:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-28 19:47:21 -0400 |
| commit | c78b1dc8ebced75957cb45623d33ed8c8351ed96 (patch) | |
| tree | 362a08c4721e65f084390cf6976292ccda375253 /test-suite/unit/input-reliability.test.mjs | |
| parent | 6c5d31eddd145697f4c6f9d4964000c6e2068cb1 (diff) | |
| parent | b33d18552599664901356ae27db0270df3cc3129 (diff) | |
Merge pull request #24 from tianrendong/fix/fill-textarea-and-new-tab-capture
Fill whole textareas; cover new tabs' first page with early capture
Diffstat (limited to 'test-suite/unit/input-reliability.test.mjs')
| -rw-r--r-- | test-suite/unit/input-reliability.test.mjs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test-suite/unit/input-reliability.test.mjs b/test-suite/unit/input-reliability.test.mjs index 4a47e9c..8ea4bc5 100644 --- a/test-suite/unit/input-reliability.test.mjs +++ b/test-suite/unit/input-reliability.test.mjs @@ -215,6 +215,18 @@ for (const perCharacter of [false, true]) { }); } +test("fill selects a textarea's whole value with the selectAll command, not just the clicked line", async () => { + const h = harness({ tag: "TEXTAREA", editable: false }); + const result = await h.call("fill", { selector: "#target", text: "NEW", domFallback: false }); + assert.equal(result.input, "chrome"); + const keys = h.commands("Input.dispatchKeyEvent"); + const selectAll = keys.findIndex((c) => (c.params.commands || []).includes("selectAll")); + const del = keys.findIndex((c) => c.params.key === "Delete" && c.params.type === "keyDown"); + assert.ok(selectAll >= 0, "selectAll editing command sent"); + assert.ok(del > selectAll, "delete follows select-all"); + assert.equal(h.selected.length, 0, "no DOM range selection for value fields"); +}); + test("fill refuses to select an unrelated focused editor", async () => { const h = harness({ initial: "keep this" }); h.page.document.activeElement = { isContentEditable: true, contains: () => false }; |
