mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
46dde909cc
commit
3577d19513
9 files changed
+99
-58
No files matched your search
@@ -365,7 +365,7 @@ test('the chat gear is named for the settings it opens', async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test('a provider switch carries chat Settings or chat itself to the next mount', async (t) => {
|
||||
test('a provider switch carries chat Settings to the next mount', async (t) => {
|
||||
const mount = () => {
|
||||
const ui = createTestVoiceUi({ panel: true });
|
||||
const chat = bindChatControl({ ui, session: typedSession() });
|
||||
@@ -377,21 +377,22 @@ test('a provider switch carries chat Settings or chat itself to the next mount',
|
||||
before.ui.emit('chat-button');
|
||||
before.ui.update('voicePanel', { hidden: false });
|
||||
before.ui.emit('settings-button');
|
||||
before.ui.update('voicePanel', { frameWidth: 320, frameHeight: 480 });
|
||||
const settings = before.chat.presentation();
|
||||
assert.equal(settings.view, 'settings');
|
||||
assert.deepEqual(settings, {
|
||||
view: 'settings',
|
||||
frame: { width: 320, height: 480 },
|
||||
});
|
||||
const after = mount();
|
||||
after.chat.restorePresentation(settings);
|
||||
assert.equal(after.ui.state.voicePanel.context, 'chat');
|
||||
assert.equal(after.ui.state.voicePanel.frameWidth, 320);
|
||||
assert.equal(after.ui.state.voicePanel.frameHeight, 480);
|
||||
assert.equal(after.ui.state.chat.backVisible, true);
|
||||
assert.equal(after.ui.state.root.assistantMode, 'chat');
|
||||
// Open and minimized chat come back as they were, without taking focus.
|
||||
for (const view of ['open', 'minimized']) {
|
||||
const next = mount();
|
||||
next.chat.restorePresentation({ view });
|
||||
assert.equal(next.ui.state.chat.open, true);
|
||||
assert.equal(next.ui.state.chat.minimized, view === 'minimized');
|
||||
assert.equal(next.chat.presentation().view, view);
|
||||
}
|
||||
// Idle chat carries nothing.
|
||||
// Chat itself, or no chat at all, carries nothing.
|
||||
const open = mount();
|
||||
open.ui.emit('chat-button');
|
||||
assert.equal(open.chat.presentation(), null);
|
||||
assert.equal(mount().chat.presentation(), null);
|
||||
});
|
||||
Reference in new issue
Block a user