import { describe, expect, it } from 'vitest'; import { resolveExclusiveVisibleChildId } from '../src/view/ui-editor/components/preview/exclusiveVisibility'; describe('resolveExclusiveVisibleChildId', () => { const children = [{ id: 'first' }, { id: 'second' }]; it('defaults to the first child on initial load', () => { expect(resolveExclusiveVisibleChildId(children, new Set())).toBe('first'); }); it('uses the first non-hidden child as the explicit selection', () => { expect(resolveExclusiveVisibleChildId(children, new Set(['first']))).toBe( 'second', ); }); it('keeps every child hidden after a manual hide-all action', () => { expect( resolveExclusiveVisibleChildId(children, new Set(['first', 'second'])), ).toBeNull(); }); it('returns null for an empty exclusive container', () => { expect(resolveExclusiveVisibleChildId([], new Set())).toBeNull(); }); });