fix(tui): sync test awaits with throttled render pipeline (#3076)
Tests assumed renders complete synchronously after requestRender() +
nextTick + flush(), but commit 6f5f37f8 changed requestRender() to
schedule via setTimeout with a 16ms minimum interval. Tests reading
viewport state before doRender() runs saw stale data.
Add VirtualTerminal.waitForRender() helper that waits for the throttled
render to settle (nextTick + 20ms + xterm flush), and replace all
terminal.flush() calls after render-triggering actions with it.
Fixes 8 failing tests across overlay-short-content, tui-render, and
markdown test suites.
This commit is contained in:
@@ -592,7 +592,7 @@ describe("Markdown component", () => {
|
||||
const component = new MarkdownWithInput(markdown);
|
||||
tui.addChild(component);
|
||||
tui.start();
|
||||
await terminal.flush();
|
||||
await terminal.waitForRender();
|
||||
|
||||
assert.ok(component.markdownLineCount > 0);
|
||||
const inputRow = component.markdownLineCount;
|
||||
@@ -1032,7 +1032,7 @@ bar`,
|
||||
const tui = new TUI(terminal);
|
||||
tui.addChild(markdown);
|
||||
tui.start();
|
||||
await terminal.flush();
|
||||
await terminal.waitForRender();
|
||||
|
||||
const renderedLine = markdown.render(80)[0];
|
||||
assert.ok(renderedLine, "Should render heading line");
|
||||
|
||||
Reference in New Issue
Block a user