import React from "react"; import { describe, it, expect, vi } from "vitest"; import { render } from "@testing-library/react"; // Mock next/navigation vi.mock("next/navigation", () => ({ usePathname: () => "/", useRouter: () => ({ push: vi.fn(), replace: vi.fn(), back: vi.fn() }), useSearchParams: () => new URLSearchParams(), })); vi.mock("next/link", () => ({ default: ({ children, href, ...props }: any) => {children}, })); vi.mock("../../lib/store/cartStore", () => ({ useCartStore: (selector?: any) => { const s = { getTotalItems: () => 0 }; return typeof selector === "function" ? selector(s) : s; }, })); import MobileBottomNav from "../MobileBottomNav"; describe("Viewport Overflow & BottomNav Positioning (UX-31)", () => { it("ensures MobileBottomNav uses left-0 right-0 with safe-area padding to avoid 13px overflow on 360px viewports", () => { const { container } = render(); const nav = container.querySelector("nav"); expect(nav).not.toBeNull(); expect(nav?.className).toContain("fixed"); expect(nav?.className).toContain("bottom-0"); expect(nav?.className).toContain("left-0"); expect(nav?.className).toContain("right-0"); expect(nav?.className).toContain("pb-[env(safe-area-inset-bottom,0px)]"); }); });