fix: hotkeys back working

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-26 06:45:37 +02:00
parent 29922b8058
commit 8258b044b1
8 changed files with 93 additions and 3 deletions

View File

@@ -45,6 +45,21 @@ defmodule BDS.Desktop.AutomationTest do
snapshot = Automation.snapshot(session)
assert snapshot.sidebar_visible == false
assert :ok = Automation.press(session, "Meta+B")
snapshot = Automation.snapshot(session)
assert snapshot.sidebar_visible == true
assert :ok = Automation.press(session, "Meta+J")
snapshot = Automation.snapshot(session)
assert snapshot.panel_visible == true
assert :ok = Automation.press(session, "Meta+J")
snapshot = Automation.snapshot(session)
assert snapshot.panel_visible == false
assert :ok = Automation.click(session, "[data-testid='toggle-assistant']")
snapshot = Automation.snapshot(session)

View File

@@ -125,4 +125,33 @@ defmodule BDS.Desktop.ShellLiveTest do
assert String.contains?(html, ">hero.png<")
assert String.contains?(html, ">cover.png<")
end
test "global shortcuts route through the shared command model" do
{:ok, view, html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
assert html =~ ~s(data-testid="sidebar-shell")
assert html =~ ~s(class="panel-shell is-hidden")
html = render_keydown(view, "shortcut", %{key: "b", meta: true})
assert html =~ ~s(class="sidebar-shell is-hidden")
html = render_keydown(view, "shortcut", %{key: "j", meta: true})
refute html =~ ~s(class="panel-shell is-hidden")
html = render_keydown(view, "shortcut", %{key: "2", meta: true})
assert html =~ ~s(data-view="media")
html =
render_click(view, "pin_sidebar_item", %{
"route" => "media",
"id" => "media-1",
"title" => "hero.png",
"subtitle" => "12 KB"
})
assert html =~ ~s(data-tab-id="media-1")
html = render_keydown(view, "shortcut", %{key: "w", meta: true})
refute html =~ ~s(data-tab-id="media-1")
end
end