mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
fix(tabs): leave the default-group options alone when the groups did not change
Merge-time fix for #676 (review nit 6). Once a Case settings popover had been opened, every adopted tab layout (each create, delete and reorder) replaced both selects' options, even with the popover hidden and the group list unchanged, so a session created elsewhere could reset a native dropdown the user had open. _refreshCaseDefaultGroupOptions now returns early when the ids and names are the same. A vm case pins it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a3efc9b963
commit
9b8cb82c3b
3 files changed
+30
-3
No files matched your search
@@ -137,6 +137,27 @@ describe('Case settings: Default session group selector', () => {
|
||||
expect(h.elements.caseDefaultGroupMobile.value).toBe('');
|
||||
});
|
||||
|
||||
it('leaves the options alone when a layout broadcast does not change the groups', async () => {
|
||||
const h = harness({
|
||||
groups: [
|
||||
{ id: 'g1', name: 'Core' },
|
||||
{ id: 'g2', name: 'Ops' },
|
||||
],
|
||||
groupId: 'g2',
|
||||
});
|
||||
await h.app._loadCaseDefaultGroup();
|
||||
const before = h.elements.caseDefaultGroup.options;
|
||||
// A session created or moved elsewhere: same groups, other refs.
|
||||
h.app._refreshCaseDefaultGroupOptions({
|
||||
groups: [
|
||||
{ id: 'g1', name: 'Core', refs: [{ kind: 'session', id: 's9' }] },
|
||||
{ id: 'g2', name: 'Ops', refs: [] },
|
||||
],
|
||||
});
|
||||
expect(h.elements.caseDefaultGroup.options).toBe(before); // not rebuilt, so an open dropdown stays open
|
||||
expect(h.elements.caseDefaultGroup.value).toBe('g2');
|
||||
});
|
||||
|
||||
it('the layout refresh is wired into _applyTabLayout', () => {
|
||||
const app = readFileSync(resolve(PUBLIC, 'app.js'), 'utf8');
|
||||
const body = app.slice(app.indexOf(' _applyTabLayout(layout) {'));
|
||||
|
||||
Reference in new issue
Block a user