Simplify sidebar navigation

This commit is contained in:
Alex Gleason committed 2025-09-18 21:39:49 -05:00
1 parent 5cdb62ca1c
commit 9c358bb230
2 files changed
+49 -13

No files matched your search

+26 -8
View File
@@ -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'
);
});
});