refactor(webui): separate gateway mutations and UI state (#6727)
This commit is contained in:
1 parent
ce12bfdd0d
commit
5537bdabd3
70 files changed
+4058
-3650
No files matched your search
@@ -3,6 +3,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
|
||||
import { PromptNavigator } from "@/components/thread/PromptNavigator";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { mockBrowserFocus } from "./browser-focus";
|
||||
|
||||
let restoreBrowserFocus: () => void;
|
||||
@@ -80,6 +81,29 @@ it("keeps an unknown recovered time blank while the prompt remains navigable", a
|
||||
expect(onJumpToPrompt).toHaveBeenCalledWith("undated");
|
||||
});
|
||||
|
||||
it("defers Ctrl+F to an open popover but not to its exit animation", async () => {
|
||||
render(<>
|
||||
<style>{`.test-popover[data-state="open"] { animation-name: enter; }
|
||||
.test-popover[data-state="closed"] { animation-name: exit; }`}</style>
|
||||
<Popover>
|
||||
<PopoverTrigger>Model options</PopoverTrigger>
|
||||
<PopoverContent aria-label="Model options" className="test-popover"><button>Choose model</button></PopoverContent>
|
||||
</Popover>
|
||||
<PromptNavigator messages={[{ id: "one", role: "user", content: "alpha", createdAt: 1 }]} onJumpToPrompt={vi.fn()} />
|
||||
</>);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model options" }));
|
||||
const popover = screen.getByRole("dialog", { name: "Model options" });
|
||||
const option = screen.getByRole("button", { name: "Choose model" });
|
||||
fireEvent.keyDown(option, { key: "f", ctrlKey: true });
|
||||
expect(screen.queryByRole("textbox", { name: "Search messages" })).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.keyDown(option, { key: "Escape" });
|
||||
expect(popover).toHaveAttribute("data-state", "closed");
|
||||
expect(popover).toBeInTheDocument();
|
||||
fireEvent.keyDown(screen.getByRole("button", { name: "Model options" }), { key: "f", ctrlKey: true });
|
||||
expect(screen.getByRole("textbox", { name: "Search messages" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("returns shortcut-opened search to the interrupted editor", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<><input aria-label="Draft" /><PromptNavigator messages={[
|
||||
|
||||
Reference in new issue
Block a user