mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Simplify sidebar navigation
This commit is contained in:
2 files changed
+49
-13
No files matched your search
@@ -19,12 +19,12 @@ vi.mock('@tanstack/react-query', () => ({
|
||||
})
|
||||
}));
|
||||
|
||||
// Mock the LoginArea component
|
||||
vi.mock('@/components/auth/LoginArea', () => ({
|
||||
LoginArea: ({ className }: { className?: string }) => (
|
||||
<div data-testid="login-area" className={className}>Login Area</div>
|
||||
)
|
||||
}));
|
||||
// Mock window.open for help button test
|
||||
const mockWindowOpen = vi.fn();
|
||||
Object.defineProperty(window, 'open', {
|
||||
value: mockWindowOpen,
|
||||
writable: true
|
||||
});
|
||||
|
||||
const mockUseProjects = vi.mocked(useProjects);
|
||||
const mockUseLocalStorage = vi.mocked(useLocalStorage);
|
||||
@@ -81,7 +81,7 @@ describe('ProjectSidebar', () => {
|
||||
expect(screen.queryByLabelText('Collapse sidebar')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders login area at the bottom', () => {
|
||||
it('renders settings and help buttons at the bottom', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
@@ -89,7 +89,8 @@ describe('ProjectSidebar', () => {
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('login-area')).toBeInTheDocument();
|
||||
expect(screen.getByText('Settings')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Help')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows new project button', () => {
|
||||
@@ -102,4 +103,21 @@ describe('ProjectSidebar', () => {
|
||||
|
||||
expect(screen.getByText('New Project')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('opens help documentation when help button is clicked', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
const helpButton = screen.getByLabelText('Help');
|
||||
fireEvent.click(helpButton);
|
||||
|
||||
expect(mockWindowOpen).toHaveBeenCalledWith(
|
||||
'https://soapbox.pub/shakespeare-resources/',
|
||||
'_blank'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user