+
+ )
+ expect(screen.getByRole('button', { name: /open admin menu/i })).toBeInTheDocument()
+ })
+
+ it('opens the drawer when the menu button is clicked', async () => {
+ const user = userEvent.setup()
+ render(
+
+
Content
+
+ )
+
+ const menuButton = screen.getByRole('button', { name: /open admin menu/i })
+ await user.click(menuButton)
+
+ // The drawer should show an accessible dialog with the navigation
+ expect(screen.getByRole('dialog', { name: /admin menu/i })).toBeInTheDocument()
+ })
+
+ it('closes the drawer when a nav link is clicked', async () => {
+ const user = userEvent.setup()
+ render(
+
+
Content
+
+ )
+
+ await user.click(screen.getByRole('button', { name: /open admin menu/i }))
+ expect(screen.getByRole('dialog', { name: /admin menu/i })).toBeInTheDocument()
+
+ // Click a nav link inside the drawer
+ const drawerNav = screen.getByRole('dialog', { name: /admin menu/i })
+ const categoriesLink = drawerNav.querySelector('a[href="/admin/categories"]')
+ expect(categoriesLink).not.toBeNull()
+ await user.click(categoriesLink!)
+
+ expect(screen.queryByRole('dialog', { name: /admin menu/i })).not.toBeInTheDocument()
+ })
+
+ it('closes the drawer when the close button is clicked', async () => {
+ const user = userEvent.setup()
+ render(
+
+
Content
+
+ )
+
+ await user.click(screen.getByRole('button', { name: /open admin menu/i }))
+ expect(screen.getByRole('dialog', { name: /admin menu/i })).toBeInTheDocument()
+
+ await user.click(screen.getByRole('button', { name: /close admin menu/i }))
+ expect(screen.queryByRole('dialog', { name: /admin menu/i })).not.toBeInTheDocument()
+ })
+
+ it('renders back to forum link in the mobile drawer', async () => {
+ const user = userEvent.setup()
+ render(
+
+