= ({
suggestions,
onSelectSuggestion,
}) => (
{suggestions.map((s: any, i: number) => (
))}
);
render(
,
);
expect(screen.getByTestId("custom-suggestions")).toBeDefined();
expect(screen.getByText("Option A")).toBeDefined();
expect(screen.getByText("Option B")).toBeDefined();
});
});
describe("feather custom component (via scrollView)", () => {
it("should render custom feather component via scrollView", () => {
const CustomFeather: React.FC = () => (
Custom Feather
);
render(
,
);
const feather = screen.queryByTestId("custom-feather");
if (feather) {
expect(feather.textContent).toContain("Custom Feather");
}
});
});
describe("scrollToBottomButton custom component (nested under scrollView)", () => {
it("should render custom scrollToBottomButton component via scrollView", () => {
const CustomScrollButton: React.FC = ({ onClick }) => (
);
render(
,
);
// Button may only appear when scrolled
const btn = screen.queryByTestId("custom-scroll-btn");
if (btn) {
expect(btn.textContent).toContain("Go Down");
}
});
});
});
// ============================================================================
// 4. RECURSIVE DRILL-DOWN TESTS
// ============================================================================
describe("4. Recursive Subcomponent Drill-Down", () => {
describe("messageView -> assistantMessage drill-down", () => {
it("should allow customizing assistantMessage within messageView", () => {
const CustomAssistantMessage: React.FC = ({ message }) => (
Custom Assistant: {message?.content}
);
render(
,
);
expect(screen.getByTestId("custom-assistant-msg")).toBeDefined();
expect(screen.getByText(/Custom Assistant: Hi there!/)).toBeDefined();
});
});
describe("messageView -> userMessage drill-down", () => {
it("should allow customizing userMessage within messageView", () => {
const CustomUserMessage: React.FC = ({ message }) => (
User said: {message?.content}
);
render(
,
);
expect(screen.getByTestId("custom-user-msg")).toBeDefined();
expect(screen.getByText(/User said: Hello/)).toBeDefined();
});
});
describe("messageView -> cursor drill-down", () => {
it("should allow customizing cursor within messageView", () => {
const CustomCursor: React.FC = () => (
|
);
render(
,
);
// Cursor appears when running
const cursor = screen.queryByTestId("custom-cursor");
if (cursor) {
expect(cursor.textContent).toBe("|");
}
});
});
describe("input -> textArea drill-down", () => {
it("should allow customizing textArea within input", () => {
const CustomTextArea: React.FC = React.forwardRef<
HTMLTextAreaElement,
any
>(({ value, onChange, ...props }, ref) => (