Files
openchamber/packages/ui/src/stores/useUIStore.contextPanel.test.ts
T
Bohdan Triapitsyn 0fef61e25f fix: sync context panel iframe themes
Keeps embedded sessions aligned with parent theme
Prevents iframe reloads on theme changes
Supports theme hotkeys from focused iframes
2026-06-16 23:33:29 +03:00

31 lines
853 B
TypeScript

import { beforeEach, describe, expect, test } from 'bun:test';
import { useUIStore } from './useUIStore';
beforeEach(() => {
useUIStore.setState({ contextPanelByDirectory: {} });
});
describe('useUIStore context panel tabs', () => {
test('updates readOnly when an existing chat tab is reopened', () => {
const directory = '/repo';
useUIStore.getState().openContextPanelTab(directory, {
mode: 'chat',
dedupeKey: 'session:ses_1',
label: 'Session',
readOnly: true,
});
useUIStore.getState().openContextPanelTab(directory, {
mode: 'chat',
dedupeKey: 'session:ses_1',
label: 'Session',
readOnly: false,
});
const tabs = useUIStore.getState().contextPanelByDirectory[directory]?.tabs ?? [];
expect(tabs).toHaveLength(1);
expect(tabs[0]?.readOnly).toBe(false);
});
});