nuke browser tests cause codex just gets caught up in them
This commit is contained in:
1 parent
c55ae239ff
commit
c09f491b37
22 files changed
+3
-14123
No files matched your search
@@ -60,50 +60,6 @@ jobs:
|
||||
- name: Test
|
||||
run: vp run test
|
||||
|
||||
test_browser:
|
||||
name: Test Browser
|
||||
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: true
|
||||
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-playwright-
|
||||
|
||||
- name: Install browser test runtime
|
||||
run: vp run --filter @t3tools/web test:browser:install
|
||||
|
||||
- name: Browser test / Chat view
|
||||
working-directory: apps/web
|
||||
run: vp test run --mode browser --browser=chromium src/components/ChatView.browser.tsx
|
||||
|
||||
- name: Browser test / Chat markdown
|
||||
working-directory: apps/web
|
||||
run: vp test run --mode browser --browser=chromium src/components/ChatMarkdown.browser.tsx
|
||||
|
||||
- name: Browser test / Components
|
||||
working-directory: apps/web
|
||||
run: |
|
||||
vp test run --mode browser --browser=chromium \
|
||||
src/components/ThreadTerminalDrawer.browser.tsx \
|
||||
src/components/chat/MessagesTimeline.browser.tsx \
|
||||
src/components/chat/ProviderModelPicker.browser.tsx \
|
||||
src/components/chat/CompactComposerControlsMenu.browser.tsx \
|
||||
src/components/settings/SettingsPanels.browser.tsx
|
||||
|
||||
mobile_native_static_analysis:
|
||||
name: Mobile Native Static Analysis
|
||||
runs-on: blacksmith-12vcpu-macos-26
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
"build": "vp build",
|
||||
"preview": "vp preview",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vp test run --passWithNoTests --project unit",
|
||||
"test:browser": "vp test run --project browser",
|
||||
"test:browser:install": "playwright install --with-deps chromium"
|
||||
"test": "vp test run --passWithNoTests --project unit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.4.1",
|
||||
@@ -64,10 +62,8 @@
|
||||
"@vitejs/plugin-react": "^6.0.0",
|
||||
"babel-plugin-react-compiler": "1.0.0",
|
||||
"msw": "2.12.11",
|
||||
"playwright": "^1.58.2",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "catalog:",
|
||||
"vite-plus": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5"
|
||||
"vite-plus": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,918 +0,0 @@
|
||||
import "../index.css";
|
||||
|
||||
import { AsyncResult } from "effect/unstable/reactivity";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
const {
|
||||
contextMenuShowMock,
|
||||
openFileInPreviewMock,
|
||||
openInPreferredEditorMock,
|
||||
openUrlInPreviewMock,
|
||||
readLocalApiMock,
|
||||
} = vi.hoisted(() => ({
|
||||
contextMenuShowMock: vi.fn(),
|
||||
openFileInPreviewMock: vi.fn(),
|
||||
openInPreferredEditorMock: vi.fn(),
|
||||
openUrlInPreviewMock: vi.fn(),
|
||||
readLocalApiMock: vi.fn(() => ({
|
||||
contextMenu: { show: contextMenuShowMock },
|
||||
server: { getConfig: vi.fn(async () => ({ availableEditors: ["vscode"] })) },
|
||||
shell: {
|
||||
openExternal: vi.fn(async () => undefined),
|
||||
openInEditor: vi.fn(async () => undefined),
|
||||
},
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock("../editorPreferences", () => ({
|
||||
useOpenInPreferredEditor: () => openInPreferredEditorMock,
|
||||
}));
|
||||
|
||||
vi.mock("../localApi", () => ({
|
||||
ensureLocalApi: vi.fn(() => {
|
||||
throw new Error("ensureLocalApi not implemented in browser test");
|
||||
}),
|
||||
readLocalApi: readLocalApiMock,
|
||||
}));
|
||||
|
||||
vi.mock("../previewStateStore", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../previewStateStore")>()),
|
||||
isPreviewSupportedInRuntime: () => true,
|
||||
}));
|
||||
|
||||
vi.mock("../state/session", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../state/session")>()),
|
||||
usePreparedConnection: () => ({
|
||||
_tag: "Some",
|
||||
value: { httpBaseUrl: "http://localhost:3000" },
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("../browser/openFileInPreview", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../browser/openFileInPreview")>()),
|
||||
openFileInPreview: openFileInPreviewMock,
|
||||
openUrlInPreview: openUrlInPreviewMock,
|
||||
}));
|
||||
|
||||
import ChatMarkdown from "./ChatMarkdown";
|
||||
import { serializeTableElementToCsv, serializeTableElementToMarkdown } from "../markdown-clipboard";
|
||||
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
import { selectThreadRightPanelState, useRightPanelStore } from "../rightPanelStore";
|
||||
|
||||
const threadRef = {
|
||||
environmentId: EnvironmentId.make("environment-test"),
|
||||
threadId: ThreadId.make("thread-test"),
|
||||
};
|
||||
|
||||
describe("ChatMarkdown", () => {
|
||||
beforeEach(() => {
|
||||
openInPreferredEditorMock.mockResolvedValue(AsyncResult.success("vscode"));
|
||||
openFileInPreviewMock.mockResolvedValue(AsyncResult.success(undefined));
|
||||
openUrlInPreviewMock.mockResolvedValue(AsyncResult.success(undefined));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
openInPreferredEditorMock.mockClear();
|
||||
openFileInPreviewMock.mockClear();
|
||||
openUrlInPreviewMock.mockClear();
|
||||
contextMenuShowMock.mockReset();
|
||||
readLocalApiMock.mockClear();
|
||||
useRightPanelStore.setState({ byThreadKey: {} });
|
||||
localStorage.clear();
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("makes task-list checkboxes interactive when a change handler is provided", async () => {
|
||||
const onTaskListChange = vi.fn();
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text={"- [ ] Ship it"}
|
||||
cwd="/repo/project"
|
||||
onTaskListChange={onTaskListChange}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const checkbox = page.getByRole("checkbox", { name: "Toggle task" });
|
||||
await expect.element(checkbox).not.toBeDisabled();
|
||||
await checkbox.click();
|
||||
expect(onTaskListChange).toHaveBeenCalledWith({ markerOffset: 2, checked: true });
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("rewrites file uri hrefs into direct paths before rendering", async () => {
|
||||
const filePath =
|
||||
"/Users/yashsingh/p/sco/claude-code-extract/src/utils/permissions/PermissionRule.ts";
|
||||
const screen = await render(
|
||||
<ChatMarkdown text={`[PermissionRule.ts](file://${filePath})`} cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "PermissionRule.ts" });
|
||||
await expect.element(link).toBeInTheDocument();
|
||||
await expect.element(link).toHaveAttribute("href", filePath);
|
||||
|
||||
await link.click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(openInPreferredEditorMock).toHaveBeenCalledWith(filePath);
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps line anchors working after rewriting file uri hrefs", async () => {
|
||||
const filePath =
|
||||
"/Users/yashsingh/p/sco/claude-code-extract/src/utils/permissions/PermissionRule.ts";
|
||||
const screen = await render(
|
||||
<ChatMarkdown text={`[PermissionRule.ts:1](file://${filePath}#L1)`} cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "PermissionRule.ts · L1" });
|
||||
await expect.element(link).toBeInTheDocument();
|
||||
await expect.element(link).toHaveAttribute("href", `${filePath}:1`);
|
||||
|
||||
await link.click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(openInPreferredEditorMock).toHaveBeenCalledWith(`${filePath}:1`);
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("shows column information inline when present", async () => {
|
||||
const filePath =
|
||||
"/Users/yashsingh/p/sco/claude-code-extract/src/utils/permissions/PermissionRule.ts";
|
||||
const screen = await render(
|
||||
<ChatMarkdown text={`[PermissionRule.ts](file://${filePath}#L1C7)`} cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "PermissionRule.ts · L1:C7" });
|
||||
await expect.element(link).toBeInTheDocument();
|
||||
await expect.element(link).toHaveAttribute("href", `${filePath}:1:7`);
|
||||
|
||||
await link.click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(openInPreferredEditorMock).toHaveBeenCalledWith(`${filePath}:1:7`);
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("disambiguates duplicate file basenames inline", async () => {
|
||||
const firstPath = "/Users/yashsingh/p/t3code/apps/web/src/components/chat/MessagesTimeline.tsx";
|
||||
const secondPath = "/Users/yashsingh/p/t3code/apps/web/src/components/MessagesTimeline.tsx";
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text={`See [MessagesTimeline.tsx](file://${firstPath}) and [MessagesTimeline.tsx](file://${secondPath}).`}
|
||||
cwd="/repo/project"
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await expect
|
||||
.element(page.getByRole("link", { name: "MessagesTimeline.tsx · components/chat" }))
|
||||
.toBeInTheDocument();
|
||||
await expect
|
||||
.element(page.getByRole("link", { name: "MessagesTimeline.tsx · src/components" }))
|
||||
.toBeInTheDocument();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps normal web links unchanged", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown text="[OpenAI](https://openai.com/docs)" cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "OpenAI" });
|
||||
await expect.element(link).toBeInTheDocument();
|
||||
await expect.element(link).toHaveAttribute("href", "https://openai.com/docs");
|
||||
await expect.element(link).toHaveAttribute("target", "_blank");
|
||||
const favicon = link.element().querySelector<HTMLElement>(".chat-markdown-link-favicon");
|
||||
const leading = link.element().querySelector<HTMLElement>(".chat-markdown-link-leading");
|
||||
expect(favicon).not.toBeNull();
|
||||
expect(leading).not.toBeNull();
|
||||
expect(leading?.contains(favicon)).toBe(true);
|
||||
expect(getComputedStyle(leading!).display).toBe("inline");
|
||||
expect(getComputedStyle(leading!).whiteSpace).toBe("nowrap");
|
||||
expect(getComputedStyle(favicon!).verticalAlign).not.toBe("baseline");
|
||||
expect(leading?.textContent).toBe("O");
|
||||
expect(link.element().textContent).toBe("OpenAI");
|
||||
expect(getComputedStyle(link.element()).textDecorationLine).toBe("none");
|
||||
expect(link.element().querySelector("img, svg")?.getBoundingClientRect().width).toBe(14);
|
||||
await link.hover();
|
||||
expect(getComputedStyle(link.element()).backgroundImage).not.toBe("none");
|
||||
await expect.element(page.getByText("https://openai.com/docs")).toBeVisible();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("opens web links in the integrated browser from the context menu", async () => {
|
||||
contextMenuShowMock.mockResolvedValue("open-in-browser");
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text="[OpenAI](https://openai.com/docs)"
|
||||
cwd="/repo/project"
|
||||
threadRef={threadRef}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "OpenAI" }).element();
|
||||
link.dispatchEvent(
|
||||
new MouseEvent("contextmenu", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
clientX: 12,
|
||||
clientY: 24,
|
||||
}),
|
||||
);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(contextMenuShowMock).toHaveBeenCalled();
|
||||
expect(openUrlInPreviewMock).toHaveBeenCalledWith({
|
||||
threadRef,
|
||||
url: "https://openai.com/docs",
|
||||
openPreview: expect.any(Function),
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("offers integrated browser opening for HTML file links", async () => {
|
||||
contextMenuShowMock.mockResolvedValue("open-in-browser");
|
||||
const filePath = "/repo/project/report.html";
|
||||
const screen = await render(
|
||||
<ChatMarkdown text="[report.html](report.html)" cwd="/repo/project" threadRef={threadRef} />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "report.html" }).element();
|
||||
link.dispatchEvent(
|
||||
new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 4, clientY: 8 }),
|
||||
);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(contextMenuShowMock).toHaveBeenCalledWith(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "open-in-browser",
|
||||
label: "Open in integrated browser",
|
||||
}),
|
||||
]),
|
||||
{ x: 4, y: 8 },
|
||||
);
|
||||
expect(openFileInPreviewMock).toHaveBeenCalledWith({
|
||||
threadRef,
|
||||
filePath,
|
||||
httpBaseUrl: "http://localhost:3000",
|
||||
createAssetUrl: expect.any(Function),
|
||||
openPreview: expect.any(Function),
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("opens code file links in the right-panel file preview", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text="[ChatMarkdown.tsx](apps/web/src/components/ChatMarkdown.tsx#L978)"
|
||||
cwd="/repo/project"
|
||||
threadRef={threadRef}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await page.getByRole("link", { name: "ChatMarkdown.tsx · L978" }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(
|
||||
selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, threadRef),
|
||||
).toMatchObject({
|
||||
isOpen: true,
|
||||
activeSurfaceId: "file:apps/web/src/components/ChatMarkdown.tsx",
|
||||
surfaces: [
|
||||
expect.objectContaining({
|
||||
relativePath: "apps/web/src/components/ChatMarkdown.tsx",
|
||||
revealLine: 978,
|
||||
revealRequestId: 1,
|
||||
}),
|
||||
],
|
||||
});
|
||||
expect(openInPreferredEditorMock).not.toHaveBeenCalled();
|
||||
expect(openFileInPreviewMock).not.toHaveBeenCalled();
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("opens HTML and PDF file links in the integrated browser preview", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text="[report.html](report.html) [report.pdf](report.pdf)"
|
||||
cwd="/repo/project"
|
||||
threadRef={threadRef}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await page.getByRole("link", { name: "report.html" }).click();
|
||||
await page.getByRole("link", { name: "report.pdf" }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(openFileInPreviewMock).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({
|
||||
threadRef,
|
||||
filePath: "/repo/project/report.html",
|
||||
}),
|
||||
);
|
||||
expect(openFileInPreviewMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({
|
||||
threadRef,
|
||||
filePath: "/repo/project/report.pdf",
|
||||
}),
|
||||
);
|
||||
expect(openInPreferredEditorMock).not.toHaveBeenCalled();
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps opening file links in the editor from the context menu", async () => {
|
||||
contextMenuShowMock.mockResolvedValue("open");
|
||||
const filePath = "/repo/project/src/index.ts";
|
||||
const screen = await render(
|
||||
<ChatMarkdown text="[index.ts](src/index.ts)" cwd="/repo/project" threadRef={threadRef} />,
|
||||
);
|
||||
|
||||
try {
|
||||
page
|
||||
.getByRole("link", { name: "index.ts" })
|
||||
.element()
|
||||
.dispatchEvent(
|
||||
new MouseEvent("contextmenu", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
clientX: 4,
|
||||
clientY: 8,
|
||||
}),
|
||||
);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(openInPreferredEditorMock).toHaveBeenCalledWith(filePath);
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps a favicon with the leading segment of a wrapping URL", async () => {
|
||||
const url = "https://github.com/pingdotgg/t3code/pull/3017/changes";
|
||||
const screen = await render(
|
||||
<div style={{ width: 180 }}>
|
||||
<ChatMarkdown text={`[${url}](${url})`} cwd="/repo/project" />
|
||||
</div>,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: url });
|
||||
const leading = link.element().querySelector<HTMLElement>(".chat-markdown-link-leading");
|
||||
const favicon = link.element().querySelector<HTMLElement>(".chat-markdown-link-favicon");
|
||||
expect(leading).not.toBeNull();
|
||||
expect(favicon).not.toBeNull();
|
||||
expect(leading?.contains(favicon)).toBe(true);
|
||||
expect(leading?.textContent).toBe("https://");
|
||||
expect(getComputedStyle(leading!).display).toBe("inline");
|
||||
expect(getComputedStyle(leading!).whiteSpace).toBe("nowrap");
|
||||
expect(getComputedStyle(favicon!).verticalAlign).not.toBe("baseline");
|
||||
expect(link.element().textContent).toBe(url);
|
||||
expect(link.element().querySelectorAll("wbr").length).toBeGreaterThan(0);
|
||||
const markdownRoot = link.element().closest<HTMLElement>(".chat-markdown");
|
||||
expect(markdownRoot).not.toBeNull();
|
||||
expect(markdownRoot!.scrollWidth).toBeLessThanOrEqual(markdownRoot!.clientWidth);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("renders file links with the shared file tag chip treatment", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown text="[package.json](path/to/package.json)" cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const link = page.getByRole("link", { name: "package.json" });
|
||||
await expect.element(link).toHaveClass(/chat-markdown-file-link/);
|
||||
const element = document.querySelector<HTMLElement>(".chat-markdown-file-link");
|
||||
expect(element?.querySelector("img, svg")).not.toBeNull();
|
||||
expect(getComputedStyle(element!).display).toBe("inline-flex");
|
||||
expect(getComputedStyle(element!).textDecorationLine).toBe("none");
|
||||
expect(getComputedStyle(element!).borderStyle).toBe("solid");
|
||||
expect(getComputedStyle(element!).userSelect).not.toBe("none");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("renders sanitized details with the design-system collapsible", async () => {
|
||||
const source = [
|
||||
"<details open>",
|
||||
"<summary>Expandable details section</summary>",
|
||||
"",
|
||||
"This content includes **formatted text**.",
|
||||
"",
|
||||
'<span title="native tooltip should be stripped">Safe inline HTML</span>',
|
||||
"<script>window.__unsafeMarkdownScript = true</script>",
|
||||
"</details>",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const details = document.querySelector<HTMLElement>("[data-markdown-details]");
|
||||
const trigger = page.getByRole("button", { name: "Expandable details section" });
|
||||
expect(details).not.toBeNull();
|
||||
expect(details?.tagName).toBe("DIV");
|
||||
await expect.element(trigger).toHaveAttribute("aria-expanded", "true");
|
||||
expect(details?.querySelector("strong")?.textContent).toBe("formatted text");
|
||||
expect(details?.querySelector("script")).toBeNull();
|
||||
expect(details?.querySelector("[title]")).toBeNull();
|
||||
|
||||
await trigger.click();
|
||||
await expect.element(trigger).toHaveAttribute("aria-expanded", "false");
|
||||
await trigger.click();
|
||||
await expect.element(trigger).toHaveAttribute("aria-expanded", "true");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("renders footnotes as same-document references", async () => {
|
||||
const source = [
|
||||
"A claim with supporting context.[^context]",
|
||||
"",
|
||||
"[^context]: Supporting **footnote text**.",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const reference = document.querySelector<HTMLAnchorElement>(
|
||||
'.chat-markdown a[data-footnote-ref=""]',
|
||||
);
|
||||
const footnotes = document.querySelector<HTMLElement>(
|
||||
".chat-markdown section[data-footnotes]",
|
||||
);
|
||||
expect(reference).not.toBeNull();
|
||||
expect(reference?.getAttribute("href")).toMatch(/^#user-content-fn-/);
|
||||
expect(reference?.hasAttribute("target")).toBe(false);
|
||||
expect(footnotes).not.toBeNull();
|
||||
expect(footnotes?.querySelector("strong")?.textContent).toBe("footnote text");
|
||||
expect(footnotes?.querySelector<HTMLAnchorElement>("a[data-footnote-backref]")?.target).toBe(
|
||||
"",
|
||||
);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("navigates hash links within the clicked markdown message", async () => {
|
||||
const source = [
|
||||
"A claim with supporting context.[^context]",
|
||||
"",
|
||||
"[^context]: Supporting footnote text.",
|
||||
].join("\n");
|
||||
const originalUrl = window.location.href;
|
||||
const scrollIntoView = vi
|
||||
.spyOn(HTMLElement.prototype, "scrollIntoView")
|
||||
.mockImplementation(() => undefined);
|
||||
const screen = await render(
|
||||
<div>
|
||||
<ChatMarkdown text={source} cwd="/repo/project" />
|
||||
<ChatMarkdown text={source} cwd="/repo/project" />
|
||||
</div>,
|
||||
);
|
||||
|
||||
try {
|
||||
const markdownRoots = document.querySelectorAll<HTMLElement>(".chat-markdown");
|
||||
const secondRoot = markdownRoots[1];
|
||||
const secondReference =
|
||||
secondRoot?.querySelector<HTMLAnchorElement>('a[data-footnote-ref=""]');
|
||||
const secondFootnote = secondRoot?.querySelector<HTMLElement>(
|
||||
"section[data-footnotes] li[id]",
|
||||
);
|
||||
expect(secondReference).not.toBeNull();
|
||||
expect(secondFootnote).not.toBeNull();
|
||||
|
||||
secondReference?.click();
|
||||
|
||||
expect(scrollIntoView).toHaveBeenCalledTimes(1);
|
||||
expect(scrollIntoView.mock.instances[0]).toBe(secondFootnote);
|
||||
expect(window.location.hash).toBe(secondReference?.hash);
|
||||
|
||||
const secondBackref = secondRoot?.querySelector<HTMLAnchorElement>(
|
||||
"a[data-footnote-backref]",
|
||||
);
|
||||
expect(secondBackref).not.toBeNull();
|
||||
secondBackref?.click();
|
||||
|
||||
const secondReferenceTarget = secondReference?.closest<HTMLElement>("[id]");
|
||||
expect(scrollIntoView).toHaveBeenCalledTimes(2);
|
||||
expect(scrollIntoView.mock.instances[1]).toBe(secondReferenceTarget);
|
||||
} finally {
|
||||
scrollIntoView.mockRestore();
|
||||
window.history.replaceState(window.history.state, "", originalUrl);
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
describe("code block chrome", () => {
|
||||
it("shows icon-only language titles, text fallbacks, and filename overrides", async () => {
|
||||
const source = [
|
||||
"```ts",
|
||||
"const a = 1;",
|
||||
"```",
|
||||
"",
|
||||
'```ts title="src/main.ts"',
|
||||
"const b = 2;",
|
||||
"```",
|
||||
"",
|
||||
"```text",
|
||||
"plain",
|
||||
"```",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const titles = [...document.querySelectorAll(".chat-markdown-codeblock-title")];
|
||||
expect(titles).toHaveLength(3);
|
||||
|
||||
// Language with a known icon: icon XOR text — never the redundant pair.
|
||||
const languageOnly = titles[0]!;
|
||||
const hasIcon = languageOnly.querySelector("svg[data-pierre-icon]") != null;
|
||||
const hasText = (languageOnly.textContent ?? "").includes("ts");
|
||||
expect(hasIcon || hasText).toBe(true);
|
||||
expect(hasIcon && hasText).toBe(false);
|
||||
if (hasIcon) {
|
||||
const languageTrigger = page.getByLabelText("Language: ts").first();
|
||||
await languageTrigger.hover();
|
||||
await vi.waitFor(() => {
|
||||
const tooltip = document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]');
|
||||
expect(tooltip?.textContent).toContain("ts");
|
||||
});
|
||||
}
|
||||
|
||||
// Explicit filename: text always shown.
|
||||
expect(titles[1]!.textContent).toBe("src/main.ts");
|
||||
|
||||
// Unknown language: no icon attempt, text label.
|
||||
expect(titles[2]!.querySelector("svg[data-pierre-icon]")).toBeNull();
|
||||
expect(titles[2]!.textContent).toBe("text");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("toggles line wrapping per block", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown text={'```ts\nconst x = "long";\n```'} cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const block = document.querySelector(".chat-markdown-codeblock");
|
||||
expect(block?.getAttribute("data-wrap")).toBe("false");
|
||||
|
||||
const toggle = page.getByRole("button", { name: "Wrap lines" });
|
||||
await expect.element(toggle).not.toHaveAttribute("title");
|
||||
await toggle.hover();
|
||||
await vi.waitFor(() => {
|
||||
const tooltip = document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]');
|
||||
expect(tooltip?.textContent).toContain("Wrap lines");
|
||||
});
|
||||
await toggle.click();
|
||||
expect(block?.getAttribute("data-wrap")).toBe("true");
|
||||
|
||||
await page.getByRole("button", { name: "Disable line wrap" }).click();
|
||||
expect(block?.getAttribute("data-wrap")).toBe("false");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("scrolls wide tables horizontally instead of letter-wrapping cells", async () => {
|
||||
const header = `| ${Array.from({ length: 8 }, (_, i) => `ColumnHeading${i}`).join(" | ")} |`;
|
||||
const separator = `| ${Array.from({ length: 8 }, () => "---").join(" | ")} |`;
|
||||
const row = `| ${Array.from({ length: 8 }, () => "[email protected]").join(" | ")} |`;
|
||||
const screen = await render(
|
||||
<ChatMarkdown text={[header, separator, row].join("\n")} cwd="/repo/project" />,
|
||||
);
|
||||
|
||||
try {
|
||||
const viewport = document.querySelector(
|
||||
'.chat-markdown-table-container [data-slot="scroll-area-viewport"]',
|
||||
);
|
||||
expect(viewport).not.toBeNull();
|
||||
expect(viewport!.querySelector("table")).not.toBeNull();
|
||||
// Content exceeds the container — the scroll-fade viewport scrolls
|
||||
// horizontally rather than squishing columns.
|
||||
expect(viewport!.scrollWidth).toBeGreaterThan(viewport!.clientWidth);
|
||||
// And cells keep their longest word intact instead of breaking mid-word.
|
||||
const cell = viewport!.querySelector("td");
|
||||
expect(cell!.getBoundingClientRect().width).toBeGreaterThan(100);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
describe("table chrome", () => {
|
||||
const longCell =
|
||||
"This service has been experiencing intermittent latency spikes during peak traffic hours and the on-call team is investigating.";
|
||||
|
||||
it("truncates cells by default and expands them from the footer toggle", async () => {
|
||||
const source = ["| Name | Notes |", "| --- | --- |", `| api | ${longCell} |`].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const container = document.querySelector(".chat-markdown-table-container");
|
||||
expect(container?.getAttribute("data-expanded")).toBe("false");
|
||||
|
||||
const noteCell = [...document.querySelectorAll(".chat-markdown td")].at(-1)!;
|
||||
expect(getComputedStyle(noteCell).whiteSpace).toBe("nowrap");
|
||||
expect(noteCell.scrollWidth).toBeGreaterThan(noteCell.clientWidth);
|
||||
|
||||
const expandButton = page.getByRole("button", { name: "Expand table cells" });
|
||||
await expect.element(expandButton).not.toHaveAttribute("title");
|
||||
await expandButton.hover();
|
||||
await vi.waitFor(() => {
|
||||
const tooltip = document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]');
|
||||
expect(tooltip?.textContent).toContain("Expand table cells");
|
||||
});
|
||||
await expandButton.click();
|
||||
expect(container?.getAttribute("data-expanded")).toBe("true");
|
||||
expect(getComputedStyle(noteCell).whiteSpace).not.toBe("nowrap");
|
||||
|
||||
await page.getByRole("button", { name: "Collapse table cells" }).click();
|
||||
expect(container?.getAttribute("data-expanded")).toBe("false");
|
||||
|
||||
const copyButton = page.getByRole("button", { name: "Copy table" });
|
||||
await expect.element(copyButton).not.toHaveAttribute("title");
|
||||
await copyButton.hover();
|
||||
await vi.waitFor(() => {
|
||||
const tooltip = document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]');
|
||||
expect(tooltip?.textContent).toContain("Copy table");
|
||||
});
|
||||
expect(document.querySelector(".chat-markdown [title]")).toBeNull();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("retains column widths when cells expand", async () => {
|
||||
const source = [
|
||||
"| ID | Owner | Status | Priority | Region | Summary | Long Description | Metrics | Payload | Notes |",
|
||||
"| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |",
|
||||
'| 1001 | Ada Lovelace | Active | High | us-west-2 | Payment workflow migration | This cell has enough text to wrap across several lines when expanded without shrinking its column. | Requests: 128,440; Error rate: 0.04%; P95: 212ms | `{ "feature": "billing", "version": 3 }` | Needs post-release monitoring for 24 hours. |',
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const viewport = document.querySelector(
|
||||
'.chat-markdown-table-container [data-slot="scroll-area-viewport"]',
|
||||
)!;
|
||||
const table = viewport.querySelector("table")!;
|
||||
const collapsedWidths = [...table.querySelectorAll("thead th")].map(
|
||||
(cell) => cell.getBoundingClientRect().width,
|
||||
);
|
||||
expect(viewport.scrollWidth).toBeGreaterThan(viewport.clientWidth);
|
||||
|
||||
await page.getByRole("button", { name: "Expand table cells" }).click();
|
||||
|
||||
const expandedWidths = [...table.querySelectorAll("thead th")].map(
|
||||
(cell) => cell.getBoundingClientRect().width,
|
||||
);
|
||||
expect(expandedWidths).toHaveLength(collapsedWidths.length);
|
||||
expandedWidths.forEach((width, index) => {
|
||||
expect(width).toBeGreaterThanOrEqual(collapsedWidths[index]! - 1);
|
||||
});
|
||||
expect(viewport.scrollWidth).toBeGreaterThan(viewport.clientWidth);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("exports tables as markdown and csv", async () => {
|
||||
const source = [
|
||||
"| Name | Count |",
|
||||
"| --- | ---: |",
|
||||
'| widget, "deluxe" | 2 |',
|
||||
"| plain | 1 |",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const table = document.querySelector(".chat-markdown table")!;
|
||||
expect(serializeTableElementToMarkdown(table)).toBe(
|
||||
["| Name | Count |", "| --- | ---: |", '| widget, "deluxe" | 2 |', "| plain | 1 |"].join(
|
||||
"\n",
|
||||
),
|
||||
);
|
||||
expect(serializeTableElementToCsv(table)).toBe(
|
||||
["Name,Count", '"widget, ""deluxe""",2', "plain,1"].join("\n"),
|
||||
);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("copying rendered markdown", () => {
|
||||
function copySelectedMarkdown(): { text: string; html: string } {
|
||||
const root = document.querySelector(".chat-markdown");
|
||||
if (!root) throw new Error("chat-markdown root not rendered");
|
||||
const selection = window.getSelection();
|
||||
if (!selection) throw new Error("selection unavailable");
|
||||
selection.removeAllRanges();
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(root);
|
||||
selection.addRange(range);
|
||||
|
||||
const clipboardData = new DataTransfer();
|
||||
root.dispatchEvent(
|
||||
new ClipboardEvent("copy", { clipboardData, bubbles: true, cancelable: true }),
|
||||
);
|
||||
selection.removeAllRanges();
|
||||
return {
|
||||
text: clipboardData.getData("text/plain"),
|
||||
html: clipboardData.getData("text/html"),
|
||||
};
|
||||
}
|
||||
|
||||
it("round-trips links, emphasis, and inline code", async () => {
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text="Check out [Anthropic](https://anthropic.com), **bold**, *italic*, and `code`."
|
||||
cwd="/repo/project"
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const { text, html } = copySelectedMarkdown();
|
||||
expect(text).toBe(
|
||||
"Check out [Anthropic](https://anthropic.com), **bold**, *italic*, and `code`.",
|
||||
);
|
||||
expect(html).toContain('href="https://anthropic.com"');
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("round-trips block structure: headings, lists, quotes, and fences", async () => {
|
||||
const source = [
|
||||
"## Heading",
|
||||
"",
|
||||
"- first",
|
||||
"- second",
|
||||
" - nested",
|
||||
"",
|
||||
"1. one",
|
||||
"2. two",
|
||||
"",
|
||||
"- [x] done",
|
||||
"- [ ] todo",
|
||||
"",
|
||||
"> quoted",
|
||||
"",
|
||||
"```ts",
|
||||
"const x = 1;",
|
||||
"",
|
||||
"const y = 2;",
|
||||
"```",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const { text } = copySelectedMarkdown();
|
||||
expect(text).toBe(source);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("round-trips tables with alignment", async () => {
|
||||
const source = ["| Name | Count |", "| --- | ---: |", "| a | 1 |", "| b | 2 |"].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const { text } = copySelectedMarkdown();
|
||||
expect(text).toBe(source);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("round-trips details rendered through the collapsible", async () => {
|
||||
const source = [
|
||||
"<details open>",
|
||||
"<summary>Expandable details section</summary>",
|
||||
"",
|
||||
"This content includes **formatted text**.",
|
||||
"</details>",
|
||||
].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const { text } = copySelectedMarkdown();
|
||||
expect(text).toBe(source);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("excludes the code block header chrome from copied markdown", async () => {
|
||||
const source = ["```ts", "const x = 1;", "```"].join("\n");
|
||||
const screen = await render(<ChatMarkdown text={source} cwd="/repo/project" />);
|
||||
|
||||
try {
|
||||
const { text } = copySelectedMarkdown();
|
||||
expect(text).toBe(source);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("copies file links as markdown and skips UI affordances", async () => {
|
||||
const filePath = "/Users/yashsingh/p/t3code/src/utils/permissions/PermissionRule.ts";
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text={`See [PermissionRule.ts](file://${filePath}) for details.`}
|
||||
cwd="/repo/project"
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const { text, html } = copySelectedMarkdown();
|
||||
expect(text).toBe(
|
||||
`See [PermissionRule.ts](/Users/yashsingh/p/t3code/src/utils/permissions/PermissionRule.ts) for details.`,
|
||||
);
|
||||
expect(html).toContain("PermissionRule.ts");
|
||||
expect(html).not.toContain("<img");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("copies skill and file chips with source encodings that recreate composer chips", async () => {
|
||||
const source =
|
||||
"Use $agent-browser with [package.json](path/to/package.json) before continuing.";
|
||||
const screen = await render(
|
||||
<ChatMarkdown
|
||||
text={source}
|
||||
cwd="/repo/project"
|
||||
skills={[{ name: "agent-browser", displayName: "Agent Browser" }]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const root = document.querySelector(".chat-markdown")!;
|
||||
const selection = window.getSelection()!;
|
||||
selection.removeAllRanges();
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(root);
|
||||
selection.addRange(range);
|
||||
expect(selection.toString()).toContain("Agent Browser");
|
||||
expect(selection.toString()).toContain("package.json");
|
||||
selection.removeAllRanges();
|
||||
|
||||
const { text, html } = copySelectedMarkdown();
|
||||
expect(text).toBe(source);
|
||||
expect(html).toContain("Agent Browser");
|
||||
expect(html).toContain("package.json");
|
||||
expect(html).not.toContain("<img");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,22 +0,0 @@
|
||||
import "../index.css";
|
||||
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import { DiffPanelShell } from "./DiffPanelShell";
|
||||
|
||||
describe("DiffPanelShell", () => {
|
||||
it("uses the shared compact surface subheader in embedded mode", async () => {
|
||||
const screen = await render(
|
||||
<DiffPanelShell mode="embedded" header={<span>Diff controls</span>}>
|
||||
<div>Diff content</div>
|
||||
</DiffPanelShell>,
|
||||
);
|
||||
const subheader = screen.container.querySelector<HTMLElement>("[data-surface-subheader]");
|
||||
|
||||
expect(subheader).not.toBeNull();
|
||||
expect(subheader?.getBoundingClientRect().height).toBe(40);
|
||||
expect(window.getComputedStyle(subheader!).borderTopWidth).toBe("0px");
|
||||
expect(window.getComputedStyle(subheader!).borderBottomWidth).toBe("1px");
|
||||
});
|
||||
});
|
||||
@@ -1,266 +0,0 @@
|
||||
import "../index.css";
|
||||
|
||||
import {
|
||||
DEFAULT_RUNTIME_MODE,
|
||||
EnvironmentId,
|
||||
ProjectId,
|
||||
ProviderInstanceId,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { useCallback, useRef, useState } from "react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { page, userEvent } from "vite-plus/test/browser";
|
||||
import { cleanup, render } from "vitest-browser-react";
|
||||
|
||||
import { AppAtomRegistryProvider } from "../rpc/atomRegistry";
|
||||
import { DEFAULT_INTERACTION_MODE } from "../types";
|
||||
import type { SidebarThreadSummary } from "../types";
|
||||
import { SidebarThreadRow } from "./Sidebar";
|
||||
|
||||
// Double-click-to-rename is a desktop affordance; force the non-mobile path so
|
||||
// the rename input is reachable regardless of the test browser viewport.
|
||||
vi.mock("~/hooks/useMediaQuery", () => ({
|
||||
useIsMobile: () => false,
|
||||
useMediaQuery: () => false,
|
||||
}));
|
||||
|
||||
const THREAD_ID = ThreadId.make("thread-1");
|
||||
const ENVIRONMENT_ID = EnvironmentId.make("environment-local");
|
||||
const PROJECT_ID = ProjectId.make("project-1");
|
||||
const INITIAL_TITLE = "Original title";
|
||||
|
||||
const ROW_TESTID = `thread-row-${THREAD_ID}`;
|
||||
const TITLE_TESTID = `thread-title-${THREAD_ID}`;
|
||||
|
||||
// Spies live at module scope so their call history survives the row's
|
||||
// re-renders; reset between tests.
|
||||
const spies = {
|
||||
handleThreadClick: vi.fn(),
|
||||
startThreadRename: vi.fn(),
|
||||
navigateToThread: vi.fn(),
|
||||
handleMultiSelectContextMenu: vi.fn(async () => {}),
|
||||
handleThreadContextMenu: vi.fn(async () => {}),
|
||||
clearSelection: vi.fn(),
|
||||
commitRename: vi.fn(),
|
||||
attemptArchiveThread: vi.fn(async () => {}),
|
||||
openPrLink: vi.fn(),
|
||||
};
|
||||
|
||||
function buildThread(title: string): SidebarThreadSummary {
|
||||
return {
|
||||
id: THREAD_ID,
|
||||
environmentId: ENVIRONMENT_ID,
|
||||
projectId: PROJECT_ID,
|
||||
title,
|
||||
modelSelection: {
|
||||
instanceId: ProviderInstanceId.make("codex"),
|
||||
model: "gpt-5.4",
|
||||
},
|
||||
runtimeMode: DEFAULT_RUNTIME_MODE,
|
||||
interactionMode: DEFAULT_INTERACTION_MODE,
|
||||
session: null,
|
||||
createdAt: "2024-01-01T00:00:00.000Z",
|
||||
archivedAt: null,
|
||||
updatedAt: "2024-01-01T00:00:00.000Z",
|
||||
latestTurn: null,
|
||||
branch: null,
|
||||
worktreePath: null,
|
||||
latestUserMessageAt: null,
|
||||
hasPendingApprovals: false,
|
||||
hasPendingUserInput: false,
|
||||
hasActionableProposedPlan: false,
|
||||
};
|
||||
}
|
||||
|
||||
// Mirrors the real parent (`SidebarProjectItem`): holds the rename state, wires
|
||||
// `startThreadRename`, and commits by clearing the rename state and persisting
|
||||
// the new title back onto the thread so the row re-renders with it.
|
||||
function Harness() {
|
||||
const [title, setTitle] = useState(INITIAL_TITLE);
|
||||
const [renamingThreadKey, setRenamingThreadKey] = useState<string | null>(null);
|
||||
const [renamingTitle, setRenamingTitle] = useState("");
|
||||
const [confirmingArchiveThreadKey, setConfirmingArchiveThreadKey] = useState<string | null>(null);
|
||||
const renamingInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const renamingCommittedRef = useRef(false);
|
||||
const confirmArchiveButtonRefs = useRef(new Map<string, HTMLButtonElement>());
|
||||
|
||||
const startThreadRename = useCallback((threadKey: string, nextTitle: string) => {
|
||||
spies.startThreadRename(threadKey, nextTitle);
|
||||
setRenamingThreadKey(threadKey);
|
||||
setRenamingTitle(nextTitle);
|
||||
renamingCommittedRef.current = false;
|
||||
}, []);
|
||||
|
||||
const commitRename = useCallback(
|
||||
async (threadRef: unknown, newTitle: string, originalTitle: string) => {
|
||||
spies.commitRename(threadRef, newTitle, originalTitle);
|
||||
const trimmed = newTitle.trim();
|
||||
if (trimmed.length > 0) {
|
||||
setTitle(trimmed);
|
||||
}
|
||||
setRenamingThreadKey(null);
|
||||
renamingInputRef.current = null;
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const cancelRename = useCallback(() => {
|
||||
setRenamingThreadKey(null);
|
||||
renamingInputRef.current = null;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppAtomRegistryProvider>
|
||||
<ul>
|
||||
<SidebarThreadRow
|
||||
thread={buildThread(title)}
|
||||
projectCwd={null}
|
||||
orderedProjectThreadKeys={[]}
|
||||
isActive={false}
|
||||
jumpLabel={null}
|
||||
appSettingsConfirmThreadArchive={false}
|
||||
renamingThreadKey={renamingThreadKey}
|
||||
renamingTitle={renamingTitle}
|
||||
setRenamingTitle={setRenamingTitle}
|
||||
startThreadRename={startThreadRename}
|
||||
renamingInputRef={renamingInputRef}
|
||||
renamingCommittedRef={renamingCommittedRef}
|
||||
confirmingArchiveThreadKey={confirmingArchiveThreadKey}
|
||||
setConfirmingArchiveThreadKey={setConfirmingArchiveThreadKey}
|
||||
confirmArchiveButtonRefs={confirmArchiveButtonRefs}
|
||||
handleThreadClick={spies.handleThreadClick}
|
||||
navigateToThread={spies.navigateToThread}
|
||||
handleMultiSelectContextMenu={spies.handleMultiSelectContextMenu}
|
||||
handleThreadContextMenu={spies.handleThreadContextMenu}
|
||||
clearSelection={spies.clearSelection}
|
||||
commitRename={commitRename}
|
||||
cancelRename={cancelRename}
|
||||
attemptArchiveThread={spies.attemptArchiveThread}
|
||||
openPrLink={spies.openPrLink}
|
||||
/>
|
||||
</ul>
|
||||
</AppAtomRegistryProvider>
|
||||
);
|
||||
}
|
||||
|
||||
describe("SidebarThreadRow double-click rename", () => {
|
||||
beforeEach(() => {
|
||||
for (const spy of Object.values(spies)) spy.mockClear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it("double-clicking a row starts the inline rename, focused with text selected", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
const element = input.element() as HTMLInputElement;
|
||||
expect(element.value).toBe(INITIAL_TITLE);
|
||||
// The existing rename-input ref focuses + selects the whole title.
|
||||
expect(document.activeElement).toBe(element);
|
||||
expect(element.selectionStart).toBe(0);
|
||||
expect(element.selectionEnd).toBe(INITIAL_TITLE.length);
|
||||
});
|
||||
|
||||
it("Enter commits the rename and the new title persists on the row", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
await userEvent.fill(input, "Renamed thread");
|
||||
await userEvent.keyboard("{Enter}");
|
||||
|
||||
// commitRename was invoked with (threadRef, newTitle, originalTitle).
|
||||
expect(spies.commitRename).toHaveBeenCalledTimes(1);
|
||||
expect(spies.commitRename).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
"Renamed thread",
|
||||
INITIAL_TITLE,
|
||||
);
|
||||
|
||||
// Input is gone and the row now shows the persisted title.
|
||||
const title = page.getByTestId(TITLE_TESTID);
|
||||
await expect.element(title).toBeVisible();
|
||||
await expect.element(title).toHaveTextContent("Renamed thread");
|
||||
});
|
||||
|
||||
it("Escape cancels the rename without committing", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
await expect.element(page.getByRole("textbox")).toBeVisible();
|
||||
|
||||
await userEvent.keyboard("{Escape}");
|
||||
|
||||
expect(spies.commitRename).not.toHaveBeenCalled();
|
||||
const title = page.getByTestId(TITLE_TESTID);
|
||||
await expect.element(title).toBeVisible();
|
||||
await expect.element(title).toHaveTextContent(INITIAL_TITLE);
|
||||
});
|
||||
|
||||
it("double-clicking inside the rename input keeps the edit (does not reset to the title)", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
await userEvent.fill(input, "Edited but not committed");
|
||||
// Double-clicking inside the input (e.g. to select a word) must not bubble
|
||||
// to the row and restart the rename, which would wipe the edit.
|
||||
await userEvent.dblClick(input);
|
||||
|
||||
expect((input.element() as HTMLInputElement).value).toBe("Edited but not committed");
|
||||
expect(spies.commitRename).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("double-clicking the row chrome while already renaming does not restart/reset it", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
await userEvent.fill(input, "Edited");
|
||||
expect(spies.startThreadRename).toHaveBeenCalledTimes(1);
|
||||
|
||||
// Double-click the row element itself (chrome, not the input).
|
||||
const rowEl = page.getByTestId(ROW_TESTID).element();
|
||||
rowEl.dispatchEvent(new MouseEvent("dblclick", { bubbles: true, cancelable: true, detail: 2 }));
|
||||
|
||||
// Guard short-circuits: rename is not restarted and the edit is preserved.
|
||||
expect(spies.startThreadRename).toHaveBeenCalledTimes(1);
|
||||
expect((input.element() as HTMLInputElement).value).toBe("Edited");
|
||||
});
|
||||
|
||||
it("modifier double-click is multi-select intent and does not start a rename", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.keyboard("{Shift>}");
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
await userEvent.keyboard("{/Shift}");
|
||||
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
expect(page.getByRole("textbox").elements()).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("single click routes through the navigation handler and does not start a rename", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.click(page.getByTestId(ROW_TESTID));
|
||||
|
||||
expect(spies.handleThreadClick).toHaveBeenCalledTimes(1);
|
||||
// No rename input: the title span is still shown.
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
expect(page.getByRole("textbox").elements()).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
@@ -1,408 +0,0 @@
|
||||
import "../index.css";
|
||||
|
||||
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
|
||||
import { ThreadId } from "@t3tools/contracts";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
const {
|
||||
terminalConstructorSpy,
|
||||
terminalDisposeSpy,
|
||||
fitAddonFitSpy,
|
||||
fitAddonLoadSpy,
|
||||
terminalSessionByEnvironmentId,
|
||||
useAttachedTerminalSessionMock,
|
||||
atomCommandInvocationMock,
|
||||
useAtomCommandMock,
|
||||
readLocalApiMock,
|
||||
} = vi.hoisted(() => ({
|
||||
terminalConstructorSpy: vi.fn(),
|
||||
terminalDisposeSpy: vi.fn(),
|
||||
fitAddonFitSpy: vi.fn(),
|
||||
fitAddonLoadSpy: vi.fn(),
|
||||
terminalSessionByEnvironmentId: new Map<
|
||||
string,
|
||||
{
|
||||
summary: null;
|
||||
buffer: string;
|
||||
status: "running";
|
||||
error: null;
|
||||
hasRunningSubprocess: false;
|
||||
updatedAt: null;
|
||||
version: number;
|
||||
}
|
||||
>(),
|
||||
useAttachedTerminalSessionMock: vi.fn(),
|
||||
atomCommandInvocationMock: vi.fn(async () => ({
|
||||
_tag: "Success" as const,
|
||||
value: undefined,
|
||||
waiting: false,
|
||||
})),
|
||||
useAtomCommandMock: vi.fn(),
|
||||
readLocalApiMock: vi.fn<
|
||||
() =>
|
||||
| {
|
||||
contextMenu: { show: ReturnType<typeof vi.fn> };
|
||||
shell: { openExternal: ReturnType<typeof vi.fn> };
|
||||
}
|
||||
| undefined
|
||||
>(() => ({
|
||||
contextMenu: { show: vi.fn(async () => null) },
|
||||
shell: { openExternal: vi.fn(async () => undefined) },
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock("@xterm/addon-fit", () => ({
|
||||
FitAddon: class MockFitAddon {
|
||||
fit = fitAddonFitSpy;
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@xterm/xterm", () => ({
|
||||
Terminal: class MockTerminal {
|
||||
cols = 80;
|
||||
rows = 24;
|
||||
options: { theme?: unknown } = {};
|
||||
buffer = {
|
||||
active: {
|
||||
viewportY: 0,
|
||||
baseY: 0,
|
||||
getLine: vi.fn(() => null),
|
||||
},
|
||||
};
|
||||
|
||||
constructor(options: unknown) {
|
||||
terminalConstructorSpy(options);
|
||||
}
|
||||
|
||||
loadAddon(addon: unknown) {
|
||||
fitAddonLoadSpy(addon);
|
||||
}
|
||||
|
||||
open() {}
|
||||
|
||||
write() {}
|
||||
|
||||
clear() {}
|
||||
|
||||
clearSelection() {}
|
||||
|
||||
focus() {}
|
||||
|
||||
refresh() {}
|
||||
|
||||
scrollToBottom() {}
|
||||
|
||||
hasSelection() {
|
||||
return false;
|
||||
}
|
||||
|
||||
getSelection() {
|
||||
return "";
|
||||
}
|
||||
|
||||
getSelectionPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
attachCustomKeyEventHandler() {
|
||||
return true;
|
||||
}
|
||||
|
||||
registerLinkProvider() {
|
||||
return { dispose: vi.fn() };
|
||||
}
|
||||
|
||||
onData() {
|
||||
return { dispose: vi.fn() };
|
||||
}
|
||||
|
||||
onSelectionChange() {
|
||||
return { dispose: vi.fn() };
|
||||
}
|
||||
|
||||
dispose() {
|
||||
terminalDisposeSpy();
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../state/terminalSessions", () => ({
|
||||
useAttachedTerminalSession: (input: { environmentId: string }) => {
|
||||
useAttachedTerminalSessionMock(input);
|
||||
const session = terminalSessionByEnvironmentId.get(input.environmentId);
|
||||
if (session === undefined) {
|
||||
throw new Error(`Missing test terminal session for ${input.environmentId}`);
|
||||
}
|
||||
return session;
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../state/use-atom-command", () => ({
|
||||
useAtomCommand: (...args: ReadonlyArray<unknown>) => {
|
||||
useAtomCommandMock(...args);
|
||||
return atomCommandInvocationMock;
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../state/server", async (importOriginal) => {
|
||||
const [actual, { Atom }] = await Promise.all([
|
||||
importOriginal<typeof import("../state/server")>(),
|
||||
import("effect/unstable/reactivity"),
|
||||
]);
|
||||
return {
|
||||
...actual,
|
||||
primaryServerAvailableEditorsAtom: Atom.make([]),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("~/localApi", () => ({
|
||||
ensureLocalApi: vi.fn(() => {
|
||||
throw new Error("ensureLocalApi not implemented in browser test");
|
||||
}),
|
||||
readLocalApi: readLocalApiMock,
|
||||
}));
|
||||
|
||||
import { TerminalViewport } from "./ThreadTerminalDrawer";
|
||||
|
||||
const THREAD_ID = ThreadId.make("thread-terminal-browser");
|
||||
|
||||
function createTerminalSession() {
|
||||
return {
|
||||
summary: null,
|
||||
buffer: "",
|
||||
status: "running" as const,
|
||||
error: null,
|
||||
hasRunningSubprocess: false as const,
|
||||
updatedAt: null,
|
||||
version: 1,
|
||||
};
|
||||
}
|
||||
|
||||
async function mountTerminalViewport(props: {
|
||||
threadRef: ReturnType<typeof scopeThreadRef>;
|
||||
drawerBackgroundColor?: string;
|
||||
drawerTextColor?: string;
|
||||
runtimeEnv?: Record<string, string>;
|
||||
}) {
|
||||
const drawer = document.createElement("div");
|
||||
drawer.className = "thread-terminal-drawer";
|
||||
if (props.drawerBackgroundColor) {
|
||||
drawer.style.backgroundColor = props.drawerBackgroundColor;
|
||||
}
|
||||
if (props.drawerTextColor) {
|
||||
drawer.style.color = props.drawerTextColor;
|
||||
}
|
||||
|
||||
const host = document.createElement("div");
|
||||
host.style.width = "800px";
|
||||
host.style.height = "400px";
|
||||
drawer.append(host);
|
||||
document.body.append(drawer);
|
||||
|
||||
const screen = await render(
|
||||
<TerminalViewport
|
||||
threadRef={props.threadRef}
|
||||
threadId={THREAD_ID}
|
||||
terminalId="term-1"
|
||||
terminalLabel="Terminal"
|
||||
cwd="/repo/project"
|
||||
{...(props.runtimeEnv ? { runtimeEnv: props.runtimeEnv } : {})}
|
||||
onSessionExited={() => undefined}
|
||||
onAddTerminalContext={() => undefined}
|
||||
focusRequestId={0}
|
||||
autoFocus={false}
|
||||
resizeEpoch={0}
|
||||
drawerHeight={320}
|
||||
keybindings={[]}
|
||||
/>,
|
||||
{ container: host },
|
||||
);
|
||||
|
||||
return {
|
||||
rerender: async (nextProps: {
|
||||
threadRef: ReturnType<typeof scopeThreadRef>;
|
||||
runtimeEnv?: Record<string, string>;
|
||||
}) => {
|
||||
await screen.rerender(
|
||||
<TerminalViewport
|
||||
threadRef={nextProps.threadRef}
|
||||
threadId={THREAD_ID}
|
||||
terminalId="term-1"
|
||||
terminalLabel="Terminal"
|
||||
cwd="/repo/project"
|
||||
{...(nextProps.runtimeEnv ? { runtimeEnv: nextProps.runtimeEnv } : {})}
|
||||
onSessionExited={() => undefined}
|
||||
onAddTerminalContext={() => undefined}
|
||||
focusRequestId={0}
|
||||
autoFocus={false}
|
||||
resizeEpoch={0}
|
||||
drawerHeight={320}
|
||||
keybindings={[]}
|
||||
/>,
|
||||
);
|
||||
},
|
||||
cleanup: async () => {
|
||||
await screen.unmount();
|
||||
drawer.remove();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("TerminalViewport", () => {
|
||||
afterEach(() => {
|
||||
terminalSessionByEnvironmentId.clear();
|
||||
useAttachedTerminalSessionMock.mockClear();
|
||||
atomCommandInvocationMock.mockClear();
|
||||
useAtomCommandMock.mockClear();
|
||||
readLocalApiMock.mockClear();
|
||||
terminalConstructorSpy.mockClear();
|
||||
terminalDisposeSpy.mockClear();
|
||||
fitAddonFitSpy.mockClear();
|
||||
fitAddonLoadSpy.mockClear();
|
||||
});
|
||||
|
||||
it("renders the terminal through shared session state without the desktop API", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
readLocalApiMock.mockReturnValueOnce(undefined);
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(useAttachedTerminalSessionMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ environmentId: "environment-a" }),
|
||||
);
|
||||
});
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the terminal mounted when xterm fit runs before dimensions are ready", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
fitAddonFitSpy.mockImplementationOnce(() => {
|
||||
throw new TypeError("Cannot read properties of undefined (reading 'dimensions')");
|
||||
});
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(fitAddonFitSpy).toHaveBeenCalled();
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("reattaches the terminal when the scoped thread reference changes", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
terminalSessionByEnvironmentId.set("environment-b", createTerminalSession());
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
await mounted.rerender({
|
||||
threadRef: scopeThreadRef("environment-b" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(useAttachedTerminalSessionMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ environmentId: "environment-b" }),
|
||||
);
|
||||
});
|
||||
expect(terminalDisposeSpy).toHaveBeenCalledTimes(1);
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(2);
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("does not reattach the terminal when the scoped thread reference values stay the same", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
await mounted.rerender({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
});
|
||||
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
expect(terminalDisposeSpy).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("does not reattach when runtime env contents are unchanged but object identity changes", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
runtimeEnv: { PATH: "/usr/bin", T3: "1" },
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
await mounted.rerender({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
runtimeEnv: { T3: "1", PATH: "/usr/bin" },
|
||||
});
|
||||
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
expect(terminalDisposeSpy).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
it("uses the drawer surface colors for the terminal theme", async () => {
|
||||
terminalSessionByEnvironmentId.set("environment-a", createTerminalSession());
|
||||
|
||||
const mounted = await mountTerminalViewport({
|
||||
threadRef: scopeThreadRef("environment-a" as never, THREAD_ID),
|
||||
drawerBackgroundColor: "rgb(24, 28, 36)",
|
||||
drawerTextColor: "rgb(228, 232, 240)",
|
||||
});
|
||||
|
||||
try {
|
||||
await vi.waitFor(() => {
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
expect(terminalConstructorSpy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
theme: expect.objectContaining({
|
||||
background: "rgb(24, 28, 36)",
|
||||
foreground: "rgb(228, 232, 240)",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,326 +0,0 @@
|
||||
import {
|
||||
DEFAULT_MODEL,
|
||||
DEFAULT_MODEL_BY_PROVIDER,
|
||||
EnvironmentId,
|
||||
ModelSelection,
|
||||
ProviderInstanceId,
|
||||
ProviderDriverKind,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { scopedThreadKey, scopeThreadRef } from "@t3tools/client-runtime/environment";
|
||||
import "../../index.css";
|
||||
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
import { createModelCapabilities, createModelSelection } from "@t3tools/shared/model";
|
||||
|
||||
import { CompactComposerControlsMenu } from "./CompactComposerControlsMenu";
|
||||
import { TraitsMenuContent } from "./TraitsPicker";
|
||||
import { createEmptyThreadDraft, useComposerDraftStore } from "../../composerDraftStore";
|
||||
|
||||
const LOCAL_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
|
||||
|
||||
function selectDescriptor(
|
||||
id: string,
|
||||
label: string,
|
||||
options: ReadonlyArray<{ id: string; label: string; isDefault?: boolean }>,
|
||||
promptInjectedValues?: ReadonlyArray<string>,
|
||||
) {
|
||||
return {
|
||||
id,
|
||||
label,
|
||||
type: "select" as const,
|
||||
options: [...options],
|
||||
...(options.find((option) => option.isDefault)?.id
|
||||
? { currentValue: options.find((option) => option.isDefault)?.id }
|
||||
: {}),
|
||||
...(promptInjectedValues && promptInjectedValues.length > 0
|
||||
? { promptInjectedValues: [...promptInjectedValues] }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
function booleanDescriptor(id: string, label: string) {
|
||||
return {
|
||||
id,
|
||||
label,
|
||||
type: "boolean" as const,
|
||||
};
|
||||
}
|
||||
|
||||
async function mountMenu(props?: { modelSelection?: ModelSelection; prompt?: string }) {
|
||||
const threadId = ThreadId.make("thread-compact-menu");
|
||||
const threadRef = scopeThreadRef(LOCAL_ENVIRONMENT_ID, threadId);
|
||||
const threadKey = scopedThreadKey(threadRef);
|
||||
const provider = ProviderDriverKind.make("claudeAgent");
|
||||
const instanceId = ProviderInstanceId.make(props?.modelSelection?.instanceId ?? provider);
|
||||
const model =
|
||||
props?.modelSelection?.model ?? DEFAULT_MODEL_BY_PROVIDER[provider] ?? DEFAULT_MODEL;
|
||||
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadKey: {
|
||||
// Compose from the canonical empty-draft factory so adding a new
|
||||
// ComposerThreadDraftState slice (e.g. a future attachment kind) doesn't
|
||||
// silently break this stub via `Property X is missing in type ...`.
|
||||
[threadKey]: {
|
||||
...createEmptyThreadDraft(),
|
||||
prompt: props?.prompt ?? "",
|
||||
modelSelectionByProvider: {
|
||||
[instanceId]: createModelSelection(instanceId, model, props?.modelSelection?.options),
|
||||
},
|
||||
activeProvider: instanceId,
|
||||
},
|
||||
},
|
||||
draftThreadsByThreadKey: {},
|
||||
logicalProjectDraftThreadKeyByLogicalProjectKey: {},
|
||||
});
|
||||
const host = document.createElement("div");
|
||||
document.body.append(host);
|
||||
const onPromptChange = vi.fn();
|
||||
const providerOptions = props?.modelSelection?.options;
|
||||
const models = [
|
||||
{
|
||||
slug: "claude-opus-4-6",
|
||||
name: "Claude Opus 4.6",
|
||||
isCustom: false,
|
||||
capabilities: createModelCapabilities({
|
||||
optionDescriptors: [
|
||||
selectDescriptor(
|
||||
"effort",
|
||||
"Reasoning",
|
||||
[
|
||||
{ id: "low", label: "Low" },
|
||||
{ id: "medium", label: "Medium" },
|
||||
{ id: "high", label: "High", isDefault: true },
|
||||
{ id: "max", label: "Max" },
|
||||
{ id: "ultrathink", label: "Ultrathink" },
|
||||
],
|
||||
["ultrathink"],
|
||||
),
|
||||
booleanDescriptor("fastMode", "Fast Mode"),
|
||||
],
|
||||
}),
|
||||
},
|
||||
{
|
||||
slug: "claude-haiku-4-5",
|
||||
name: "Claude Haiku 4.5",
|
||||
isCustom: false,
|
||||
capabilities: createModelCapabilities({
|
||||
optionDescriptors: [booleanDescriptor("thinking", "Thinking")],
|
||||
}),
|
||||
},
|
||||
{
|
||||
slug: "claude-sonnet-4-6",
|
||||
name: "Claude Sonnet 4.6",
|
||||
isCustom: false,
|
||||
capabilities: createModelCapabilities({
|
||||
optionDescriptors: [
|
||||
selectDescriptor(
|
||||
"effort",
|
||||
"Reasoning",
|
||||
[
|
||||
{ id: "low", label: "Low" },
|
||||
{ id: "medium", label: "Medium" },
|
||||
{ id: "high", label: "High", isDefault: true },
|
||||
{ id: "ultrathink", label: "Ultrathink" },
|
||||
],
|
||||
["ultrathink"],
|
||||
),
|
||||
],
|
||||
}),
|
||||
},
|
||||
];
|
||||
const screen = await render(
|
||||
<CompactComposerControlsMenu
|
||||
activePlan={false}
|
||||
interactionMode="default"
|
||||
planSidebarLabel="Plan"
|
||||
planSidebarOpen={false}
|
||||
runtimeMode="approval-required"
|
||||
showInteractionModeToggle
|
||||
traitsMenuContent={
|
||||
<TraitsMenuContent
|
||||
provider={provider}
|
||||
models={models}
|
||||
threadRef={threadRef}
|
||||
model={model}
|
||||
prompt={props?.prompt ?? ""}
|
||||
modelOptions={providerOptions}
|
||||
onPromptChange={onPromptChange}
|
||||
/>
|
||||
}
|
||||
onToggleInteractionMode={vi.fn()}
|
||||
onTogglePlanSidebar={vi.fn()}
|
||||
onRuntimeModeChange={vi.fn()}
|
||||
/>,
|
||||
{ container: host },
|
||||
);
|
||||
|
||||
const cleanup = async () => {
|
||||
await screen.unmount();
|
||||
host.remove();
|
||||
};
|
||||
|
||||
return {
|
||||
[Symbol.asyncDispose]: cleanup,
|
||||
cleanup,
|
||||
};
|
||||
}
|
||||
|
||||
describe("CompactComposerControlsMenu", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadKey: {},
|
||||
draftThreadsByThreadKey: {},
|
||||
logicalProjectDraftThreadKeyByLogicalProjectKey: {},
|
||||
stickyModelSelectionByProvider: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("shows fast mode controls for Opus", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-opus-4-6",
|
||||
),
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Fast Mode");
|
||||
expect(text).toContain("On");
|
||||
expect(text).toContain("Off");
|
||||
});
|
||||
});
|
||||
|
||||
it("hides fast mode controls for non-Opus Claude models", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-sonnet-4-6",
|
||||
),
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(document.body.textContent ?? "").not.toContain("Fast Mode");
|
||||
});
|
||||
});
|
||||
|
||||
it("shows only the provided effort options", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-sonnet-4-6",
|
||||
),
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Low");
|
||||
expect(text).toContain("Medium");
|
||||
expect(text).toContain("High");
|
||||
expect(text).not.toContain("Max");
|
||||
expect(text).toContain("Ultrathink");
|
||||
});
|
||||
});
|
||||
|
||||
it("shows a Claude thinking on/off section for Haiku", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-haiku-4-5",
|
||||
[{ id: "thinking", value: true }],
|
||||
),
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Thinking");
|
||||
expect(text).toContain("On");
|
||||
expect(text).toContain("Off");
|
||||
});
|
||||
});
|
||||
|
||||
it("shows prompt-controlled Ultrathink state with selectable effort controls", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-opus-4-6",
|
||||
[{ id: "effort", value: "high" }],
|
||||
),
|
||||
prompt: "Ultrathink:\nInvestigate this",
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain("Reasoning");
|
||||
expect(text).not.toContain("ultrathink");
|
||||
});
|
||||
});
|
||||
|
||||
it("warns when ultrathink appears in prompt body text", async () => {
|
||||
await using _ = await mountMenu({
|
||||
modelSelection: createModelSelection(
|
||||
ProviderInstanceId.make("claudeAgent"),
|
||||
"claude-opus-4-6",
|
||||
[{ id: "effort", value: "high" }],
|
||||
),
|
||||
prompt: "Ultrathink:\nplease ultrathink about this problem",
|
||||
});
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).toContain(
|
||||
'Your prompt contains "ultrathink" in the text. Remove it to change this option.',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("can hide the interaction mode section", async () => {
|
||||
const host = document.createElement("div");
|
||||
document.body.append(host);
|
||||
const screen = await render(
|
||||
<CompactComposerControlsMenu
|
||||
activePlan={false}
|
||||
interactionMode="default"
|
||||
planSidebarLabel="Plan"
|
||||
planSidebarOpen={false}
|
||||
runtimeMode="approval-required"
|
||||
showInteractionModeToggle={false}
|
||||
onToggleInteractionMode={vi.fn()}
|
||||
onTogglePlanSidebar={vi.fn()}
|
||||
onRuntimeModeChange={vi.fn()}
|
||||
/>,
|
||||
{ container: host },
|
||||
);
|
||||
|
||||
await page.getByLabelText("More composer controls").click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
const text = document.body.textContent ?? "";
|
||||
expect(text).not.toContain("Mode");
|
||||
expect(text).not.toContain("Chat");
|
||||
expect(text).not.toContain("Plan");
|
||||
expect(text).toContain("Access");
|
||||
expect(text).toContain("Supervised");
|
||||
expect(text).toContain("Full access");
|
||||
});
|
||||
|
||||
await screen.unmount();
|
||||
host.remove();
|
||||
});
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import { ComposerPendingReviewComments } from "./ComposerPendingReviewComments";
|
||||
|
||||
describe("ComposerPendingReviewComments", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("renders a removable file comment pill", async () => {
|
||||
const onRemove = vi.fn();
|
||||
const screen = await render(
|
||||
<ComposerPendingReviewComments
|
||||
comments={[
|
||||
{
|
||||
id: "comment-1",
|
||||
sectionId: "file:src/app.ts",
|
||||
sectionTitle: "File comment",
|
||||
filePath: "src/app.ts",
|
||||
startIndex: 1,
|
||||
endIndex: 2,
|
||||
rangeLabel: "L2 to L3",
|
||||
text: "Keep this configurable.",
|
||||
diff: "@@ -2,2 +2,2 @@\n two\n three",
|
||||
},
|
||||
]}
|
||||
onRemove={onRemove}
|
||||
/>,
|
||||
);
|
||||
|
||||
await expect.element(page.getByText("src/app.ts L2 to L3")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Remove comment on src/app.ts L2 to L3" }).click();
|
||||
expect(onRemove).toHaveBeenCalledWith("comment-1");
|
||||
|
||||
await screen.unmount();
|
||||
});
|
||||
});
|
||||
@@ -1,481 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { EnvironmentId } from "@t3tools/contracts";
|
||||
import { createRef } from "react";
|
||||
import type { LegendListRef } from "@legendapp/list/react";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
const scrollToEndSpy = vi.fn();
|
||||
const getStateSpy = vi.fn(() => ({ isAtEnd: true }));
|
||||
|
||||
vi.mock("@legendapp/list/react", async () => {
|
||||
const React = await import("react");
|
||||
|
||||
function LegendList(props: {
|
||||
data: Array<{ id: string }>;
|
||||
keyExtractor: (item: { id: string }) => string;
|
||||
renderItem: (args: { item: { id: string } }) => React.ReactNode;
|
||||
ListHeaderComponent?: React.ReactNode;
|
||||
ListFooterComponent?: React.ReactNode;
|
||||
ref?: React.Ref<LegendListRef>;
|
||||
}) {
|
||||
React.useImperativeHandle(
|
||||
props.ref,
|
||||
() =>
|
||||
({
|
||||
scrollToEnd: scrollToEndSpy,
|
||||
getState: getStateSpy,
|
||||
}) as unknown as LegendListRef,
|
||||
);
|
||||
|
||||
return (
|
||||
<div data-testid="legend-list">
|
||||
{props.ListHeaderComponent}
|
||||
{props.data.map((item) => (
|
||||
<div key={props.keyExtractor(item)}>{props.renderItem({ item })}</div>
|
||||
))}
|
||||
{props.ListFooterComponent}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return { LegendList };
|
||||
});
|
||||
|
||||
import { MessagesTimeline } from "./MessagesTimeline";
|
||||
|
||||
const MESSAGE_CREATED_AT = "2026-04-13T12:00:00.000Z";
|
||||
|
||||
function buildProps() {
|
||||
return {
|
||||
isWorking: false,
|
||||
activeTurnInProgress: false,
|
||||
activeTurnStartedAt: null,
|
||||
listRef: createRef<LegendListRef | null>(),
|
||||
latestTurn: null,
|
||||
turnDiffSummaryByAssistantMessageId: new Map(),
|
||||
routeThreadKey: "environment-local:thread-1",
|
||||
onOpenTurnDiff: vi.fn(),
|
||||
revertTurnCountByUserMessageId: new Map(),
|
||||
onRevertUserMessage: vi.fn(),
|
||||
isRevertingCheckpoint: false,
|
||||
onImageExpand: vi.fn(),
|
||||
activeThreadEnvironmentId: EnvironmentId.make("environment-local"),
|
||||
markdownCwd: undefined,
|
||||
resolvedTheme: "dark" as const,
|
||||
timestampFormat: "24-hour" as const,
|
||||
workspaceRoot: undefined,
|
||||
onIsAtEndChange: vi.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
function buildLongUserMessageText(tail = "deep hidden detail only after expand") {
|
||||
return Array.from({ length: 9 }, (_, index) =>
|
||||
index === 8 ? tail : `Line ${index + 1}: ${"verbose prompt content ".repeat(8).trim()}`,
|
||||
).join("\n");
|
||||
}
|
||||
|
||||
function buildUserTimelineEntry(text: string) {
|
||||
return {
|
||||
id: "entry-1",
|
||||
kind: "message" as const,
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
message: {
|
||||
id: "message-1" as never,
|
||||
role: "user" as const,
|
||||
text,
|
||||
turnId: null,
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
updatedAt: MESSAGE_CREATED_AT,
|
||||
streaming: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function buildAssistantTimelineEntry(text: string) {
|
||||
return {
|
||||
id: "entry-assistant-1",
|
||||
kind: "message" as const,
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
message: {
|
||||
id: "message-assistant-1" as never,
|
||||
role: "assistant" as const,
|
||||
text,
|
||||
turnId: null,
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
updatedAt: MESSAGE_CREATED_AT,
|
||||
streaming: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("MessagesTimeline", () => {
|
||||
afterEach(() => {
|
||||
scrollToEndSpy.mockReset();
|
||||
getStateSpy.mockClear();
|
||||
vi.restoreAllMocks();
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("renders activity rows instead of the empty placeholder when a thread has non-message timeline data", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[
|
||||
{
|
||||
id: "work-1",
|
||||
kind: "work",
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
entry: {
|
||||
id: "work-1",
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
label: "read files",
|
||||
detail: "Inspecting repository state",
|
||||
tone: "tool",
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await expect
|
||||
.element(page.getByText("Send a message to start the conversation."))
|
||||
.not.toBeInTheDocument();
|
||||
await expect.element(page.getByText("Inspecting repository state")).toBeVisible();
|
||||
expect(document.querySelector('[data-testid="legend-list"] [title]')).toBeNull();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("uses accessible expansion instead of native titles or preview tooltips for work entry details", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
workspaceRoot="/repo"
|
||||
timelineEntries={[
|
||||
{
|
||||
id: "work-command",
|
||||
kind: "work",
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
entry: {
|
||||
id: "work-command",
|
||||
createdAt: MESSAGE_CREATED_AT,
|
||||
label: "command",
|
||||
detail: "Inspecting generated output",
|
||||
command: "git diff -- apps/web/src/components/ChatMarkdown.tsx",
|
||||
rawCommand: "git diff -- apps/web/src/components/ChatMarkdown.tsx --stat",
|
||||
changedFiles: ["/repo/apps/web/src/components/ChatMarkdown.tsx"],
|
||||
tone: "tool",
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
expect(document.querySelector('[data-testid="legend-list"] [title]')).toBeNull();
|
||||
|
||||
const commandTrigger = page.getByLabelText(
|
||||
"Command - git diff -- apps/web/src/components/ChatMarkdown.tsx",
|
||||
);
|
||||
await commandTrigger.hover();
|
||||
expect(document.querySelector('[data-slot="tooltip-popup"]')).toBeNull();
|
||||
|
||||
await commandTrigger.click();
|
||||
await expect
|
||||
.element(page.getByText("git diff -- apps/web/src/components/ChatMarkdown.tsx --stat"))
|
||||
.toBeVisible();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("snaps to the bottom when timeline rows appear after an initially empty render", async () => {
|
||||
const requestAnimationFrameSpy = vi
|
||||
.spyOn(window, "requestAnimationFrame")
|
||||
.mockImplementation((callback: FrameRequestCallback) => {
|
||||
callback(0);
|
||||
return 1;
|
||||
});
|
||||
vi.spyOn(window, "cancelAnimationFrame").mockImplementation(() => undefined);
|
||||
|
||||
const props = buildProps();
|
||||
const screen = await render(<MessagesTimeline {...props} timelineEntries={[]} />);
|
||||
|
||||
try {
|
||||
await expect
|
||||
.element(page.getByText("Send a message to start the conversation."))
|
||||
.toBeVisible();
|
||||
|
||||
await screen.rerender(
|
||||
<MessagesTimeline
|
||||
{...props}
|
||||
timelineEntries={[
|
||||
{
|
||||
id: "work-1",
|
||||
kind: "work",
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
entry: {
|
||||
id: "work-1",
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
label: "read files",
|
||||
detail: "Inspecting repository state",
|
||||
tone: "tool",
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
await expect.element(page.getByText("Inspecting repository state")).toBeVisible();
|
||||
expect(props.onIsAtEndChange).toHaveBeenCalledWith(true);
|
||||
expect(scrollToEndSpy).toHaveBeenCalledWith({ animated: false });
|
||||
expect(requestAnimationFrameSpy).toHaveBeenCalled();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("starts long user messages collapsed by default", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[buildUserTimelineEntry(buildLongUserMessageText())]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const toggle = page.getByRole("button", { name: "Show full message" });
|
||||
await expect.element(toggle).toBeVisible();
|
||||
await expect.element(toggle).toHaveAttribute("aria-expanded", "false");
|
||||
|
||||
const messageBody = document.querySelector(
|
||||
"[data-user-message-body='true']",
|
||||
) as HTMLDivElement | null;
|
||||
expect(messageBody?.getAttribute("data-user-message-collapsed")).toBe("true");
|
||||
expect(messageBody?.className).toContain("max-h-44");
|
||||
expect(messageBody?.className).toContain("overflow-hidden");
|
||||
expect(messageBody?.getAttribute("data-user-message-fade")).toBe("true");
|
||||
expect(messageBody?.style.maskImage).toContain("linear-gradient");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("expands and re-collapses long user messages from the toggle", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[buildUserTimelineEntry(buildLongUserMessageText())]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const expandButton = page.getByRole("button", { name: "Show full message" });
|
||||
await expect.element(expandButton).toBeVisible();
|
||||
|
||||
expect(document.body.textContent ?? "").toContain("deep hidden detail only after expand");
|
||||
|
||||
await expandButton.click();
|
||||
|
||||
const collapseButton = page.getByRole("button", { name: "Show less" });
|
||||
await expect.element(collapseButton).toBeVisible();
|
||||
await expect.element(collapseButton).toHaveAttribute("aria-expanded", "true");
|
||||
|
||||
let messageBody = document.querySelector("[data-user-message-body='true']");
|
||||
expect(messageBody?.getAttribute("data-user-message-collapsed")).toBe("false");
|
||||
expect(messageBody?.className).not.toContain("max-h-44");
|
||||
expect(messageBody?.getAttribute("data-user-message-fade")).toBe("false");
|
||||
expect((messageBody as HTMLDivElement | null)?.style.maskImage ?? "").toBe("");
|
||||
|
||||
await collapseButton.click();
|
||||
|
||||
await expect.element(page.getByRole("button", { name: "Show full message" })).toBeVisible();
|
||||
messageBody = document.querySelector("[data-user-message-body='true']");
|
||||
expect(messageBody?.getAttribute("data-user-message-collapsed")).toBe("true");
|
||||
expect(messageBody?.className).toContain("max-h-44");
|
||||
expect(messageBody?.getAttribute("data-user-message-fade")).toBe("true");
|
||||
expect((messageBody as HTMLDivElement | null)?.style.maskImage).toContain("linear-gradient");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("starts the newest long user prompt collapsed", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[buildUserTimelineEntry(buildLongUserMessageText("latest long prompt"))]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await expect.element(page.getByRole("button", { name: "Show full message" })).toBeVisible();
|
||||
|
||||
const messageBody = document.querySelector("[data-user-message-body='true']");
|
||||
expect(messageBody?.getAttribute("data-user-message-collapsed")).toBe("true");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("renders user messages as markdown with chat-style line breaks", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[
|
||||
buildUserTimelineEntry(
|
||||
"## Plan\nuse **bold** and [a link](https://example.com)\nsecond line",
|
||||
),
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
await expect.element(page.getByRole("heading", { level: 2, name: "Plan" })).toBeVisible();
|
||||
await expect
|
||||
.element(page.getByRole("link", { name: "a link" }))
|
||||
.toHaveAttribute("href", "https://example.com");
|
||||
|
||||
const messageBody = document.querySelector("[data-user-message-body='true']");
|
||||
expect(messageBody?.querySelector("strong")?.textContent).toBe("bold");
|
||||
// remark-breaks: the single newline between the inline runs is a <br>.
|
||||
expect(messageBody?.querySelectorAll("p br").length).toBe(1);
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("renders markdown file tags in user and assistant messages", async () => {
|
||||
const fileLink = "[package.json](path/to/package.json)";
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
markdownCwd="/repo/project"
|
||||
timelineEntries={[
|
||||
buildUserTimelineEntry(`Review ${fileLink}`),
|
||||
buildAssistantTimelineEntry(`I reviewed ${fileLink}`),
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const userFileLink = document.querySelector(
|
||||
'[data-message-role="user"] .chat-markdown-file-link',
|
||||
);
|
||||
const assistantFileLink = document.querySelector(
|
||||
'[data-message-role="assistant"] .chat-markdown-file-link',
|
||||
);
|
||||
|
||||
expect(userFileLink?.textContent).toContain("package.json");
|
||||
expect(userFileLink?.getAttribute("href")).toBe("/repo/project/path/to/package.json");
|
||||
expect(assistantFileLink?.textContent).toContain("package.json");
|
||||
expect(assistantFileLink?.getAttribute("href")).toBe("/repo/project/path/to/package.json");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("uses the file path without line suffix for markdown file tag icons", async () => {
|
||||
const fileLink = "[package.json](path/to/package.json:25)";
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
markdownCwd="/repo/project"
|
||||
timelineEntries={[buildAssistantTimelineEntry(`Updated ${fileLink}`)]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const assistantFileLink = document.querySelector(
|
||||
'[data-message-role="assistant"] .chat-markdown-file-link',
|
||||
);
|
||||
const icon = assistantFileLink?.querySelector("svg[data-pierre-icon]");
|
||||
|
||||
expect(assistantFileLink?.textContent).toContain("package.json");
|
||||
expect(assistantFileLink?.textContent).toContain("L25");
|
||||
expect(assistantFileLink?.getAttribute("href")).toBe("/repo/project/path/to/package.json:25");
|
||||
expect(icon?.getAttribute("data-pierre-icon")).toBe("t3-file-icon-package-json");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("folds settled-turn work behind a Worked-for row and expands it on click", async () => {
|
||||
const screen = await render(
|
||||
<MessagesTimeline
|
||||
{...buildProps()}
|
||||
timelineEntries={[
|
||||
{
|
||||
id: "entry-commentary",
|
||||
kind: "message" as const,
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
message: {
|
||||
id: "message-commentary" as never,
|
||||
role: "assistant" as const,
|
||||
text: "Let me look around first.",
|
||||
turnId: "turn-1" as never,
|
||||
createdAt: "2026-04-13T12:00:00.000Z",
|
||||
updatedAt: "2026-04-13T12:00:02.000Z",
|
||||
streaming: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "entry-work",
|
||||
kind: "work" as const,
|
||||
createdAt: "2026-04-13T12:00:05.000Z",
|
||||
entry: {
|
||||
id: "work-1",
|
||||
createdAt: "2026-04-13T12:00:05.000Z",
|
||||
turnId: "turn-1" as never,
|
||||
label: "read files",
|
||||
detail: "Inspecting repository state",
|
||||
tone: "tool" as const,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "entry-final",
|
||||
kind: "message" as const,
|
||||
createdAt: "2026-04-13T12:00:20.000Z",
|
||||
message: {
|
||||
id: "message-final" as never,
|
||||
role: "assistant" as const,
|
||||
text: "All done.",
|
||||
turnId: "turn-1" as never,
|
||||
createdAt: "2026-04-13T12:00:20.000Z",
|
||||
updatedAt: "2026-04-13T12:00:30.000Z",
|
||||
streaming: false,
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
|
||||
try {
|
||||
const foldButton = page.getByRole("button", { name: "Worked for 30s" });
|
||||
await expect.element(foldButton).toBeVisible();
|
||||
await expect.element(foldButton).toHaveAttribute("aria-expanded", "false");
|
||||
|
||||
expect(document.body.textContent).toContain("All done.");
|
||||
expect(document.body.textContent).not.toContain("Let me look around first.");
|
||||
expect(document.body.textContent).not.toContain("Inspecting repository state");
|
||||
|
||||
await foldButton.click();
|
||||
|
||||
await expect.element(foldButton).toHaveAttribute("aria-expanded", "true");
|
||||
expect(document.body.textContent).toContain("Let me look around first.");
|
||||
expect(document.body.textContent).toContain("Inspecting repository state");
|
||||
|
||||
await foldButton.click();
|
||||
|
||||
await expect.element(foldButton).toHaveAttribute("aria-expanded", "false");
|
||||
expect(document.body.textContent).not.toContain("Inspecting repository state");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,71 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { page, userEvent } from "vite-plus/test/browser";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import type { DesktopCloudAuthOAuthOption } from "../../cloud/desktopAuth";
|
||||
import { DesktopClerkSignInCard } from "./DesktopClerkSignIn";
|
||||
|
||||
const GOOGLE: DesktopCloudAuthOAuthOption = {
|
||||
strategy: "oauth_google",
|
||||
label: "Google",
|
||||
providerId: "google",
|
||||
iconUrl: null,
|
||||
};
|
||||
|
||||
const PROVIDERS: readonly DesktopCloudAuthOAuthOption[] = [
|
||||
{
|
||||
strategy: "oauth_apple",
|
||||
label: "Apple",
|
||||
providerId: "apple",
|
||||
iconUrl: null,
|
||||
},
|
||||
GOOGLE,
|
||||
{
|
||||
strategy: "oauth_microsoft",
|
||||
label: "Microsoft",
|
||||
providerId: "microsoft",
|
||||
iconUrl: null,
|
||||
},
|
||||
];
|
||||
|
||||
describe("DesktopClerkSignInCard", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("uses Clerk's compact provider grid when more than two providers are enabled", async () => {
|
||||
await render(
|
||||
<DesktopClerkSignInCard
|
||||
isStarting={false}
|
||||
oauthOptions={PROVIDERS}
|
||||
startingStrategy={null}
|
||||
onJoinWaitlist={vi.fn()}
|
||||
onStartOAuth={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(document.querySelectorAll('button[aria-label^="Continue with "]')).toHaveLength(3);
|
||||
expect(document.body.textContent).toContain("Want early access?");
|
||||
expect(document.body.textContent).not.toContain("Continue with Google");
|
||||
});
|
||||
|
||||
it("renders a full provider label and starts OAuth for a single provider", async () => {
|
||||
const onStartOAuth = vi.fn();
|
||||
await render(
|
||||
<DesktopClerkSignInCard
|
||||
isStarting={false}
|
||||
oauthOptions={[GOOGLE]}
|
||||
startingStrategy={null}
|
||||
onJoinWaitlist={vi.fn()}
|
||||
onStartOAuth={onStartOAuth}
|
||||
/>,
|
||||
);
|
||||
|
||||
await userEvent.click(page.getByRole("button", { name: "Continue with Google" }));
|
||||
|
||||
expect(document.body.textContent).toContain("Continue with Google");
|
||||
expect(onStartOAuth).toHaveBeenCalledWith("oauth_google");
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { beforeEach, describe, expect, it } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import {
|
||||
finishRelayClientInstall,
|
||||
readRelayClientInstallDialogState,
|
||||
reportRelayClientInstallProgress,
|
||||
requestRelayClientInstallConfirmation,
|
||||
resetRelayClientInstallDialogForTests,
|
||||
} from "../../cloud/relayClientInstallDialog";
|
||||
import { RelayClientInstallDialog } from "./RelayClientInstallDialog";
|
||||
|
||||
describe("RelayClientInstallDialog", () => {
|
||||
beforeEach(() => {
|
||||
resetRelayClientInstallDialogForTests();
|
||||
});
|
||||
|
||||
it("confirms installation and renders streamed progress", async () => {
|
||||
render(<RelayClientInstallDialog />);
|
||||
const confirmation = requestRelayClientInstallConfirmation("2026.5.2");
|
||||
|
||||
await expect.element(page.getByText("Install relay client?")).toBeInTheDocument();
|
||||
await expect.element(page.getByText(/version 2026\.5\.2 locally/)).toBeInTheDocument();
|
||||
|
||||
await page.getByRole("button", { name: "Download and install" }).click();
|
||||
await expect(confirmation).resolves.toBe(true);
|
||||
await expect
|
||||
.element(page.getByRole("heading", { name: "Installing relay client" }))
|
||||
.toBeInTheDocument();
|
||||
|
||||
reportRelayClientInstallProgress({ type: "progress", stage: "downloading" });
|
||||
await expect.element(page.getByText("Downloading relay client")).toBeInTheDocument();
|
||||
await expect
|
||||
.element(page.getByRole("progressbar", { name: "Relay client installation progress" }))
|
||||
.toHaveAttribute("value", "3");
|
||||
|
||||
finishRelayClientInstall();
|
||||
expect(readRelayClientInstallDialogState().status).toBe("closing");
|
||||
await expect
|
||||
.element(page.getByRole("heading", { name: "Installing relay client" }))
|
||||
.not.toBeInTheDocument();
|
||||
expect(readRelayClientInstallDialogState()).toEqual({ status: "idle" });
|
||||
});
|
||||
});
|
||||
@@ -1,122 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
|
||||
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
|
||||
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import { useComposerDraftStore } from "~/composerDraftStore";
|
||||
|
||||
import { AnnotatableFileDiff } from "./AnnotatableFileDiff";
|
||||
|
||||
function dispatchPointer(target: EventTarget, type: string, pointerId: number): void {
|
||||
target.dispatchEvent(
|
||||
new PointerEvent(type, {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
composed: true,
|
||||
pointerId,
|
||||
pointerType: "mouse",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const threadRef = scopeThreadRef(EnvironmentId.make("local"), ThreadId.make("thread-1"));
|
||||
|
||||
function TestDiff() {
|
||||
const fileDiff = parsePatchFiles(
|
||||
[
|
||||
"diff --git a/src/app.ts b/src/app.ts",
|
||||
"--- a/src/app.ts",
|
||||
"+++ b/src/app.ts",
|
||||
"@@ -1,3 +1,3 @@",
|
||||
" one",
|
||||
"-two",
|
||||
"+TWO",
|
||||
" three",
|
||||
].join("\n"),
|
||||
"annotatable-file-diff-test",
|
||||
)[0]!.files[0]!;
|
||||
|
||||
return (
|
||||
<AnnotatableFileDiff
|
||||
fileDiff={fileDiff}
|
||||
filePath="src/app.ts"
|
||||
sectionId="turn:2"
|
||||
sectionTitle="Turn 2"
|
||||
composerDraftTarget={threadRef}
|
||||
renderHeaderPrefix={() => null}
|
||||
options={{
|
||||
diffStyle: "unified",
|
||||
lineDiffType: "none",
|
||||
themeType: "light",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
async function getRenderedDiff() {
|
||||
return vi.waitFor(() => {
|
||||
const element = document.querySelector<HTMLElement>("diffs-container");
|
||||
expect(element?.shadowRoot).not.toBeNull();
|
||||
return element!;
|
||||
});
|
||||
}
|
||||
|
||||
describe("annotatable Pierre file diff", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
useComposerDraftStore.getState().setReviewComments(threadRef, []);
|
||||
});
|
||||
|
||||
it("creates a local annotation from the gutter and attaches it to the composer", async () => {
|
||||
let screen = await render(<TestDiff />);
|
||||
|
||||
try {
|
||||
const diff = await getRenderedDiff();
|
||||
const addedLineNumber = await vi.waitFor(() => {
|
||||
const elements = Array.from(
|
||||
diff.shadowRoot?.querySelectorAll<HTMLElement>('[data-column-number="2"]') ?? [],
|
||||
);
|
||||
const element = elements.at(-1) ?? null;
|
||||
expect(element).not.toBeNull();
|
||||
return element!;
|
||||
});
|
||||
|
||||
dispatchPointer(addedLineNumber, "pointerdown", 1);
|
||||
dispatchPointer(addedLineNumber, "pointerup", 1);
|
||||
|
||||
const textarea = page.getByRole("textbox", { name: "Comment on lines +2" });
|
||||
await expect.element(textarea).toBeVisible();
|
||||
await textarea.fill("Use the compatible value.");
|
||||
await page.getByRole("button", { name: "Comment" }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(
|
||||
useComposerDraftStore.getState().getComposerDraft(threadRef)?.reviewComments,
|
||||
).toEqual([
|
||||
expect.objectContaining({
|
||||
sectionId: "turn:2",
|
||||
filePath: "src/app.ts",
|
||||
rangeLabel: "+2",
|
||||
text: "Use the compatible value.",
|
||||
diff: "@@ -0,0 +2,1 @@\n+TWO",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
expect(document.querySelector("[data-file-comment-annotation]")?.textContent).toContain(
|
||||
"Use the compatible value.",
|
||||
);
|
||||
|
||||
await screen.unmount();
|
||||
screen = await render(<TestDiff />);
|
||||
await expect
|
||||
.element(page.getByText("Use the compatible value.", { exact: true }))
|
||||
.toBeVisible();
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,168 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import type { LineAnnotation, SelectedLineRange } from "@pierre/diffs";
|
||||
import { Editor } from "@pierre/diffs/editor";
|
||||
import { EditorProvider, File } from "@pierre/diffs/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { render } from "vitest-browser-react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { installFileEditorDismissal } from "./fileEditorDismissal";
|
||||
|
||||
interface AnnotationMetadata {
|
||||
label: string;
|
||||
}
|
||||
|
||||
function dispatchPointer(target: EventTarget, type: string, pointerId: number): void {
|
||||
target.dispatchEvent(
|
||||
new PointerEvent(type, {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
composed: true,
|
||||
pointerId,
|
||||
pointerType: "mouse",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function EditableAnnotatedFile() {
|
||||
const [selectedLines, setSelectedLines] = useState<SelectedLineRange | null>(null);
|
||||
const [lineAnnotations, setLineAnnotations] = useState<LineAnnotation<AnnotationMetadata>[]>([]);
|
||||
const rootRef = useRef<HTMLDivElement>(null);
|
||||
const editor = useMemo(() => new Editor<AnnotationMetadata>(), []);
|
||||
|
||||
useEffect(() => () => editor.cleanUp(), [editor]);
|
||||
useEffect(() => {
|
||||
const root = rootRef.current;
|
||||
if (!root) return;
|
||||
return installFileEditorDismissal({
|
||||
root,
|
||||
editor,
|
||||
isBlocked: () => false,
|
||||
onDismiss: () => setSelectedLines(null),
|
||||
});
|
||||
}, [editor]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={rootRef}>
|
||||
<EditorProvider editor={editor}>
|
||||
<File<AnnotationMetadata>
|
||||
file={{ name: "example.ts", contents: "one\ntwo\nthree\n" }}
|
||||
options={{
|
||||
disableFileHeader: true,
|
||||
enableGutterUtility: true,
|
||||
enableLineSelection: true,
|
||||
onGutterUtilityClick: setSelectedLines,
|
||||
onLineSelectionChange: setSelectedLines,
|
||||
onLineSelectionEnd: (range) => {
|
||||
setSelectedLines(range);
|
||||
if (range) {
|
||||
setLineAnnotations([
|
||||
{
|
||||
lineNumber: Math.max(range.start, range.end),
|
||||
metadata: { label: `${range.start}:${range.end}` },
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
}}
|
||||
selectedLines={selectedLines}
|
||||
lineAnnotations={lineAnnotations}
|
||||
renderAnnotation={(annotation) => (
|
||||
<div data-test-file-annotation contentEditable={false}>
|
||||
{annotation.metadata.label}
|
||||
</div>
|
||||
)}
|
||||
disableWorkerPool
|
||||
contentEditable
|
||||
/>
|
||||
</EditorProvider>
|
||||
</div>
|
||||
<button type="button">Outside file</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function getEditableFile() {
|
||||
const file = await vi.waitFor(() => {
|
||||
const element = document.querySelector<HTMLElement>("diffs-container");
|
||||
expect(element?.shadowRoot).not.toBeNull();
|
||||
return element!;
|
||||
});
|
||||
const content = await vi.waitFor(() => {
|
||||
const element = file?.shadowRoot?.querySelector<HTMLElement>("[data-content]") ?? null;
|
||||
expect(element).not.toBeNull();
|
||||
return element!;
|
||||
});
|
||||
return { file, content };
|
||||
}
|
||||
|
||||
describe("editable Pierre file annotations", () => {
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("keeps gutter selection and annotations enabled while the file is editable", async () => {
|
||||
const screen = await render(<EditableAnnotatedFile />);
|
||||
|
||||
try {
|
||||
const { file, content } = await getEditableFile();
|
||||
const secondLineNumber = await vi.waitFor(() => {
|
||||
const element =
|
||||
file?.shadowRoot?.querySelector<HTMLElement>('[data-column-number="2"]') ?? null;
|
||||
expect(element).not.toBeNull();
|
||||
return element;
|
||||
});
|
||||
await vi.waitFor(() => {
|
||||
expect(
|
||||
file?.shadowRoot?.querySelector("pre")?.hasAttribute("data-interactive-line-numbers"),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
dispatchPointer(secondLineNumber!, "pointerdown", 1);
|
||||
dispatchPointer(secondLineNumber!, "pointerup", 1);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(document.querySelector("[data-test-file-annotation]")?.textContent).toBe("2:2");
|
||||
});
|
||||
|
||||
expect(content.contentEditable).toBe("true");
|
||||
expect(content.getAttribute("role")).toBe("textbox");
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("dismisses editor focus and selection with outside click or Escape", async () => {
|
||||
const screen = await render(<EditableAnnotatedFile />);
|
||||
|
||||
try {
|
||||
const { file, content } = await getEditableFile();
|
||||
content.focus();
|
||||
expect(file?.shadowRoot?.activeElement).toBe(content);
|
||||
|
||||
await page.getByRole("button", { name: "Outside file" }).click();
|
||||
await vi.waitFor(() => {
|
||||
expect(file?.shadowRoot?.activeElement).not.toBe(content);
|
||||
});
|
||||
|
||||
content.focus();
|
||||
expect(file?.shadowRoot?.activeElement).toBe(content);
|
||||
content.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
key: "Escape",
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
composed: true,
|
||||
}),
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
expect(file?.shadowRoot?.activeElement).not.toBe(content);
|
||||
});
|
||||
} finally {
|
||||
await screen.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,85 +0,0 @@
|
||||
import "../../index.css";
|
||||
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
import { render } from "vitest-browser-react";
|
||||
|
||||
import { PreviewChromeRow } from "./PreviewChromeRow";
|
||||
|
||||
const defaultProps = {
|
||||
url: "https://example.com/",
|
||||
loading: false,
|
||||
loadProgress: 0,
|
||||
canGoBack: false,
|
||||
canGoForward: false,
|
||||
refreshDisabled: false,
|
||||
onBack: vi.fn(),
|
||||
onForward: vi.fn(),
|
||||
onRefresh: vi.fn(),
|
||||
onSubmit: vi.fn(),
|
||||
};
|
||||
|
||||
describe("PreviewChromeRow", () => {
|
||||
it("uses the shared compact surface subheader treatment", async () => {
|
||||
const screen = await render(<PreviewChromeRow {...defaultProps} />);
|
||||
const subheader = screen.container.querySelector<HTMLElement>("[data-surface-subheader]");
|
||||
|
||||
expect(subheader).not.toBeNull();
|
||||
expect(subheader?.getBoundingClientRect().height).toBe(40);
|
||||
expect(window.getComputedStyle(subheader!).borderTopWidth).toBe("0px");
|
||||
expect(window.getComputedStyle(subheader!).borderBottomWidth).toBe("1px");
|
||||
});
|
||||
|
||||
it("only focuses the URL input after an explicit focus request", async () => {
|
||||
const previouslyFocused = document.createElement("button");
|
||||
document.body.append(previouslyFocused);
|
||||
previouslyFocused.focus();
|
||||
|
||||
const screen = await render(<PreviewChromeRow {...defaultProps} focusUrlNonce={undefined} />);
|
||||
const input = page.getByRole("textbox").element() as HTMLInputElement;
|
||||
|
||||
expect(document.activeElement).toBe(previouslyFocused);
|
||||
|
||||
await screen.rerender(<PreviewChromeRow {...defaultProps} focusUrlNonce={1} />);
|
||||
|
||||
expect(document.activeElement).toBe(input);
|
||||
expect(input.selectionStart).toBe(0);
|
||||
expect(input.selectionEnd).toBe(input.value.length);
|
||||
|
||||
previouslyFocused.remove();
|
||||
});
|
||||
|
||||
it("shows a friendly asset label until the URL input receives focus", async () => {
|
||||
const fullUrl = "http://127.0.0.1:3773/api/assets/token/report.pdf";
|
||||
await render(
|
||||
<PreviewChromeRow
|
||||
{...defaultProps}
|
||||
url={fullUrl}
|
||||
displayUrl="Local environment · report.pdf"
|
||||
/>,
|
||||
);
|
||||
const input = page.getByRole("textbox");
|
||||
|
||||
await expect.element(input).toHaveValue("Local environment · report.pdf");
|
||||
|
||||
await input.click();
|
||||
|
||||
await expect.element(input).toHaveValue(fullUrl);
|
||||
|
||||
input.element().dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
||||
|
||||
await expect.element(input).toHaveValue("Local environment · report.pdf");
|
||||
});
|
||||
|
||||
it("shows only the host for regular URLs until the input receives focus", async () => {
|
||||
const fullUrl = "https://t3.chat/chat/18378834-f776-4507-ada7-6f79";
|
||||
await render(<PreviewChromeRow {...defaultProps} url={fullUrl} displayUrl="t3.chat" />);
|
||||
const input = page.getByRole("textbox");
|
||||
|
||||
await expect.element(input).toHaveValue("t3.chat");
|
||||
|
||||
await input.click();
|
||||
|
||||
await expect.element(input).toHaveValue(fullUrl);
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,103 +0,0 @@
|
||||
import {
|
||||
AuthSessionId,
|
||||
EnvironmentAuthenticatedAuth,
|
||||
EnvironmentAuthenticatedPrincipal,
|
||||
EnvironmentAuthHttpApi,
|
||||
EnvironmentId,
|
||||
EnvironmentMetadataHttpApi,
|
||||
type AuthEnvironmentScope,
|
||||
type ExecutionEnvironmentDescriptor,
|
||||
type ServerAuthDescriptor,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import { HttpRouter, HttpServer } from "effect/unstable/http";
|
||||
import * as HttpApi from "effect/unstable/httpapi/HttpApi";
|
||||
import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
|
||||
import { http } from "msw";
|
||||
|
||||
const BrowserEnvironmentHttpApi = HttpApi.make("browserEnvironment")
|
||||
.add(EnvironmentMetadataHttpApi)
|
||||
.add(EnvironmentAuthHttpApi);
|
||||
|
||||
const TEST_SESSION_EXPIRES_AT = DateTime.makeUnsafe("2026-05-01T12:00:00.000Z");
|
||||
const TEST_ENVIRONMENT_DESCRIPTOR: ExecutionEnvironmentDescriptor = {
|
||||
environmentId: EnvironmentId.make("environment-local"),
|
||||
label: "Local environment",
|
||||
platform: {
|
||||
os: "darwin",
|
||||
arch: "arm64",
|
||||
},
|
||||
serverVersion: "0.0.0-test",
|
||||
capabilities: {
|
||||
repositoryIdentity: true,
|
||||
},
|
||||
};
|
||||
|
||||
const unexpectedEndpoint = (endpoint: string) =>
|
||||
Effect.die(new Error(`Unexpected browser environment HTTP endpoint: ${endpoint}`));
|
||||
|
||||
export function createAuthenticatedSessionHandlers(getAuthDescriptor: () => ServerAuthDescriptor) {
|
||||
const authenticatedAuthLayer = Layer.succeed(EnvironmentAuthenticatedAuth, (httpEffect) =>
|
||||
httpEffect.pipe(
|
||||
Effect.provideService(EnvironmentAuthenticatedPrincipal, {
|
||||
sessionId: AuthSessionId.make("browser-session"),
|
||||
subject: "browser-client",
|
||||
method: "browser-session-cookie",
|
||||
scopes: new Set<AuthEnvironmentScope>(),
|
||||
expiresAt: TEST_SESSION_EXPIRES_AT,
|
||||
}),
|
||||
),
|
||||
);
|
||||
const metadataLayer = HttpApiBuilder.group(BrowserEnvironmentHttpApi, "metadata", (handlers) =>
|
||||
handlers.handle("descriptor", () => Effect.succeed(TEST_ENVIRONMENT_DESCRIPTOR)),
|
||||
);
|
||||
const authLayer = HttpApiBuilder.group(BrowserEnvironmentHttpApi, "auth", (handlers) =>
|
||||
handlers
|
||||
.handle("session", () =>
|
||||
Effect.succeed({
|
||||
authenticated: true,
|
||||
auth: getAuthDescriptor(),
|
||||
sessionMethod: "browser-session-cookie",
|
||||
expiresAt: TEST_SESSION_EXPIRES_AT,
|
||||
}),
|
||||
)
|
||||
.handle("browserSession", () =>
|
||||
Effect.succeed({
|
||||
authenticated: true,
|
||||
scopes: [
|
||||
"orchestration:read",
|
||||
"orchestration:operate",
|
||||
"terminal:operate",
|
||||
"review:write",
|
||||
"relay:read",
|
||||
],
|
||||
sessionMethod: "browser-session-cookie",
|
||||
expiresAt: TEST_SESSION_EXPIRES_AT,
|
||||
}),
|
||||
)
|
||||
.handle("token", () => unexpectedEndpoint("auth.token"))
|
||||
.handle("webSocketTicket", () => unexpectedEndpoint("auth.webSocketTicket"))
|
||||
.handle("pairingCredential", () => unexpectedEndpoint("auth.pairingCredential"))
|
||||
.handle("pairingLinks", () => unexpectedEndpoint("auth.pairingLinks"))
|
||||
.handle("revokePairingLink", () => unexpectedEndpoint("auth.revokePairingLink"))
|
||||
.handle("clients", () => unexpectedEndpoint("auth.clients"))
|
||||
.handle("revokeClient", () => unexpectedEndpoint("auth.revokeClient"))
|
||||
.handle("revokeOtherClients", () => unexpectedEndpoint("auth.revokeOtherClients")),
|
||||
).pipe(Layer.provide(authenticatedAuthLayer));
|
||||
const { handler } = HttpRouter.toWebHandler(
|
||||
HttpApiBuilder.layer(BrowserEnvironmentHttpApi).pipe(
|
||||
Layer.provide(metadataLayer),
|
||||
Layer.provide(authLayer),
|
||||
Layer.provide(authenticatedAuthLayer),
|
||||
Layer.provide(HttpServer.layerServices),
|
||||
),
|
||||
{ disableLogger: true },
|
||||
);
|
||||
|
||||
return [
|
||||
http.all("*/.well-known/t3/environment", ({ request }) => handler(request)),
|
||||
http.all("*/api/auth/*", ({ request }) => handler(request)),
|
||||
] as const;
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||
import {
|
||||
AuthSessionId,
|
||||
EnvironmentAuthenticatedAuth,
|
||||
EnvironmentAuthenticatedPrincipal,
|
||||
EnvironmentHttpApi,
|
||||
type AuthBrowserSessionRequest,
|
||||
type AuthBrowserSessionResult,
|
||||
type AuthCreatePairingCredentialInput,
|
||||
type AuthEnvironmentScope,
|
||||
type AuthPairingCredentialResult,
|
||||
type AuthSessionState,
|
||||
type ExecutionEnvironmentDescriptor,
|
||||
type EnvironmentAuthInvalidError,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import type * as Context from "effect/Context";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import { HttpApiTest } from "effect/unstable/httpapi";
|
||||
import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
|
||||
|
||||
import { PrimaryEnvironmentHttpClient } from "../src/environments/primary/httpClient";
|
||||
import { __setPrimaryHttpRunnerForTests } from "../src/lib/runtime";
|
||||
|
||||
type BrowserSessionHandler = (
|
||||
payload: AuthBrowserSessionRequest,
|
||||
) => Effect.Effect<AuthBrowserSessionResult, EnvironmentAuthInvalidError>;
|
||||
|
||||
interface EnvironmentHttpTestScenario {
|
||||
readonly descriptor?: () => Effect.Effect<ExecutionEnvironmentDescriptor>;
|
||||
readonly session?: () => Effect.Effect<AuthSessionState>;
|
||||
readonly browserSession?: BrowserSessionHandler;
|
||||
readonly pairingCredential?: (
|
||||
payload: AuthCreatePairingCredentialInput,
|
||||
) => Effect.Effect<AuthPairingCredentialResult>;
|
||||
}
|
||||
|
||||
export interface EnvironmentHttpTestCalls {
|
||||
descriptor: number;
|
||||
session: number;
|
||||
browserSession: Array<AuthBrowserSessionRequest>;
|
||||
pairingCredential: Array<AuthCreatePairingCredentialInput>;
|
||||
}
|
||||
|
||||
const unexpectedEndpoint = (endpoint: string) =>
|
||||
Effect.die(new Error(`Unexpected environment HTTP endpoint: ${endpoint}`));
|
||||
|
||||
const authenticatedAuth: Context.Service.Shape<typeof EnvironmentAuthenticatedAuth> = (
|
||||
httpEffect,
|
||||
) =>
|
||||
httpEffect.pipe(
|
||||
Effect.provideService(EnvironmentAuthenticatedPrincipal, {
|
||||
sessionId: AuthSessionId.make("test-session"),
|
||||
subject: "test-client",
|
||||
method: "browser-session-cookie",
|
||||
scopes: new Set<AuthEnvironmentScope>(),
|
||||
expiresAt: DateTime.makeUnsafe("2026-05-01T12:00:00.000Z"),
|
||||
}),
|
||||
);
|
||||
|
||||
export async function installEnvironmentHttpTest(scenario: EnvironmentHttpTestScenario) {
|
||||
const calls: EnvironmentHttpTestCalls = {
|
||||
descriptor: 0,
|
||||
session: 0,
|
||||
browserSession: [],
|
||||
pairingCredential: [],
|
||||
};
|
||||
|
||||
const client = await Effect.runPromise(
|
||||
HttpApiTest.groups(EnvironmentHttpApi, ["metadata", "auth"]).pipe(
|
||||
Effect.provide([
|
||||
NodeHttpServer.layerHttpServices,
|
||||
HttpApiBuilder.group(EnvironmentHttpApi, "metadata", (handlers) =>
|
||||
handlers.handle(
|
||||
"descriptor",
|
||||
Effect.fn("test.environment.metadata.descriptor")(function* () {
|
||||
calls.descriptor += 1;
|
||||
return yield* scenario.descriptor?.() ?? unexpectedEndpoint("metadata.descriptor");
|
||||
}),
|
||||
),
|
||||
),
|
||||
HttpApiBuilder.group(EnvironmentHttpApi, "auth", (handlers) =>
|
||||
handlers
|
||||
.handle(
|
||||
"session",
|
||||
Effect.fn("test.environment.auth.session")(function* () {
|
||||
calls.session += 1;
|
||||
return yield* scenario.session?.() ?? unexpectedEndpoint("auth.session");
|
||||
}),
|
||||
)
|
||||
.handle(
|
||||
"browserSession",
|
||||
Effect.fn("test.environment.auth.browserSession")(function* ({ payload }) {
|
||||
calls.browserSession.push(payload);
|
||||
return yield* (
|
||||
scenario.browserSession?.(payload) ?? unexpectedEndpoint("auth.browserSession")
|
||||
);
|
||||
}),
|
||||
)
|
||||
.handle("token", () => unexpectedEndpoint("auth.token"))
|
||||
.handle("webSocketTicket", () => unexpectedEndpoint("auth.webSocketTicket"))
|
||||
.handle(
|
||||
"pairingCredential",
|
||||
Effect.fn("test.environment.auth.pairingCredential")(function* ({ payload }) {
|
||||
calls.pairingCredential.push(payload);
|
||||
return yield* (
|
||||
scenario.pairingCredential?.(payload) ??
|
||||
unexpectedEndpoint("auth.pairingCredential")
|
||||
);
|
||||
}),
|
||||
)
|
||||
.handle("pairingLinks", () => unexpectedEndpoint("auth.pairingLinks"))
|
||||
.handle("revokePairingLink", () => unexpectedEndpoint("auth.revokePairingLink"))
|
||||
.handle("clients", () => unexpectedEndpoint("auth.clients"))
|
||||
.handle("revokeClient", () => unexpectedEndpoint("auth.revokeClient"))
|
||||
.handle("revokeOtherClients", () => unexpectedEndpoint("auth.revokeOtherClients")),
|
||||
),
|
||||
]),
|
||||
Effect.provideService(EnvironmentAuthenticatedAuth, authenticatedAuth),
|
||||
Effect.scoped,
|
||||
),
|
||||
);
|
||||
|
||||
const runtime = ManagedRuntime.make(Layer.succeed(PrimaryEnvironmentHttpClient, client));
|
||||
__setPrimaryHttpRunnerForTests((effect) => runtime.runPromise(effect));
|
||||
|
||||
return {
|
||||
calls,
|
||||
async dispose() {
|
||||
__setPrimaryHttpRunnerForTests();
|
||||
await runtime.dispose();
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
import { ORCHESTRATION_WS_METHODS, WS_METHODS, WsRpcGroup } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { RpcMessage, RpcSerialization, RpcServer } from "effect/unstable/rpc";
|
||||
|
||||
type RpcServerInstance = RpcServer.RpcServer<any>;
|
||||
|
||||
type BrowserWsClient = {
|
||||
send: (data: string) => void;
|
||||
};
|
||||
|
||||
export type NormalizedWsRpcRequestBody = {
|
||||
_tag: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
type UnaryResolverResult = unknown | Promise<unknown>;
|
||||
|
||||
interface BrowserWsRpcHarnessOptions {
|
||||
readonly resolveUnary?: (request: NormalizedWsRpcRequestBody) => UnaryResolverResult;
|
||||
readonly getInitialStreamValues?: (
|
||||
request: NormalizedWsRpcRequestBody,
|
||||
) => ReadonlyArray<unknown> | undefined;
|
||||
}
|
||||
|
||||
const STREAM_METHODS = new Set<string>([
|
||||
ORCHESTRATION_WS_METHODS.subscribeShell,
|
||||
ORCHESTRATION_WS_METHODS.subscribeThread,
|
||||
WS_METHODS.gitRunStackedAction,
|
||||
WS_METHODS.terminalAttach,
|
||||
WS_METHODS.subscribeVcsStatus,
|
||||
WS_METHODS.subscribeTerminalEvents,
|
||||
WS_METHODS.subscribeTerminalMetadata,
|
||||
WS_METHODS.subscribePreviewEvents,
|
||||
WS_METHODS.subscribeDiscoveredLocalServers,
|
||||
WS_METHODS.previewAutomationConnect,
|
||||
WS_METHODS.subscribeServerConfig,
|
||||
WS_METHODS.subscribeServerLifecycle,
|
||||
WS_METHODS.subscribeAuthAccess,
|
||||
]);
|
||||
|
||||
const ALL_RPC_METHODS = Array.from(WsRpcGroup.requests.keys());
|
||||
|
||||
function normalizeRequest(tag: string, payload: unknown): NormalizedWsRpcRequestBody {
|
||||
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
||||
return {
|
||||
_tag: tag,
|
||||
...(payload as Record<string, unknown>),
|
||||
};
|
||||
}
|
||||
return { _tag: tag, payload };
|
||||
}
|
||||
|
||||
function asEffect(result: UnaryResolverResult): Effect.Effect<unknown> {
|
||||
if (result instanceof Promise) {
|
||||
return Effect.promise(() => result);
|
||||
}
|
||||
return Effect.succeed(result);
|
||||
}
|
||||
|
||||
export class BrowserWsRpcHarness {
|
||||
readonly requests: Array<NormalizedWsRpcRequestBody> = [];
|
||||
|
||||
private readonly parser = RpcSerialization.json.makeUnsafe();
|
||||
private client: BrowserWsClient | null = null;
|
||||
private scope: Scope.Closeable | null = null;
|
||||
private serverReady: Promise<RpcServerInstance> | null = null;
|
||||
private resolveUnary: NonNullable<BrowserWsRpcHarnessOptions["resolveUnary"]> = () => ({});
|
||||
private getInitialStreamValues: NonNullable<
|
||||
BrowserWsRpcHarnessOptions["getInitialStreamValues"]
|
||||
> = () => [];
|
||||
private streamPubSubs = new Map<string, PubSub.PubSub<unknown>>();
|
||||
|
||||
async reset(options?: BrowserWsRpcHarnessOptions): Promise<void> {
|
||||
await this.disconnect();
|
||||
this.requests.length = 0;
|
||||
this.resolveUnary = options?.resolveUnary ?? (() => ({}));
|
||||
this.getInitialStreamValues = options?.getInitialStreamValues ?? (() => []);
|
||||
this.initializeStreamPubSubs();
|
||||
}
|
||||
|
||||
connect(client: BrowserWsClient): void {
|
||||
if (this.scope) {
|
||||
void Effect.runPromise(Scope.close(this.scope, Exit.void)).catch(() => undefined);
|
||||
}
|
||||
if (this.streamPubSubs.size === 0) {
|
||||
this.initializeStreamPubSubs();
|
||||
}
|
||||
this.client = client;
|
||||
this.scope = Effect.runSync(Scope.make());
|
||||
this.serverReady = Effect.runPromise(
|
||||
Scope.provide(this.scope)(
|
||||
RpcServer.makeNoSerialization(WsRpcGroup, this.makeServerOptions()),
|
||||
).pipe(Effect.provide(this.makeLayer())),
|
||||
) as Promise<RpcServerInstance>;
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
if (this.scope) {
|
||||
await Effect.runPromise(Scope.close(this.scope, Exit.void)).catch(() => undefined);
|
||||
this.scope = null;
|
||||
}
|
||||
for (const pubsub of this.streamPubSubs.values()) {
|
||||
Effect.runSync(PubSub.shutdown(pubsub));
|
||||
}
|
||||
this.streamPubSubs.clear();
|
||||
this.serverReady = null;
|
||||
this.client = null;
|
||||
}
|
||||
|
||||
private initializeStreamPubSubs(): void {
|
||||
this.streamPubSubs = new Map(
|
||||
Array.from(STREAM_METHODS, (method) => [method, Effect.runSync(PubSub.unbounded<unknown>())]),
|
||||
);
|
||||
}
|
||||
|
||||
async onMessage(rawData: string): Promise<void> {
|
||||
const server = await this.serverReady;
|
||||
if (!server) {
|
||||
return;
|
||||
}
|
||||
const messages = this.parser.decode(rawData);
|
||||
for (const message of messages) {
|
||||
if (message && typeof message === "object" && "_tag" in message && message._tag === "Ping") {
|
||||
const encoded = this.parser.encode(RpcMessage.constPong);
|
||||
if (typeof encoded === "string") {
|
||||
this.client?.send(encoded);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
await Effect.runPromise(server.write(0, message as never));
|
||||
}
|
||||
}
|
||||
|
||||
emitStreamValue(method: string, value: unknown): void {
|
||||
const pubsub = this.streamPubSubs.get(method);
|
||||
if (!pubsub) {
|
||||
throw new Error(`No stream registered for ${method}`);
|
||||
}
|
||||
Effect.runSync(PubSub.publish(pubsub, value));
|
||||
}
|
||||
|
||||
private makeLayer() {
|
||||
const handlers: Record<string, (payload: unknown) => unknown> = {};
|
||||
for (const method of ALL_RPC_METHODS) {
|
||||
handlers[method] = STREAM_METHODS.has(method)
|
||||
? (payload) => this.handleStream(method, payload)
|
||||
: (payload) => this.handleUnary(method, payload);
|
||||
}
|
||||
return WsRpcGroup.toLayer(handlers as never);
|
||||
}
|
||||
|
||||
private makeServerOptions() {
|
||||
return {
|
||||
onFromServer: (response: unknown) =>
|
||||
Effect.sync(() => {
|
||||
if (!this.client) {
|
||||
return;
|
||||
}
|
||||
const encoded = this.parser.encode(response);
|
||||
if (typeof encoded === "string") {
|
||||
this.client.send(encoded);
|
||||
}
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
private handleUnary(method: string, payload: unknown) {
|
||||
const request = normalizeRequest(method, payload);
|
||||
this.requests.push(request);
|
||||
return asEffect(this.resolveUnary(request));
|
||||
}
|
||||
|
||||
private handleStream(method: string, payload: unknown) {
|
||||
const request = normalizeRequest(method, payload);
|
||||
this.requests.push(request);
|
||||
const pubsub = this.streamPubSubs.get(method);
|
||||
if (!pubsub) {
|
||||
throw new Error(`No stream registered for ${method}`);
|
||||
}
|
||||
return Stream.fromIterable(this.getInitialStreamValues(request) ?? []).pipe(
|
||||
Stream.concat(Stream.fromPubSub(pubsub)),
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-26
@@ -2,7 +2,6 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
||||
import babel from "@rolldown/plugin-babel";
|
||||
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||
import { playwright } from "vite-plus/test/browser-playwright";
|
||||
import { defineProject, type TestProjectInlineConfiguration } from "vite-plus/test/config";
|
||||
import "vite-plus/test/config";
|
||||
import { defineConfig } from "vite-plus";
|
||||
@@ -59,30 +58,6 @@ const unitTestProject = {
|
||||
},
|
||||
} satisfies TestProjectInlineConfiguration;
|
||||
|
||||
const browserTestProject = {
|
||||
extends: true,
|
||||
server: {
|
||||
// Browser tests need concurrent runs to claim the next available port.
|
||||
strictPort: false,
|
||||
},
|
||||
test: {
|
||||
name: "browser",
|
||||
include: ["src/components/**/*.browser.tsx"],
|
||||
hookTimeout: 30_000,
|
||||
testTimeout: 30_000,
|
||||
browser: {
|
||||
enabled: true,
|
||||
provider: playwright() as never,
|
||||
instances: [{ browser: "chromium" }],
|
||||
headless: true,
|
||||
api: {
|
||||
strictPort: false,
|
||||
},
|
||||
},
|
||||
fileParallelism: false,
|
||||
},
|
||||
} satisfies TestProjectInlineConfiguration;
|
||||
|
||||
function resolveDevProxyTarget(wsUrl: string | undefined): string | undefined {
|
||||
if (!wsUrl) {
|
||||
return undefined;
|
||||
@@ -188,7 +163,7 @@ export default defineConfig(() => {
|
||||
sourcemap: buildSourcemap,
|
||||
},
|
||||
test: {
|
||||
projects: [defineProject(unitTestProject), defineProject(browserTestProject)],
|
||||
projects: [defineProject(unitTestProject)],
|
||||
},
|
||||
};
|
||||
});
|
||||
Generated
-238
@@ -607,9 +607,6 @@ importers:
|
||||
msw:
|
||||
specifier: 2.12.11
|
||||
version: 2.12.11(@types/[email protected])([email protected])
|
||||
playwright:
|
||||
specifier: ^1.58.2
|
||||
version: 1.60.0
|
||||
tailwindcss:
|
||||
specifier: ^4.0.0
|
||||
version: 4.3.0
|
||||
@@ -619,9 +616,6 @@ importers:
|
||||
vite-plus:
|
||||
specifier: 'catalog:'
|
||||
version: 0.1.24(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
vitest-browser-react:
|
||||
specifier: ^2.0.5
|
||||
version: 2.2.0(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])))
|
||||
|
||||
infra/relay:
|
||||
dependencies:
|
||||
@@ -4670,35 +4664,6 @@ packages:
|
||||
babel-plugin-react-compiler:
|
||||
optional: true
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-h3nDO677RDLEGlBxyQ5CW8RlMThSKSRLUePLOx09gNIWRL40edgA1GCZSZgf1W55MFAG6/Sw14KeaAnqv0NKdQ==}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-LEiN/xe4OSIbKe9HQIp5OC24agGD9J5CnmMgsLohVVoOPWL9a2sBoR6VBx43jQZb7Kr1l4RCuyCJzcAa0+dojw==}
|
||||
peerDependencies:
|
||||
msw: ^2.4.9
|
||||
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
msw:
|
||||
optional: true
|
||||
vite:
|
||||
optional: true
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-9GasEBxpZ1VYIpqHf/0+YGg121uSNwCKOJqIrTwWP/TB7DmFCiaBpNl3aPZzoLWfWkuqhbH8vJIVobZkvdo2cA==}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-EmVxeBAfMJvycdjd6Hm+RbFBbA9fKvo0Kx37hNpBYoYeavH3RNsBXWDooR1mgD52dCrxIIuP7UotpfiwOikvcg==}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-acfZboRmAIf05DEKcBQy33VXojFJjtUdLyo7oOmV9kebb2xdU01UknNiPuPZoJZQyO7DF0gZdTGTpeAzET9QPQ==}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-6EevtBp6OZOPF7bmz36HrGMeP3txgVSrgebWxHOafDXGkhIzfXK14f8KF6MuFfgXXUeHxmpD3BQxkV00/3s5mA==}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
resolution: {integrity: sha512-uOJamYALNhfJ6iolExyQM40yIQwDqYnkKtQ5VCiSe17E33H0aQ/u+1GlRuz4LZBk6Mm3sg90G9hEbmEt37C1Zg==}
|
||||
|
||||
'@voidzero-dev/[email protected]':
|
||||
resolution: {integrity: sha512-iXPGBABnQnrDMx89H6MOCGcTZp+QW+3rY4YMVKdE6ydchSvPk2O3MI2vgaRVfOtWJ2IjnxSnf1n2yjP67ZBRFQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
@@ -5363,10 +5328,6 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -6100,9 +6061,6 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -6122,10 +6080,6 @@ packages:
|
||||
resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-DdGGPlMuM6cSTeKhbvh6OeLr2O/+EI5BHKYrD+Do8sJPYgLwzGrgESELfyjJCpEhFzT+TgKIdmLmWXhNUQnHiw==}
|
||||
peerDependencies:
|
||||
@@ -6583,11 +6537,6 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
@@ -7937,10 +7886,6 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==}
|
||||
|
||||
@@ -8194,11 +8139,6 @@ packages:
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-hheHdokM8cdqCb0lcE3s+zT4t4W+vvjpGxsZlDnikarzx8tSzMebh3UiFtgqwFwnTnjYQcsyMF8ei2mCO/tpeA==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==}
|
||||
engines: {node: '>=10.4.0'}
|
||||
@@ -8912,9 +8852,6 @@ packages:
|
||||
resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
|
||||
|
||||
@@ -8996,9 +8933,6 @@ packages:
|
||||
resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==}
|
||||
|
||||
@@ -9196,10 +9130,6 @@ packages:
|
||||
resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==}
|
||||
engines: {node: ^20.0.0 || >=22.0.0}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-nwEyF4vl4RSJjwSjBUmOSxc3BFPoIFdlRthJ6e+5v9P3bHNsoD06UjuqMUspqp7vsEZ1beaHi1km+optiE17yA==}
|
||||
|
||||
@@ -9565,61 +9495,6 @@ packages:
|
||||
vite:
|
||||
optional: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-oY3KM6305kwJMa6nHo92vVtkOsih7mjEf12dLKuphaF+9ywWPEc+qanIBd394SZ6m5LadVEaG6dicvvizOzmjA==}
|
||||
peerDependencies:
|
||||
'@types/react': ^18.0.0 || ^19.0.0
|
||||
'@types/react-dom': ^18.0.0 || ^19.0.0
|
||||
react: ^18.0.0 || ^19.0.0
|
||||
react-dom: ^18.0.0 || ^19.0.0
|
||||
vitest: ^4.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
'@types/react-dom':
|
||||
optional: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-flY6ScbCIt9HThs+C5HS7jvGOB560DJtk/Z15IQROTA6zEy49Nh8T/dofWTQL+n3vswqn87sbJNiuqw1SDp5Ig==}
|
||||
engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@edge-runtime/vm': '*'
|
||||
'@opentelemetry/api': ^1.9.0
|
||||
'@types/node': 24.12.4
|
||||
'@vitest/browser-playwright': 4.1.8
|
||||
'@vitest/browser-preview': 4.1.8
|
||||
'@vitest/browser-webdriverio': 4.1.8
|
||||
'@vitest/coverage-istanbul': 4.1.8
|
||||
'@vitest/coverage-v8': 4.1.8
|
||||
'@vitest/ui': 4.1.8
|
||||
happy-dom: '*'
|
||||
jsdom: '*'
|
||||
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
'@edge-runtime/vm':
|
||||
optional: true
|
||||
'@opentelemetry/api':
|
||||
optional: true
|
||||
'@types/node':
|
||||
optional: true
|
||||
'@vitest/browser-playwright':
|
||||
optional: true
|
||||
'@vitest/browser-preview':
|
||||
optional: true
|
||||
'@vitest/browser-webdriverio':
|
||||
optional: true
|
||||
'@vitest/coverage-istanbul':
|
||||
optional: true
|
||||
'@vitest/coverage-v8':
|
||||
optional: true
|
||||
'@vitest/ui':
|
||||
optional: true
|
||||
happy-dom:
|
||||
optional: true
|
||||
jsdom:
|
||||
optional: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==}
|
||||
|
||||
@@ -9763,11 +9638,6 @@ packages:
|
||||
engines: {node: ^20.17.0 || >=22.9.0}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}
|
||||
engines: {node: '>=8'}
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-U89AsyEeAsyoF0zVJBkG9zBgekjgjK7yk9sje3F4IQpXBJ10TF6ByLlIfjMhcmHMJgHZI4KHt4rdNfktzxIAMA==}
|
||||
engines: {node: '>=20'}
|
||||
@@ -13964,48 +13834,6 @@ snapshots:
|
||||
'@rolldown/plugin-babel': 0.2.3(@babel/[email protected])(@babel/[email protected](@babel/[email protected]))(@babel/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
babel-plugin-react-compiler: 1.0.0
|
||||
|
||||
'@vitest/[email protected]':
|
||||
dependencies:
|
||||
'@standard-schema/spec': 1.1.0
|
||||
'@types/chai': 5.2.3
|
||||
'@vitest/spy': 4.1.8
|
||||
'@vitest/utils': 4.1.8
|
||||
chai: 6.2.2
|
||||
tinyrainbow: 3.1.0
|
||||
|
||||
'@vitest/[email protected](@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected]))':
|
||||
dependencies:
|
||||
'@vitest/spy': 4.1.8
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.21
|
||||
optionalDependencies:
|
||||
msw: 2.12.11(@types/[email protected])([email protected])
|
||||
vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'
|
||||
|
||||
'@vitest/[email protected]':
|
||||
dependencies:
|
||||
tinyrainbow: 3.1.0
|
||||
|
||||
'@vitest/[email protected]':
|
||||
dependencies:
|
||||
'@vitest/utils': 4.1.8
|
||||
pathe: 2.0.3
|
||||
|
||||
'@vitest/[email protected]':
|
||||
dependencies:
|
||||
'@vitest/pretty-format': 4.1.8
|
||||
'@vitest/utils': 4.1.8
|
||||
magic-string: 0.30.21
|
||||
pathe: 2.0.3
|
||||
|
||||
'@vitest/[email protected]': {}
|
||||
|
||||
'@vitest/[email protected]':
|
||||
dependencies:
|
||||
'@vitest/pretty-format': 4.1.8
|
||||
convert-source-map: 2.0.0
|
||||
tinyrainbow: 3.1.0
|
||||
|
||||
'@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@oxc-project/runtime': 0.133.0
|
||||
@@ -14795,8 +14623,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
ansi-styles: 3.2.1
|
||||
@@ -15469,10 +15295,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.9
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
@@ -15485,8 +15307,6 @@ snapshots:
|
||||
dependencies:
|
||||
eventsource-parser: 3.1.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
expo: 56.0.8(@babel/[email protected])(@expo/[email protected])(@expo/[email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])
|
||||
@@ -16086,9 +15906,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
optional: true
|
||||
|
||||
[email protected]:
|
||||
optional: true
|
||||
|
||||
@@ -17736,8 +17553,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
destr: 2.0.5
|
||||
@@ -18017,12 +17832,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
playwright-core: 1.60.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
'@xmldom/xmldom': 0.8.13
|
||||
@@ -18960,8 +18769,6 @@ snapshots:
|
||||
side-channel-map: 1.0.1
|
||||
side-channel-weakmap: 1.0.2
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
@@ -19033,8 +18840,6 @@ snapshots:
|
||||
dependencies:
|
||||
escape-string-regexp: 2.0.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -19222,8 +19027,6 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -19565,42 +19368,6 @@ snapshots:
|
||||
optionalDependencies:
|
||||
vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'
|
||||
|
||||
[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected]))):
|
||||
dependencies:
|
||||
react: 19.2.6
|
||||
react-dom: 19.2.6([email protected])
|
||||
vitest: 4.1.8(@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected]))
|
||||
optionalDependencies:
|
||||
'@types/react': 19.2.16
|
||||
'@types/react-dom': 19.2.3(@types/[email protected])
|
||||
|
||||
[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])):
|
||||
dependencies:
|
||||
'@vitest/expect': 4.1.8
|
||||
'@vitest/mocker': 4.1.8(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected]))
|
||||
'@vitest/pretty-format': 4.1.8
|
||||
'@vitest/runner': 4.1.8
|
||||
'@vitest/snapshot': 4.1.8
|
||||
'@vitest/spy': 4.1.8
|
||||
'@vitest/utils': 4.1.8
|
||||
es-module-lexer: 2.1.0
|
||||
expect-type: 1.3.0
|
||||
magic-string: 0.30.21
|
||||
obug: 2.1.2
|
||||
pathe: 2.0.3
|
||||
picomatch: 4.0.4
|
||||
std-env: 4.1.0
|
||||
tinybench: 2.9.0
|
||||
tinyexec: 1.2.4
|
||||
tinyglobby: 0.2.17
|
||||
tinyrainbow: 3.1.0
|
||||
vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@types/node': 24.12.4
|
||||
transitivePeerDependencies:
|
||||
- msw
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected](@volar/[email protected]):
|
||||
@@ -19740,11 +19507,6 @@ snapshots:
|
||||
dependencies:
|
||||
isexe: 4.0.0
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
siginfo: 2.0.0
|
||||
stackback: 0.0.2
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
string-width: 8.2.1
|
||||
|
||||
Reference in new issue
Block a user