fix(ux-32): verify responsive menu sheet trigger and add mobile safe padding on search route

This commit is contained in:
devops committed 2026-10-17 18:53:20 +00:00
1 parent 81d1fa816b
commit f23efbf90d
2 files changed
+66 -1

No files matched your search

@@ -194,7 +194,7 @@ export default function SearchResultsPage({ query }: { query: string }) {
};
return (
<div className="min-h-screen bg-medical-gray-50 py-4 sm:py-10 px-3 sm:px-6 font-vazir" dir="rtl">
<div className="min-h-screen bg-medical-gray-50 pt-4 pb-24 sm:py-10 px-3 sm:px-6 font-vazir" dir="rtl">
<div className="max-w-7xl mx-auto">
{/* Mobile-First Header Bar: Back Button & Compact Title */}
@@ -0,0 +1,65 @@
import React from "react";
import { describe, it, expect, vi } from "vitest";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
// Mock next/navigation
let currentPathname = "/search";
vi.mock("next/navigation", () => ({
usePathname: () => currentPathname,
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;
},
}));
vi.mock("../../lib/store/userStore", () => ({
useUserStore: () => ({
isLoggedIn: false,
setAuthModalOpen: vi.fn(),
}),
}));
vi.mock("../../lib/store/uiStore", () => ({
useUIStore: () => vi.fn(),
}));
vi.mock("../../lib/store/settingsStore", () => ({
useSettingsStore: () => ({
getBoolean: () => true,
getText: () => "true",
}),
}));
import MobileBottomNav from "../MobileBottomNav";
describe("MobileBottomNav on /search route (UX-32)", () => {
it("opens menu bottom sheet smoothly when clicking menu button on search page", async () => {
currentPathname = "/search";
render(<MobileBottomNav />);
const menuBtn = screen.getByRole("button", { name: "منو" });
expect(menuBtn).toBeTruthy();
fireEvent.click(menuBtn);
await waitFor(() => {
expect(screen.getByText("منوی بخش‌های کنینا")).toBeTruthy();
});
const closeBtn = screen.getByRole("button", { name: "بستن ✕" });
fireEvent.click(closeBtn);
await waitFor(() => {
expect(screen.queryByText("منوی بخش‌های کنینا")).toBeNull();
});
});
});