fix: keep successful file path attachments silent
This commit is contained in:
@@ -85,7 +85,7 @@ export function FilePathDropZone({ children, className }: { children: React.Reac
|
|||||||
setNotice("Open a chat to attach file paths.");
|
setNotice("Open a chat to attach file paths.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setNotice(skipped ? "File paths attached. Some dropped items had no available file path." : "File paths attached.");
|
setNotice(skipped ? "Some dropped items had no available file path." : "");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ try {
|
|||||||
await blur(page); await syntheticDrop(page, ["/synthetic/collapsed-practice.pdf"]);
|
await blur(page); await syntheticDrop(page, ["/synthetic/collapsed-practice.pdf"]);
|
||||||
// Practice keeps the owning hook/state mounted, but hides its field
|
// Practice keeps the owning hook/state mounted, but hides its field
|
||||||
// by returning the bar. Inspect the controlled text after expansion.
|
// by returning the bar. Inspect the controlled text after expansion.
|
||||||
await page.waitForFunction(() => document.querySelector('[role="status"]')?.textContent.includes("File paths attached"));
|
assert.equal(await page.$('[role="status"]'), null, "successful attachment has no confirmation bubble");
|
||||||
await page.locator('[data-testid="practice-dock-bar"]').click();
|
await page.locator('[data-testid="practice-dock-bar"]').click();
|
||||||
await page.waitForSelector(practice, { visible: true });
|
await page.waitForSelector(practice, { visible: true });
|
||||||
await expectValue(page, "`/synthetic/practice.pdf` `/synthetic/collapsed-practice.pdf`", practice);
|
await expectValue(page, "`/synthetic/practice.pdf` `/synthetic/collapsed-practice.pdf`", practice);
|
||||||
@@ -405,6 +405,7 @@ try {
|
|||||||
await expectValue(desktopPage, `read ${expectedQuoted} this`);
|
await expectValue(desktopPage, `read ${expectedQuoted} this`);
|
||||||
assert.equal(await desktopPage.$eval('[data-file-path-input] [role="img"]', chip => chip.title), fixturePath);
|
assert.equal(await desktopPage.$eval('[data-file-path-input] [role="img"]', chip => chip.title), fixturePath);
|
||||||
assert.equal(posts.length, beforeDesktopDrop, "actual OS-backed desktop drop must stage only");
|
assert.equal(posts.length, beforeDesktopDrop, "actual OS-backed desktop drop must stage only");
|
||||||
|
assert.equal(await desktopPage.$('[role="status"]'), null, "successful desktop attachment has no confirmation bubble");
|
||||||
assert.ok(fs.existsSync(fixturePath));
|
assert.ok(fs.existsSync(fixturePath));
|
||||||
assert.deepEqual(fs.readdirSync(path.join(home, "data")).filter(name => /upload|attachment/i.test(name)), []);
|
assert.deepEqual(fs.readdirSync(path.join(home, "data")).filter(name => /upload|attachment/i.test(name)), []);
|
||||||
checks.push("Actual Electron production preload: Puppeteer-selected OS-backed File resolves exact Unicode/backtick full path; virtual File returns empty; real DataTransfer drop inserts at caret without submit or file reads");
|
checks.push("Actual Electron production preload: Puppeteer-selected OS-backed File resolves exact Unicode/backtick full path; virtual File returns empty; real DataTransfer drop inserts at caret without submit or file reads");
|
||||||
|
|||||||
@@ -124,7 +124,17 @@ test("desktop drop inserts quoted paths at the focused editor caret instead of t
|
|||||||
assert.equal(f.doc.activeElement, f.editor);
|
assert.equal(f.doc.activeElement, f.editor);
|
||||||
assert.deepEqual(f.appends, [], "focused editor wins over the registered question field");
|
assert.deepEqual(f.appends, [], "focused editor wins over the registered question field");
|
||||||
assert.deepEqual(f.resolved, files, "only Electron's full path, never File.name, enters the draft");
|
assert.deepEqual(f.resolved, files, "only Electron's full path, never File.name, enters the draft");
|
||||||
assert.match(f.status, /File paths attached/);
|
assert.equal(f.status, "", "successful file attachment is silent");
|
||||||
|
f.assertPathOnly();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a successful drop clears an earlier failure without replacing it with a confirmation bubble", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await f.event("drop", f.transfer([f.file("virtual.pdf")]));
|
||||||
|
assert.match(f.status, /No local file paths were available/);
|
||||||
|
await f.event("drop", f.transfer([f.file("valid.pdf", "/existing/valid.pdf")]));
|
||||||
|
assert.deepEqual(f.appends, ["`/existing/valid.pdf`"]);
|
||||||
|
assert.equal(f.doc.querySelector('[role="status"]'), null);
|
||||||
f.assertPathOnly();
|
f.assertPathOnly();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user