mirror of https://github.com/garrytan/gstack.git
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:
parent
92adc71bbc
commit
b09224e157
|
|
@ -759,12 +759,18 @@ describe('cleanup and screenshot buttons', () => {
|
||||||
const js = fs.readFileSync(path.join(ROOT, '..', 'extension', 'sidepanel.js'), 'utf-8');
|
const js = fs.readFileSync(path.join(ROOT, '..', 'extension', 'sidepanel.js'), 'utf-8');
|
||||||
const css = fs.readFileSync(path.join(ROOT, '..', 'extension', 'sidepanel.css'), '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-cleanup-btn');
|
||||||
expect(html).toContain('inspector-screenshot-btn');
|
expect(html).toContain('inspector-screenshot-btn');
|
||||||
expect(html).toContain('inspector-action-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', () => {
|
test('sidepanel.js cleanup handler POSTs to /command with cleanup', () => {
|
||||||
expect(js).toContain("command: 'cleanup'");
|
expect(js).toContain("command: 'cleanup'");
|
||||||
expect(js).toContain("args: ['--all']");
|
expect(js).toContain("args: ['--all']");
|
||||||
|
|
@ -775,12 +781,12 @@ describe('cleanup and screenshot buttons', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sidepanel.js cleanup resets inspector state after success', () => {
|
test('sidepanel.js cleanup resets inspector state after success', () => {
|
||||||
// After cleanup, inspector data is stale
|
// runCleanup should call inspectorShowEmpty after cleanup
|
||||||
const cleanupSection = js.slice(
|
const cleanupFn = js.slice(
|
||||||
js.indexOf('inspector-cleanup-btn'),
|
js.indexOf('async function runCleanup('),
|
||||||
js.indexOf('// ─── Screenshot'),
|
js.indexOf('async function runScreenshot('),
|
||||||
);
|
);
|
||||||
expect(cleanupSection).toContain('inspectorShowEmpty');
|
expect(cleanupFn).toContain('inspectorShowEmpty');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sidepanel.js has notification rendering for type notification', () => {
|
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');
|
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', () => {
|
test('sidepanel.css contains chat-notification styles', () => {
|
||||||
expect(css).toContain('.chat-notification');
|
expect(css).toContain('.chat-notification');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue