feat: persisted tabs

This commit is contained in:
2026-04-26 12:58:58 +02:00
parent b1592c49f4
commit dd9e6b73ae
6 changed files with 133 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ defmodule BDS.Desktop.ShellLiveTest do
alias BDS.Projects
alias BDS.Repo
alias BDS.Tags
alias BDS.UI.{Session, Workbench}
@endpoint BDS.Desktop.Endpoint
@@ -205,6 +206,27 @@ defmodule BDS.Desktop.ShellLiveTest do
refute html =~ ~s(data-testid="window-titlebar-menu-dropdown")
end
test "workbench session restore reopens permanent and transient tabs and selected activity" do
{:ok, view, _html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
session_payload =
Workbench.new()
|> Workbench.click_activity(:media)
|> Workbench.open_tab(:post, "post-1", :pin)
|> Workbench.open_tab(:media, "media-1", :preview)
|> Session.serialize()
html = render_hook(view, "restore_workbench_session", %{"session" => session_payload})
assert html =~ ~s(data-view="media")
assert html =~ ~s(data-active="true")
assert html =~ ~s(data-tab-type="post")
assert html =~ ~s(data-tab-id="post-1")
assert html =~ ~s(data-tab-type="media")
assert html =~ ~s(data-tab-id="media-1")
assert html =~ ~s(class="tab active transient")
end
test "shell live renders the legacy git activity badge from remote behind count" do
Application.put_env(:bds, :git_remote_state_provider, fn _project_id, _opts ->
{:ok, %{local_branch: "main", upstream_branch: "origin/main", has_upstream: true, ahead: 0, behind: 7}}