wip: agui integration
This commit is contained in:
16
tests/renderer/components/AssistantSidebar.styles.test.ts
Normal file
16
tests/renderer/components/AssistantSidebar.styles.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
describe('AssistantSidebar styles', () => {
|
||||
const cssPath = path.resolve(
|
||||
__dirname,
|
||||
'../../../src/renderer/components/AssistantSidebar/AssistantSidebar.css'
|
||||
);
|
||||
|
||||
it('keeps the sidebar container scrollable for long assistant content', () => {
|
||||
const css = fs.readFileSync(cssPath, 'utf8');
|
||||
|
||||
expect(css).toMatch(/\.assistant-sidebar\s*\{[^}]*min-height:\s*0;[^}]*overflow-y:\s*auto;[^}]*\}/s);
|
||||
});
|
||||
});
|
||||
41
tests/renderer/components/ChatSurface.sharedStyles.test.ts
Normal file
41
tests/renderer/components/ChatSurface.sharedStyles.test.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
describe('Chat surface shared styles', () => {
|
||||
const sharedCssPath = path.resolve(
|
||||
__dirname,
|
||||
'../../../src/renderer/styles/chatSurface.css'
|
||||
);
|
||||
const chatPanelPath = path.resolve(
|
||||
__dirname,
|
||||
'../../../src/renderer/components/ChatPanel/ChatPanel.tsx'
|
||||
);
|
||||
const assistantSidebarPath = path.resolve(
|
||||
__dirname,
|
||||
'../../../src/renderer/components/AssistantSidebar/AssistantSidebar.tsx'
|
||||
);
|
||||
|
||||
it('defines reusable surface primitives', () => {
|
||||
const css = fs.readFileSync(sharedCssPath, 'utf8');
|
||||
|
||||
expect(css).toContain('.chat-surface');
|
||||
expect(css).toContain('.chat-surface-scroll');
|
||||
expect(css).toContain('.chat-surface-input');
|
||||
expect(css).toContain('.chat-surface-error');
|
||||
expect(css).toContain('.chat-surface-section');
|
||||
});
|
||||
|
||||
it('applies shared surface class names in both chat renderers', () => {
|
||||
const chatPanel = fs.readFileSync(chatPanelPath, 'utf8');
|
||||
const assistantSidebar = fs.readFileSync(assistantSidebarPath, 'utf8');
|
||||
|
||||
expect(chatPanel).toContain('chat-surface');
|
||||
expect(chatPanel).toContain('chat-surface-scroll');
|
||||
|
||||
expect(assistantSidebar).toContain('chat-surface');
|
||||
expect(assistantSidebar).toContain('chat-surface-input');
|
||||
expect(assistantSidebar).toContain('chat-surface-error');
|
||||
expect(assistantSidebar).toContain('chat-surface-section');
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,7 @@ describe('WindowTitleBar', () => {
|
||||
useAppStore.setState({
|
||||
sidebarVisible: true,
|
||||
panelVisible: false,
|
||||
assistantSidebarVisible: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,6 +33,7 @@ describe('WindowTitleBar', () => {
|
||||
expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull();
|
||||
expect(screen.getByLabelText('Toggle Sidebar')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Toggle Panel')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Toggle Assistant Sidebar')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('does not request macOS title bar metrics when simulated title bar is disabled', async () => {
|
||||
@@ -139,9 +141,23 @@ describe('WindowTitleBar', () => {
|
||||
|
||||
const actionButtons = Array.from(document.querySelectorAll('.window-titlebar-actions .window-titlebar-action-button'));
|
||||
|
||||
expect(actionButtons).toHaveLength(2);
|
||||
expect(actionButtons).toHaveLength(3);
|
||||
expect(actionButtons[0]).toHaveAttribute('aria-label', 'Toggle Sidebar');
|
||||
expect(actionButtons[1]).toHaveAttribute('aria-label', 'Toggle Panel');
|
||||
expect(actionButtons[2]).toHaveAttribute('aria-label', 'Toggle Assistant Sidebar');
|
||||
});
|
||||
|
||||
it('renders a right-side assistant sidebar toggle button and toggles assistant sidebar visibility', () => {
|
||||
render(<WindowTitleBar />);
|
||||
|
||||
const toggleButton = screen.getByLabelText('Toggle Assistant Sidebar');
|
||||
expect(toggleButton).toBeInTheDocument();
|
||||
expect(toggleButton).toHaveAttribute('title', 'Show Assistant Sidebar (Ctrl+\\)');
|
||||
|
||||
fireEvent.click(toggleButton);
|
||||
|
||||
expect(useAppStore.getState().assistantSidebarVisible).toBe(true);
|
||||
expect(toggleButton).toHaveAttribute('title', 'Hide Assistant Sidebar (Ctrl+\\)');
|
||||
});
|
||||
|
||||
it('updates overlay inset CSS variables when window controls geometry changes', () => {
|
||||
@@ -248,6 +264,7 @@ describe('WindowTitleBar', () => {
|
||||
expect(screen.getByRole('button', { name: 'Media Ctrl+2' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Toggle Sidebar Ctrl+B' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Toggle Panel Ctrl+J' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Toggle Assistant Sidebar Ctrl+\\' })).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Blog' }));
|
||||
expect(screen.getByRole('button', { name: 'Publish Selected Ctrl+Shift+P' })).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user