mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* docs: design terminal host management * feat: add work-surface host editor state * feat: add work-surface host editor layer * feat: add host creation and edit menu actions * feat: expose host management from terminal tree * feat: edit hosts without leaving terminal * fix: keep host editor subpanels interactive * fix: keep terminal host toolbar unchanged * chore: exclude internal design notes from PR * fix: preserve terminal host editor state * fix: harden terminal host editor interactions * fix: fully hide inactive host editor --------- Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
import React from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
|
|
import { PortalContainerProvider, usePortalContainer } from './portal-container';
|
|
|
|
test('portal container is available to nested editor controls', () => {
|
|
const marker = {} as HTMLElement;
|
|
const Probe = () => <span>{usePortalContainer() === marker ? 'inside' : 'outside'}</span>;
|
|
|
|
assert.equal(
|
|
renderToStaticMarkup(
|
|
<PortalContainerProvider container={marker}>
|
|
<Probe />
|
|
</PortalContainerProvider>,
|
|
),
|
|
'<span>inside</span>',
|
|
);
|
|
});
|
|
|
|
test('editor dropdown primitives use the scoped portal container', () => {
|
|
for (const file of ['popover.tsx', 'select.tsx', 'tooltip.tsx']) {
|
|
const source = readFileSync(new URL(`./${file}`, import.meta.url), 'utf8');
|
|
assert.match(source, /usePortalContainer\(\)/);
|
|
assert.match(source, /Portal container=\{portalContainer \?\? undefined\}/);
|
|
}
|
|
});
|