feat: category menus
This commit is contained in:
@@ -14,15 +14,20 @@ describe('MenuEditorView entry editor', () => {
|
||||
get: vi.fn().mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
id: 'root-page',
|
||||
id: 'menu-home',
|
||||
title: 'Home',
|
||||
kind: 'page',
|
||||
pageSlug: 'home',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
}),
|
||||
save: vi.fn().mockResolvedValue({ items: [] }),
|
||||
},
|
||||
meta: {
|
||||
...(window as any).electronAPI?.meta,
|
||||
getCategories: vi.fn().mockResolvedValue(['news', 'tech']),
|
||||
},
|
||||
posts: {
|
||||
...(window as any).electronAPI?.posts,
|
||||
filter: vi.fn().mockResolvedValue([
|
||||
@@ -188,4 +193,28 @@ describe('MenuEditorView entry editor', () => {
|
||||
expect(screen.getByText('About')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows a category archive create button (C+) in toolbar', async () => {
|
||||
render(<MenuEditorView />);
|
||||
|
||||
await screen.findByRole('button', { name: /add entry/i });
|
||||
expect(screen.getByRole('button', { name: /add category archive/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('opens category input when category archive button is clicked', async () => {
|
||||
render(<MenuEditorView />);
|
||||
|
||||
const button = await screen.findByRole('button', { name: /add category archive/i });
|
||||
fireEvent.click(button);
|
||||
|
||||
expect(await screen.findByPlaceholderText(/type a category name/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('disables delete action when Home entry is selected', async () => {
|
||||
render(<MenuEditorView />);
|
||||
|
||||
await screen.findByText('Home');
|
||||
const deleteButton = screen.getByRole('button', { name: /^delete$/i });
|
||||
expect(deleteButton).toBeDisabled();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user