fix: tab title was broken

This commit is contained in:
2026-02-22 22:43:44 +01:00
parent 7cb47e0aa5
commit 94b7ca2c80
7 changed files with 129 additions and 2 deletions

View File

@@ -69,6 +69,10 @@ describe('TabBar', () => {
get: vi.fn(),
onNameUpdated: vi.fn(() => () => {}),
},
scripts: {
...(window as any).electronAPI?.scripts,
get: vi.fn(),
},
};
});
@@ -136,4 +140,24 @@ describe('TabBar', () => {
expect(await screen.findByText('Updated Title')).toBeInTheDocument();
});
it('renders script title for script tab', async () => {
useAppStore.setState({
tabs: [{ type: 'scripts', id: 'script-1', isTransient: false }],
activeTabId: 'script-1',
posts: [],
media: [],
dirtyPosts: new Set<string>(),
});
(window as any).electronAPI.scripts.get = vi.fn().mockResolvedValue({
id: 'script-1',
title: 'Publish Macro',
});
render(<TabBar />);
expect(await screen.findByText('Publish Macro')).toBeInTheDocument();
expect((window as any).electronAPI.scripts.get).toHaveBeenCalledWith('script-1');
});
});