Cover the real provider switch and share chat Settings and stop checks

- Host test switches AI Provider from chat Settings through the real
  provider commands and checks the new mount keeps chat's context, frame,
  Back to chat and focus on the provider choice.
- Drop the open and minimized branches of the carried presentation: the
  provider choice lives only in Settings, so chat is never open then.
- One showChatSettings helper for the gear and the restore, and one
  isStoppable helper for the live-or-error check in chat and the panel close.
This commit is contained in:
manjunath22466 committed 2026-11-05 00:17:08 +05:30
1 parent 46dde909cc
commit 3577d19513
9 files changed
+99 -58

No files matched your search

+50
View File
@@ -1319,6 +1319,56 @@ test('opening chat or closing the voice panel clears a stale voice error', async
}
});
test('switching AI Provider from chat Settings keeps chat Settings on the new mount', async (t) => {
const view = mountVoiceView(t);
const host = createVoicePanelHost({ storage: null });
const instances = [];
const commands = createProviderCommands(
{
runner: async () => ({}),
dataManager: { layers: new Map() },
supportedProviders: ['openai', 'gemini'],
},
{
bind: (options) =>
bind({
...options,
panelHost: host,
createControl: (control) =>
createTestVoiceUi({ ...control, pinia: view.pinia }),
}),
factories: { openai: factory(instances), gemini: factory(instances) },
storage: null,
},
);
t.after(() => {
commands.destroy();
host.destroy();
});
await view.settle();
$('#gev-chat-button').click();
await view.settle();
$('#gev-chat-panel').getBoundingClientRect = () => ({
width: 320,
height: 480,
});
$('#gev-voice-settings-button').click();
await view.settle();
const old = commands.ui;
assert.equal(old.state.voicePanel.context, 'chat');
old.emit('provider-change', 'gemini');
await view.settle();
const { ui } = commands;
assert.notEqual(ui, old);
assert.equal(ui.state.voicePanel.context, 'chat');
assert.equal(ui.state.voicePanel.frameWidth, 320);
assert.equal(ui.state.voicePanel.frameHeight, 480);
assert.equal(ui.state.chat.backVisible, true);
assert.equal(ui.state.root.assistantMode, 'chat');
assert.equal($('#gev-chat-back').hidden, false);
assert.equal(active(), 'gev-voice-provider');
});
test('the voice panel close turns voice off', async (t) => {
const f = mounted(t, { view: true });
await f.commands.session.start();