(reviews[0]!);
return (
);
}
render();
expect(screen.getByRole("button", { name: "feedback for pr-a" })).not.toBeNull();
act(() => screen.getByRole("button", { name: "Select review B" }).click());
expect(screen.queryByRole("button", { name: "feedback for pr-a" })).toBeNull();
expect(screen.getByRole("button", { name: "feedback for pr-b" })).not.toBeNull();
});
});
describe("MobilePanelArea Prompt history", () => {
it("renders the history surface and forwards prompt navigation", () => {
const handleNavigateToPrompt = vi.fn();
render(
,
);
expect(screen.getByTestId("mobile-prompt-history-content")).toBeTruthy();
fireEvent.click(screen.getByTestId("mobile-prompt-history-content"));
expect(handleNavigateToPrompt).toHaveBeenCalledWith("prompt-1");
});
});
function renderMobilePanel(currentMobilePanel: string) {
return render(
,
);
}
describe("MobilePanelArea — plugin task panel (AC7)", () => {
afterEach(() => {
pluginRegistry.unregisterPlugin("kandev-plugin-notes");
});
it("renders the plugin's Component with mobile presentation when selected", () => {
function Notes(props: { panelId: string; taskId: string; presentation: string }) {
return (
{props.panelId}|{props.taskId}|{props.presentation}
);
}
pluginRegistry
.forPlugin("kandev-plugin-notes")
.registerTaskPanel({ id: "notes", title: "Notes", Component: Notes, mobileEnabled: true });
renderMobilePanel("plugin:kandev-plugin-notes:notes");
expect(screen.getByTestId("notes-mobile-body").textContent).toBe(
"plugin:kandev-plugin-notes:notes|task-1|mobile",
);
});
it("renders nothing for a panel id that isn't a plugin id", () => {
renderMobilePanel("not-a-plugin-panel-id");
expect(screen.queryByTestId("notes-mobile-body")).toBeNull();
});
});
describe("terminalPaddingBottom", () => {
it("pads by the keybar height alone when the keyboard is closed", () => {
expect(terminalPaddingBottom(false, 0, "3.25rem")).toBe("48px");
// bottomOffset is irrelevant while the keyboard is closed.
expect(terminalPaddingBottom(false, 300, "3.25rem")).toBe("48px");
});
it("subtracts the bottom nav and adds the live keyboard offset when the keyboard is open", () => {
expect(terminalPaddingBottom(true, 300, "3.25rem")).toBe(
"calc(348px - 3.25rem - env(safe-area-inset-bottom, 0px))",
);
});
});
describe("resolveMobileReviewSource", () => {
it("keeps built-in source precedence for saved mobile state", () => {
expect(resolveMobileReviewSource(true, true)).toBe("github");
expect(resolveMobileReviewSource(false, true)).toBe("gitlab");
expect(resolveMobileReviewSource(false, false)).toBeNull();
});
});