fix(ux-31): eliminate 13px horizontal viewport overflow and align MobileBottomNav with safe-area
This commit is contained in:
1 parent
f5c970f82e
commit
81d1fa816b
3 files changed
+38
-2
No files matched your search
@@ -0,0 +1,36 @@
|
||||
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) => <a href={href} {...props}>{children}</a>,
|
||||
}));
|
||||
|
||||
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(<MobileBottomNav />);
|
||||
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)]");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user