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

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
This commit is contained in:
t3-code[bot] authored and GitHub committed 2026-09-03 06:16:21 +00:00
1 parent d4bd8923ad
commit 5eb4f452ee
6 files changed
-199

No files matched your search

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