feat: ensure نوبت‌ها menu remains always expanded in the sidebar

This commit is contained in:
hamed
2026-07-23 15:03:47 +03:30
parent f218bc17ef
commit 9a776be13c
2 changed files with 12 additions and 7 deletions
@@ -20,19 +20,19 @@ describe("Sidebar — expandable نوبت‌ها menu", () => {
} as any);
});
it("renders نوبت‌ها as a collapsible parent and reveals sub-items on click", () => {
it("keeps نوبت‌ها always expanded regardless of route and click", () => {
renderWithProviders(<Sidebar />, { route: "/admin/dashboard" });
// منوی والد به شکل دکمه
const parent = screen.getByRole("button", { name: /نوبت‌ها/ });
expect(parent).toBeInTheDocument();
// در ابتدا (مسیر داشبورد) بسته است → زیرمنوها نیستند
expect(screen.queryByText("نوبت ها")).toBeNull();
// حتی خارج از مسیر نوبت‌ها، زیرمنوها همیشه دیده می‌شوند
expect(screen.getByText("نوبت ها")).toBeInTheDocument();
expect(screen.getByText("افزودن نوبت")).toBeInTheDocument();
// کلیک روی والد آن را جمع نمی‌کند
fireEvent.click(parent);
// پس از باز شدن، دو زیرمنو دیده می‌شوند
expect(screen.getByText("نوبت ها")).toBeInTheDocument();
expect(screen.getByText("افزودن نوبت")).toBeInTheDocument();
});