fix(coding-agent): tighten startup splash review coverage
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/** Inputs used to decide whether the optional startup splash may run for this process. */
|
||||
export interface StartupSplashDecisionOptions {
|
||||
readonly configured: boolean;
|
||||
readonly isInteractive: boolean;
|
||||
@@ -8,6 +9,7 @@ export interface StartupSplashDecisionOptions {
|
||||
readonly stdoutIsTTY: boolean | undefined;
|
||||
}
|
||||
|
||||
/** Returns true only for explicitly enabled, normal interactive TTY startup. */
|
||||
export function shouldShowStartupSplash(options: StartupSplashDecisionOptions): boolean {
|
||||
if (!options.configured) return false;
|
||||
if (!options.isInteractive) return false;
|
||||
|
||||
@@ -32,19 +32,24 @@ describe("startup splash", () => {
|
||||
});
|
||||
|
||||
it("shows and hides a fullscreen setup-splash overlay", async () => {
|
||||
const preSplashEditor: Component = { render: () => [] };
|
||||
let hidden = false;
|
||||
let renderRequests = 0;
|
||||
let focused: Component | undefined;
|
||||
let focused: Component | undefined = preSplashEditor;
|
||||
let overlayComponent: Component | undefined;
|
||||
|
||||
const ctx = {
|
||||
ui: {
|
||||
terminal: { rows: 8 },
|
||||
showOverlay: (component: Component) => {
|
||||
overlayComponent = component;
|
||||
const preFocus = focused;
|
||||
focused = component;
|
||||
return {
|
||||
hide: () => {
|
||||
hidden = true;
|
||||
if (focused === component) {
|
||||
focused = preFocus;
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -61,7 +66,7 @@ describe("startup splash", () => {
|
||||
|
||||
expect(hidden).toBe(true);
|
||||
expect(renderRequests).toBeGreaterThan(0);
|
||||
expect(focused).toBe(overlayComponent);
|
||||
expect(focused).toBe(preSplashEditor);
|
||||
expect(overlayComponent?.render(32)).toHaveLength(8);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user