fix(webui): make action feedback easier to notice (#6702)
* fix(webui): make action feedback easier to notice * fix(webui): preserve undo and report confirmed action results * refactor(webui): trim toast preview and redundant coverage * test(webui): advance the undo window for the last topic deletion
This commit is contained in:
1 parent
0f45d74fec
commit
9ccf3b6214
59 files changed
+1621
-508
No files matched your search
@@ -4,6 +4,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { RemoteInstances } from "@/components/remote/RemoteInstances";
|
||||
import { useRemoteConnections } from "@/components/remote/remote-context";
|
||||
import { RemoteConnectionsPage } from "@/components/remote/RemoteConnectionsPage";
|
||||
import { PairingCodePopup } from "@/components/pairing/PairingCodePopup";
|
||||
import { ToastProvider } from "@/components/ui/toast";
|
||||
import { Sidebar } from "@/components/Sidebar";
|
||||
import { HOST_BRIDGE } from "@/components/remote/host-bridge";
|
||||
import { readSelectedRemote, readRecentRemotes, rememberSelectedRemote, validateRemoteConnection, type RemoteConnection } from "@/lib/remote-instances";
|
||||
@@ -157,6 +159,28 @@ describe("remote instance UX", () => {
|
||||
expect(mocks.request).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it.each(["toast", "no provider", "pairing popup"])("reports an attempt to open the local gateway (%s)", async (surface) => {
|
||||
mocks.read.mockResolvedValue({ available: true, profiles: [{ ...profile, paired: true }] });
|
||||
mocks.request.mockRejectedValueOnce(new Error("same_instance"));
|
||||
const shell = <>
|
||||
<LocalShell initialRemote />
|
||||
{surface === "pairing popup" && <PairingCodePopup
|
||||
requests={[{ code: "ABCD-EFGH", channel: "telegram", sender_id: "alice" }]}
|
||||
total={1} busyCode={null} error={null} onApprove={noop} onDismiss={noop} />}
|
||||
</>;
|
||||
render(<RemoteInstances>{surface === "no provider" ? shell : <ToastProvider>{shell}</ToastProvider>}</RemoteInstances>);
|
||||
|
||||
const directory = await screen.findByRole("region", { name: i18n.t("remote.title") });
|
||||
const server = await within(directory).findByRole("button", { name: "Team server ubuntu@example.test" });
|
||||
fireEvent.click(server);
|
||||
const alert = await screen.findByRole("alert");
|
||||
expect(alert).toHaveTextContent(i18n.t("remote.errors.same_instance"));
|
||||
if (surface === "toast") expect(alert.closest("[data-toast-tone]")).toHaveAttribute("data-toast-tone", "error");
|
||||
else expect(within(directory).getByRole("alert")).toBe(alert);
|
||||
expect(server).toBeEnabled();
|
||||
expect(readSelectedRemote()).toBeNull();
|
||||
});
|
||||
|
||||
it.each([false, true])("renames an open server without reloading its view (paired: %s)", async (paired) => {
|
||||
let saved = { ...profile, paired, connected: true };
|
||||
mocks.read.mockImplementation(async () => ({ available: true, profiles: [saved] }));
|
||||
|
||||
Reference in new issue
Block a user