源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)

This commit is contained in:
agent-radar
2026-09-02 01:05:41 +08:00
commit 04bac1f6e2
2200 changed files with 489415 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import { describe, expect, test } from "bun:test";
import type { QuestionInfo } from "@opencode-ai/sdk/v2/client";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { QuestionPanel } from "../src/react-app/domains/session/modals/question-modal";
function renderQuestion(question: QuestionInfo) {
return renderToStaticMarkup(
React.createElement(QuestionPanel, {
questions: [question],
busy: false,
onReply: () => {},
}),
);
}
describe("QuestionPanel", () => {
test("shows custom answer input when custom is omitted", () => {
const html = renderQuestion({
header: "Choice",
question: "Pick one",
options: [{ label: "Yes", description: "Proceed" }],
});
expect(html).toContain("Or type a custom answer");
expect(html).toContain("Type your answer here...");
});
test("hides custom answer input when custom is false", () => {
const html = renderQuestion({
header: "Choice",
question: "Pick one",
options: [{ label: "Yes", description: "Proceed" }],
custom: false,
});
expect(html).not.toContain("Or type a custom answer");
expect(html).not.toContain("Type your answer here...");
});
});