Files
kandev/apps/web/components/task/mobile/session-mobile-bottom-nav.test.tsx
T
José Almeida 9c16d337a2 feat(web): add global app status surface (#1869)
* feat(web): add app status bar

* feat(web): add app status bar visibility toggle

* feat(web): persist status bar item order

* fix(web): refine app status bar behavior

* fix(web): polish app status bar presentation

* test(web): split plugin slot coverage groups

* fix(web): address status surface review feedback

* fix(web): stabilize status bar overlay tests
2026-07-23 12:28:54 +01:00

70 lines
1.9 KiB
TypeScript

import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { SessionMobileBottomNav } from "./session-mobile-bottom-nav";
afterEach(cleanup);
describe("SessionMobileBottomNav", () => {
it("offers a touch-sized review route for linked merge requests", () => {
const onPanelChange = vi.fn();
render(
<SessionMobileBottomNav
activePanel="chat"
onPanelChange={onPanelChange}
hasReview
showStatus
onOpenStatus={vi.fn()}
/>,
);
const review = screen.getByRole("button", { name: "Review" });
expect(review.className).toContain("min-h-11");
fireEvent.click(review);
expect(onPanelChange).toHaveBeenCalledWith("review");
});
it("does not consume navigation space without a linked merge request", () => {
render(
<SessionMobileBottomNav
activePanel="chat"
onPanelChange={vi.fn()}
showStatus
onOpenStatus={vi.fn()}
/>,
);
expect(screen.queryByRole("button", { name: "Review" })).toBeNull();
});
it("opens Status as an action without changing the selected mobile panel", () => {
const onPanelChange = vi.fn();
const onOpenStatus = vi.fn();
render(
<SessionMobileBottomNav
activePanel="chat"
onPanelChange={onPanelChange}
showStatus
onOpenStatus={onOpenStatus}
/>,
);
fireEvent.click(screen.getByRole("button", { name: "Status" }));
expect(onOpenStatus).toHaveBeenCalledOnce();
expect(onPanelChange).not.toHaveBeenCalled();
});
it("does not reserve navigation space when Status is disabled", () => {
render(
<SessionMobileBottomNav
activePanel="chat"
onPanelChange={vi.fn()}
showStatus={false}
onOpenStatus={vi.fn()}
/>,
);
expect(screen.queryByRole("button", { name: "Status" })).toBeNull();
});
});