Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions apps/desktop/src/main/__tests__/agent-graph-panel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,37 @@ async function renderPanel(
return harness;
}

describe('AgentGraphPanel collapse', () => {
it('keeps the disclosure state and controlled content in sync', async () => {
Comment thread
1625567290 marked this conversation as resolved.
Resolved
const harness = await renderPanel(snapshot({ graphId: 'graph-1', status: 'active' }));
const panel = harness.container.querySelector('.maka-agent-graph-panel');
const toggle = harness.container.querySelector('.maka-agent-graph-collapse-toggle');
assert.ok(panel);
assert.ok(toggle);
const contentId = toggle.getAttribute('aria-controls');
assert.ok(contentId);

assert.equal(toggle.getAttribute('aria-expanded'), 'true');
assert.equal(panel.getAttribute('data-collapsed'), 'false');
assert.ok(harness.container.querySelector(`#${contentId}`));

await act(async () => {
(toggle as HTMLElement).click();
});
assert.equal(toggle.getAttribute('aria-expanded'), 'false');
Comment thread
1625567290 marked this conversation as resolved.
Resolved
assert.equal(panel.getAttribute('data-collapsed'), 'true');
assert.equal(harness.container.querySelector(`#${contentId}`), null);

await act(async () => {
(toggle as HTMLElement).click();
});
assert.equal(toggle.getAttribute('aria-expanded'), 'true');
assert.equal(panel.getAttribute('data-collapsed'), 'false');
assert.ok(harness.container.querySelector(`#${contentId}`));
await act(async () => harness.root.unmount());
});
});

describe('AgentGraphPanel dismiss', () => {
it('keeps the new session loading when a disposed read settles later', async () => {
const sessionA = snapshot({ graphId: 'graph-a', status: 'active' });
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/renderer/styles/agent-graph.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
transition: transform var(--duration-quick) var(--ease-out-strong);
}

.maka-agent-graph-collapse-toggle[aria-expanded="true"] svg {
.maka-agent-graph-collapse-toggle[aria-expanded="false"] svg {
transform: rotate(180deg);
}

Expand Down