fix(tui): truncate project picker paths (#39678)
This commit is contained in:
parent
cba5ba03e3
commit
ce7a7e4e23
3 changed files with 30 additions and 9 deletions
|
|
@ -14,6 +14,11 @@ describe("truncateFilePath", () => {
|
|||
expect(truncateFilePath(path, 19)).toBe("…/dialog-select.tsx")
|
||||
})
|
||||
|
||||
test("uses remaining width for part of a long parent segment", () => {
|
||||
const path = "/private/var/folders/run-17f048ec-dbb2-4b36-860c-98637bb51a8d/files"
|
||||
expect(truncateFilePath(path, 40)).toBe("/…/run-17f048ec-dbb2-4b36-860c-98…/files")
|
||||
})
|
||||
|
||||
test("preserves the extension when the basename must shrink", () => {
|
||||
expect(truncateFilePath(path, 16)).toBe("…/dialog-se….tsx")
|
||||
expect(truncateFilePath("dialog-select.tsx", 12)).toBe("dialog-….tsx")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue