test: support tests that include color information (#20220)

This commit is contained in:
Jacob Richman
2026-02-25 15:31:35 -08:00
committed by GitHub
parent 78dfe9dea8
commit f9f916e1dc
68 changed files with 2342 additions and 492 deletions
@@ -263,16 +263,11 @@ describe('SettingsDialog', () => {
const settings = createMockSettings();
const onSelect = vi.fn();
const { lastFrame, waitUntilReady, unmount } = renderDialog(
settings,
onSelect,
);
await waitUntilReady();
const renderResult = renderDialog(settings, onSelect);
await renderResult.waitUntilReady();
const output = lastFrame();
// Use snapshot to capture visual layout including indicators
expect(output).toMatchSnapshot();
unmount();
await expect(renderResult).toMatchSvgSnapshot();
renderResult.unmount();
});
it('should use almost full height of the window but no more when the window height is 25 rows', async () => {
@@ -1830,18 +1825,15 @@ describe('SettingsDialog', () => {
});
const onSelect = vi.fn();
const { lastFrame, stdin, waitUntilReady, unmount } = renderDialog(
settings,
onSelect,
);
await waitUntilReady();
const renderResult = renderDialog(settings, onSelect);
await renderResult.waitUntilReady();
if (stdinActions) {
await stdinActions(stdin, waitUntilReady);
await stdinActions(renderResult.stdin, renderResult.waitUntilReady);
}
expect(lastFrame()).toMatchSnapshot();
unmount();
await expect(renderResult).toMatchSvgSnapshot();
renderResult.unmount();
},
);
});