test: chat toolbar buttons, shared helpers, quick-action-btn styles

Tests that chat toolbar exists (chat-cleanup-btn, chat-screenshot-btn,
quick-actions container), CSS styles (.quick-action-btn, .quick-action-btn.loading),
shared runCleanup/runScreenshot helper functions, and cleanup inspector reset.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-29 23:28:01 -07:00
parent 92adc71bbc
commit b09224e157
+26 -6
View File
@@ -759,12 +759,18 @@ describe('cleanup and screenshot buttons', () => {
const js = fs.readFileSync(path.join(ROOT, '..', 'extension', 'sidepanel.js'), 'utf-8');
const css = fs.readFileSync(path.join(ROOT, '..', 'extension', 'sidepanel.css'), 'utf-8');
test('sidepanel.html contains cleanup and screenshot buttons', () => {
test('sidepanel.html contains cleanup and screenshot buttons in inspector', () => {
expect(html).toContain('inspector-cleanup-btn');
expect(html).toContain('inspector-screenshot-btn');
expect(html).toContain('inspector-action-btn');
});
test('sidepanel.html contains cleanup and screenshot buttons in chat toolbar', () => {
expect(html).toContain('chat-cleanup-btn');
expect(html).toContain('chat-screenshot-btn');
expect(html).toContain('quick-actions');
});
test('sidepanel.js cleanup handler POSTs to /command with cleanup', () => {
expect(js).toContain("command: 'cleanup'");
expect(js).toContain("args: ['--all']");
@@ -775,12 +781,12 @@ describe('cleanup and screenshot buttons', () => {
});
test('sidepanel.js cleanup resets inspector state after success', () => {
// After cleanup, inspector data is stale
const cleanupSection = js.slice(
js.indexOf('inspector-cleanup-btn'),
js.indexOf('// ─── Screenshot'),
// runCleanup should call inspectorShowEmpty after cleanup
const cleanupFn = js.slice(
js.indexOf('async function runCleanup('),
js.indexOf('async function runScreenshot('),
);
expect(cleanupSection).toContain('inspectorShowEmpty');
expect(cleanupFn).toContain('inspectorShowEmpty');
});
test('sidepanel.js has notification rendering for type notification', () => {
@@ -793,6 +799,20 @@ describe('cleanup and screenshot buttons', () => {
expect(css).toContain('.inspector-action-btn.loading');
});
test('sidepanel.css contains quick-action-btn styles for chat toolbar', () => {
expect(css).toContain('.quick-action-btn');
expect(css).toContain('.quick-action-btn.loading');
expect(css).toContain('.quick-actions');
});
test('cleanup and screenshot use shared helper functions', () => {
expect(js).toContain('async function runCleanup(');
expect(js).toContain('async function runScreenshot(');
// Both inspector and chat buttons are wired
expect(js).toContain('chatCleanupBtn');
expect(js).toContain('chatScreenshotBtn');
});
test('sidepanel.css contains chat-notification styles', () => {
expect(css).toContain('.chat-notification');
});