mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-11 08:48:45 +03:00
fix(app): keep location shortcut working after tooltip hover (#59680)
This commit is contained in:
committed by
GitHub
Unverified
parent
b431db8de0
commit
3f74f03f2e
@@ -51,6 +51,23 @@ test("the new session screen does not show session details", async ({ page }) =>
|
||||
await expect(page.getByRole("button", { name: "Session details", exact: true })).toHaveCount(0)
|
||||
})
|
||||
|
||||
test("the location shortcut keeps cycling after hovering its icon", async ({ page }) => {
|
||||
const view = await openDraft(page, { name: "LocationShortcut" })
|
||||
const modifier = await page.evaluate(() => (/Mac/i.test(navigator.platform) ? "Meta" : "Control"))
|
||||
await expect(view.editor).toBeFocused()
|
||||
await view.editor.press(`${modifier}+Alt+KeyL`)
|
||||
await expect(newSessionLocation(page)).toContainText("New worktree")
|
||||
await expect(view.editor).toBeFocused()
|
||||
await view.editor.press(`${modifier}+Alt+KeyL`)
|
||||
await expect(newSessionLocation(page)).not.toContainText("New worktree")
|
||||
await expect(page.locator('[data-slot="new-session-location-path"]')).toHaveText(view.directory)
|
||||
await page.locator('[data-slot="new-session-location-icon"]').hover()
|
||||
await expect(page.getByRole("tooltip")).toContainText("Toggle session location")
|
||||
await view.editor.press(`${modifier}+Alt+KeyL`)
|
||||
await expect(newSessionLocation(page)).toContainText("New worktree")
|
||||
await expect(view.editor).toBeFocused()
|
||||
})
|
||||
|
||||
for (const row of [
|
||||
{
|
||||
name: "POSIX",
|
||||
|
||||
@@ -361,7 +361,8 @@ function NewSessionLocation(props: {
|
||||
</Tooltip>
|
||||
{props.branch}
|
||||
</div>
|
||||
<Show when={path()}>
|
||||
{/* An open tooltip can outlive this row; keep its path instead of a stale Show accessor. */}
|
||||
<Show when={path()} keyed>
|
||||
{(directory) => (
|
||||
<div
|
||||
class="flex min-w-0 flex-1 justify-end pe-1.5 @max-[560px]:hidden"
|
||||
@@ -369,8 +370,8 @@ function NewSessionLocation(props: {
|
||||
>
|
||||
<Tooltip
|
||||
placement="top"
|
||||
value={directory()}
|
||||
disabled={fitted().text === directory() && fitted().minimum <= layout.width}
|
||||
value={directory}
|
||||
disabled={fitted().text === directory && fitted().minimum <= layout.width}
|
||||
class="flex min-w-0 flex-1"
|
||||
contentClass="max-w-[calc(100vw-32px)] break-all"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user