* feat(chat): render code comments as cards instead of fenced text * fix(vscode): route Add Comment to the active session editor panel * fix(chat): persist queued inline comments and tighten file-chip path matching * feat(vscode): comment on code from the editor * fix(chat): keep attached context in the message and broadcast comment removal * fix(vscode): hold every pending comment and gate both entry points on the workspace * fix(vscode): let only the owning surface decide its comment threads * fix(vscode): drop a comment removed while its delivery was still in flight * test(vscode): cover the in-flight comment removal guard * test(vscode): cover comment removal reaching every chat surface * fix(vscode): give up on a comment the chat never confirmed holding * fix(vscode): retract a comment everywhere before reporting it discarded * fix(chat): preserve queued comment cards * fix: preserve inline comment context across send paths * fix(chat): preserve command routing with context * fix(chat): keep unavailable actions on normal send path --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { pickActivePanelId } from './activePanelRouting';
|
|
|
|
describe('pickActivePanelId', () => {
|
|
test('returns null when there are no panels and no recent panel', () => {
|
|
assert.equal(pickActivePanelId([], null), null);
|
|
});
|
|
|
|
test('falls back to the last active panel when none is currently focused', () => {
|
|
// A chat panel exists but the user is focused elsewhere (e.g. the code editor).
|
|
const panels = [{ id: 'ses_a', active: false }];
|
|
assert.equal(pickActivePanelId(panels, 'ses_a'), 'ses_a');
|
|
});
|
|
|
|
test('prefers the currently focused panel over the last active one', () => {
|
|
const panels = [
|
|
{ id: 'ses_a', active: false },
|
|
{ id: 'ses_b', active: true },
|
|
];
|
|
assert.equal(pickActivePanelId(panels, 'ses_a'), 'ses_b');
|
|
});
|
|
|
|
test('uses the focused panel even when there is no recorded last active panel', () => {
|
|
assert.equal(pickActivePanelId([{ id: 'ses_b', active: true }], null), 'ses_b');
|
|
});
|
|
|
|
test('returns the last active panel when no panel is focused', () => {
|
|
const panels = [
|
|
{ id: 'ses_a', active: false },
|
|
{ id: 'ses_b', active: false },
|
|
];
|
|
assert.equal(pickActivePanelId(panels, 'ses_b'), 'ses_b');
|
|
});
|
|
|
|
test('returns null when nothing is focused and there is no recent panel', () => {
|
|
assert.equal(pickActivePanelId([{ id: 'ses_a', active: false }], null), null);
|
|
});
|
|
});
|