@devries-cameron20 / t3code Mirror · read-only / commits / 5eb4f452ee
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 11:30 UTC

test(web): remove static markup-only component tests (#9364)

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>

t3-code[bot] committed Sep 3, 2026 at 06:16 UTC 5eb4f452ee0fcde7b5bbc93d62de9118b70a33b2
6 files changed -199
apps/web/src/components/ProjectScriptsControl.test.tsx deleted
-65
@@ -1,65 +0,0 @@
1 -import type { ProjectScript, ResolvedKeybindingsConfig } from "@t3tools/contracts";
2 -import { renderToStaticMarkup } from "react-dom/server";
3 -import { describe, expect, it } from "vite-plus/test";
4 -
5 -import ProjectScriptsControl from "./ProjectScriptsControl";
6 -
7 -const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
8 -const PRIMARY_SCRIPT: ProjectScript = {
9 - id: "dev",
10 - name: "Dev",
11 - command: "vp dev",
12 - icon: "play",
13 - runOnWorktreeCreate: false,
14 -};
15 -
16 -function renderControl(scripts: ReadonlyArray<ProjectScript>) {
17 - return renderToStaticMarkup(
18 - <ProjectScriptsControl
19 - scripts={scripts}
20 - keybindings={EMPTY_KEYBINDINGS}
21 - onRunScript={() => {}}
22 - onAddScript={async () => undefined as never}
23 - onUpdateScript={async () => undefined as never}
24 - onDeleteScript={async () => undefined as never}
25 - />,
26 - );
27 -}
28 -
29 -function buttonTag(html: string, ariaLabel: string) {
30 - return html.match(new RegExp(`<button[^>]*aria-label="${ariaLabel}"[^>]*>`))?.[0];
31 -}
32 -
33 -function expectResponsiveXsControl(markup: string | undefined) {
34 - expect(markup).toBeDefined();
35 - expect(markup).toContain("h-7");
36 - expect(markup).toContain("gap-1");
37 - expect(markup).toContain("text-sm");
38 - expect(markup).toContain("sm:h-6");
39 - expect(markup).toContain("sm:text-xs");
40 - expect(markup).toContain("w-7");
41 - expect(markup).toContain("px-0");
42 - expect(markup).toContain("sm:w-6");
43 - expect(markup).toContain("@3xl/header-actions:w-auto!");
44 - expect(markup).toContain("@3xl/header-actions:px-[calc(--spacing(2)-1px)]");
45 -}
46 -
47 -describe("ProjectScriptsControl compact controls", () => {
48 - it("keeps the primary Run control compact and expands it with its label", () => {
49 - const html = renderControl([PRIMARY_SCRIPT]);
50 -
51 - expectResponsiveXsControl(buttonTag(html, "Run Dev"));
52 - expect(html).toContain(
53 - 'class="sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5"',
54 - );
55 - });
56 -
57 - it("keeps the standalone Add control compact and expands it with its label", () => {
58 - const html = renderControl([]);
59 -
60 - expectResponsiveXsControl(buttonTag(html, "Add action"));
61 - expect(html).toContain(
62 - 'class="sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5"',
63 - );
64 - });
65 -});
apps/web/src/components/chat/ComposerPendingTerminalContexts.test.tsx deleted
-28
@@ -1,28 +0,0 @@
1 -import { ThreadId } from "@t3tools/contracts";
2 -import { renderToStaticMarkup } from "react-dom/server";
3 -import { describe, expect, it } from "vite-plus/test";
4 -
5 -import { ComposerPendingTerminalContextChip } from "./ComposerPendingTerminalContexts";
6 -
7 -describe("ComposerPendingTerminalContextChip", () => {
8 - it("renders expired terminal contexts with error styling", () => {
9 - const markup = renderToStaticMarkup(
10 - <ComposerPendingTerminalContextChip
11 - context={{
12 - id: "ctx-expired",
13 - threadId: ThreadId.make("thread-1"),
14 - terminalId: "default",
15 - terminalLabel: "Terminal 1",
16 - lineStart: 2,
17 - lineEnd: 4,
18 - text: "",
19 - createdAt: "2026-03-17T18:42:05.449Z",
20 - }}
21 - />,
22 - );
23 -
24 - expect(markup).toContain('data-terminal-context-expired="true"');
25 - expect(markup).toContain("border-destructive/35");
26 - expect(markup).toContain("Terminal 1 lines 2-4");
27 - });
28 -});
apps/web/src/components/chat/ComposerPromptLengthValidation.test.tsx deleted
-23
@@ -1,23 +0,0 @@
1 -import { PROVIDER_SEND_TURN_MAX_INPUT_CHARS } from "@t3tools/contracts";
2 -import { renderToStaticMarkup } from "react-dom/server";
3 -import { describe, expect, it } from "vite-plus/test";
4 -
5 -import { getComposerPromptLengthValidationMessage } from "./composerSubmission";
6 -import { ComposerPromptLengthValidation } from "./ComposerPromptLengthValidation";
7 -
8 -describe("ComposerPromptLengthValidation", () => {
9 - it("renders oversized prompt feedback as an actionable composer alert", () => {
10 - const message = getComposerPromptLengthValidationMessage(
11 - "x".repeat(PROVIDER_SEND_TURN_MAX_INPUT_CHARS + 1),
12 - );
13 -
14 - const markup = renderToStaticMarkup(<ComposerPromptLengthValidation message={message} />);
15 -
16 - expect(markup).toContain('role="alert"');
17 - expect(markup).toContain('data-chat-composer-validation="prompt-length"');
18 - expect(markup).toContain(
19 - "Prompt is 1 character over the 120,000-character limit. Shorten or split it before sending.",
20 - );
21 - expect(markup).not.toContain("ProviderValidationError");
22 - });
23 -});
apps/web/src/components/chat/PanelLayoutControls.test.tsx deleted
-28
@@ -1,28 +0,0 @@
1 -import { renderToStaticMarkup } from "react-dom/server";
2 -import { describe, expect, it } from "vite-plus/test";
3 -
4 -import { PanelLayoutControls } from "./PanelLayoutControls";
5 -
6 -describe("PanelLayoutControls", () => {
7 - it("keeps unavailable panel tooltip triggers interactive", () => {
8 - const markup = renderToStaticMarkup(
9 - <PanelLayoutControls
10 - showTerminalControl
11 - terminalAvailable={false}
12 - terminalOpen={false}
13 - terminalShortcutLabel={null}
14 - rightPanelAvailable={false}
15 - rightPanelOpen={false}
16 - rightPanelShortcutLabel={null}
17 - liveAgentCount={0}
18 - onToggleTerminal={() => {}}
19 - onToggleRightPanel={() => {}}
20 - />,
21 - );
22 -
23 - expect(markup.match(/data-slot="tooltip-trigger"/g)).toHaveLength(2);
24 - expect(markup.match(/data-slot="tooltip-trigger"[^>]*><button[^>]*disabled=""/g)).toHaveLength(
25 - 2,
26 - );
27 - });
28 -});
apps/web/src/components/preview/PreviewChromeRow.test.tsx deleted
-24
@@ -1,24 +0,0 @@
1 -import { renderToStaticMarkup } from "react-dom/server";
2 -import { describe, expect, it, vi } from "vite-plus/test";
3 -
4 -import { PreviewChromeRow } from "./PreviewChromeRow";
5 -
6 -describe("PreviewChromeRow", () => {
7 - it("shows the complete URL while the address bar is not focused", () => {
8 - const markup = renderToStaticMarkup(
9 - <PreviewChromeRow
10 - url="https://example.com/dashboard?mode=edit&tab=1#notes"
11 - loading={false}
12 - canGoBack={false}
13 - canGoForward={false}
14 - refreshDisabled={false}
15 - onBack={vi.fn()}
16 - onForward={vi.fn()}
17 - onRefresh={vi.fn()}
18 - onSubmit={vi.fn()}
19 - />,
20 - );
21 -
22 - expect(markup).toContain('value="https://example.com/dashboard?mode=edit&amp;tab=1#notes"');
23 - });
24 -});
apps/web/src/components/ui/command.test.tsx deleted
-31
@@ -1,31 +0,0 @@
1 -import { renderToStaticMarkup } from "react-dom/server";
2 -import { describe, expect, it } from "vite-plus/test";
3 -
4 -import { Command, CommandFooter, CommandInput } from "./command";
5 -
6 -describe("command compact geometry", () => {
7 - it("keeps shell selectors on the wrapper and direct-input padding on AutocompleteInput", () => {
8 - const html = renderToStaticMarkup(
9 - <Command>
10 - <CommandInput placeholder="Search commands" />
11 - </Command>,
12 - );
13 - const shellClass = html.match(/class="([^"]*px-\[var\(--command-shell-inset\)[^"]*)"/)?.[1];
14 - const inputClass = html.match(/class="([^"]*has-focus-visible:ring-0[^"]*)"/)?.[1];
15 -
16 - expect(shellClass).toContain(
17 - "[&amp;_[data-slot=autocomplete-start-addon]]:ps-[calc(var(--command-shell-inset)+0.0625rem)]",
18 - );
19 - expect(shellClass).not.toContain("sm:*:data-[slot=autocomplete-input]");
20 - expect(inputClass).toContain(
21 - "sm:*:data-[slot=autocomplete-input]:ps-[calc(var(--command-shell-inset)+1.5rem)]!",
22 - );
23 - });
24 -
25 - it("uses the semantic footer inset without changing compact vertical padding", () => {
26 - const html = renderToStaticMarkup(<CommandFooter>Shortcuts</CommandFooter>);
27 -
28 - expect(html).toContain("px-[var(--command-content-inset)]");
29 - expect(html).toContain("py-2.5");
30 - });
31 -});