Migrate core render util to use xterm.js as part of the rendering loop. (#19044)

This commit is contained in:
Jacob Richman
2026-02-18 16:46:50 -08:00
committed by GitHub
parent 04c52513e7
commit 04f65f3d55
213 changed files with 7065 additions and 3852 deletions

View File

@@ -27,40 +27,46 @@ vi.mock('../../config/settings.js', () => ({
}));
describe('ContextUsageDisplay', () => {
it('renders correct percentage left', () => {
const { lastFrame } = render(
it('renders correct percentage left', async () => {
const { lastFrame, waitUntilReady, unmount } = render(
<ContextUsageDisplay
promptTokenCount={5000}
model="gemini-pro"
terminalWidth={120}
/>,
);
await waitUntilReady();
const output = lastFrame();
expect(output).toContain('50% context left');
unmount();
});
it('renders short label when terminal width is small', () => {
const { lastFrame } = render(
it('renders short label when terminal width is small', async () => {
const { lastFrame, waitUntilReady, unmount } = render(
<ContextUsageDisplay
promptTokenCount={2000}
model="gemini-pro"
terminalWidth={80}
/>,
);
await waitUntilReady();
const output = lastFrame();
expect(output).toContain('80%');
expect(output).not.toContain('context left');
unmount();
});
it('renders 0% when full', () => {
const { lastFrame } = render(
it('renders 0% when full', async () => {
const { lastFrame, waitUntilReady, unmount } = render(
<ContextUsageDisplay
promptTokenCount={10000}
model="gemini-pro"
terminalWidth={120}
/>,
);
await waitUntilReady();
const output = lastFrame();
expect(output).toContain('0% context left');
unmount();
});
});