@ftrdotdev/pi-tui 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -339,3 +339,37 @@ it("stays glyph-free when vim is off", () => {
339
339
  assert.ok(!topBorderOf(editor).includes("V"));
340
340
  assert.ok(!topBorderOf(editor).includes("I"));
341
341
  });
342
+
343
+ // ---------------------------------------------------------------------------
344
+ // Embedded status indicator (pi 1.0 routes working/retry/compaction here)
345
+ // ---------------------------------------------------------------------------
346
+
347
+ /** Fake pi status indicator: fixed full and spinner strings, no animation. */
348
+ const fakeStatus = (full: string, spinner: string) =>
349
+ ({
350
+ renderInBorder: () => full,
351
+ renderSpinnerInBorder: () => spinner,
352
+ dispose: () => {},
353
+ }) as unknown as Parameters<CustomEditor["setWorkingStatusIndicator"]>[0];
354
+
355
+ it("renders an embedded status indicator in the top border", () => {
356
+ const editor = makeEditor();
357
+ editor.setWorkingStatusIndicator(fakeStatus("⠋ Working", "⠋"));
358
+ assert.ok(topBorderOf(editor).includes("Working"));
359
+ });
360
+
361
+ it("keeps the status spinner when the message does not fit the border", () => {
362
+ const editor = makeEditor();
363
+ editor.setWorkingStatusIndicator(fakeStatus("⠋ Working on a long task", "⠋"));
364
+ const top = editor.render(14)[0] ?? "";
365
+ assert.ok(top.includes("⠋"));
366
+ assert.ok(!top.includes("long task"));
367
+ });
368
+
369
+ it("returns to the plain border after the status indicator clears", () => {
370
+ const editor = makeEditor();
371
+ editor.setWorkingStatusIndicator(fakeStatus("⠋ Working", "⠋"));
372
+ assert.ok(topBorderOf(editor).includes("Working"));
373
+ editor.setWorkingStatusIndicator(undefined);
374
+ assert.ok(!topBorderOf(editor).includes("Working"));
375
+ });