style(tui): simplify picker overflow indicator
This commit is contained in:
1 parent
740e39b1ca
commit
509304f9bb
3 files changed
+7
-7
No files matched your search
+2
-2
@@ -1503,13 +1503,13 @@ describe("NanobotTui layout", () => {
|
|||||||
await waitUntil(() => ui.runtimeControls.visible)
|
await waitUntil(() => ui.runtimeControls.visible)
|
||||||
await setup.flush()
|
await setup.flush()
|
||||||
expect(ui.runtimeControls.menuRoot.getChildren()).toHaveLength(9)
|
expect(ui.runtimeControls.menuRoot.getChildren()).toHaveLength(9)
|
||||||
expect(setup.captureCharFrame()).toContain("1–8 of 11 · ↓")
|
expect(setup.captureCharFrame()).toContain("1–8 of 11 ↓")
|
||||||
expect(setup.captureCharFrame()).not.toContain("preset-8")
|
expect(setup.captureCharFrame()).not.toContain("preset-8")
|
||||||
|
|
||||||
for (let index = 0; index < 9; index += 1) setup.mockInput.pressArrow("down")
|
for (let index = 0; index < 9; index += 1) setup.mockInput.pressArrow("down")
|
||||||
await setup.flush()
|
await setup.flush()
|
||||||
expect(setup.captureCharFrame()).toContain("› preset-8")
|
expect(setup.captureCharFrame()).toContain("› preset-8")
|
||||||
expect(setup.captureCharFrame()).toContain("3–10 of 11 · ↑↓")
|
expect(setup.captureCharFrame()).toContain("3–10 of 11 ↑↓")
|
||||||
|
|
||||||
setup.mockInput.pressEnter()
|
setup.mockInput.pressEnter()
|
||||||
await waitUntil(() => sent.includes("/model preset-8"))
|
await waitUntil(() => sent.includes("/model preset-8"))
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ describe("PickerMenu", () => {
|
|||||||
await setup.renderOnce()
|
await setup.renderOnce()
|
||||||
|
|
||||||
expect(menu.root.getChildren().filter((child) => child.id !== "test-picker-overflow")).toHaveLength(3)
|
expect(menu.root.getChildren().filter((child) => child.id !== "test-picker-overflow")).toHaveLength(3)
|
||||||
expect(setup.captureCharFrame()).toContain("1–3 of 5 · ↓")
|
expect(setup.captureCharFrame()).toContain("1–3 of 5 ↓")
|
||||||
expect(setup.captureCharFrame()).not.toContain("Choice 3")
|
expect(setup.captureCharFrame()).not.toContain("Choice 3")
|
||||||
|
|
||||||
menu.move(1)
|
menu.move(1)
|
||||||
@@ -50,7 +50,7 @@ describe("PickerMenu", () => {
|
|||||||
menu.move(1)
|
menu.move(1)
|
||||||
await setup.flush()
|
await setup.flush()
|
||||||
expect(menu.current()?.id).toBe("3")
|
expect(menu.current()?.id).toBe("3")
|
||||||
expect(setup.captureCharFrame()).toContain("2–4 of 5 · ↑↓")
|
expect(setup.captureCharFrame()).toContain("2–4 of 5 ↑↓")
|
||||||
expect(setup.captureCharFrame()).toContain("› Choice 3")
|
expect(setup.captureCharFrame()).toContain("› Choice 3")
|
||||||
expect(setup.captureCharFrame()).not.toContain("Choice 0")
|
expect(setup.captureCharFrame()).not.toContain("Choice 0")
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ describe("PickerMenu", () => {
|
|||||||
menu.move(-1)
|
menu.move(-1)
|
||||||
await setup.flush()
|
await setup.flush()
|
||||||
expect(menu.current()?.id).toBe("4")
|
expect(menu.current()?.id).toBe("4")
|
||||||
expect(setup.captureCharFrame()).toContain("3–5 of 5 · ↑")
|
expect(setup.captureCharFrame()).toContain("3–5 of 5 ↑")
|
||||||
|
|
||||||
const firstVisible = menu.root.getChildren()[0] as TextRenderable | undefined
|
const firstVisible = menu.root.getChildren()[0] as TextRenderable | undefined
|
||||||
if (!firstVisible) throw new Error("picker row was not rendered")
|
if (!firstVisible) throw new Error("picker row was not rendered")
|
||||||
@@ -88,7 +88,7 @@ describe("PickerMenu", () => {
|
|||||||
await setup.renderOnce()
|
await setup.renderOnce()
|
||||||
expect(menu.current()?.id).toBe("d")
|
expect(menu.current()?.id).toBe("d")
|
||||||
expect(setup.captureCharFrame()).toContain("› Choice d")
|
expect(setup.captureCharFrame()).toContain("› Choice d")
|
||||||
expect(setup.captureCharFrame()).toContain("2–3 of 3 · ↑")
|
expect(setup.captureCharFrame()).toContain("2–3 of 3 ↑")
|
||||||
|
|
||||||
menu.update("e", 2)
|
menu.update("e", 2)
|
||||||
await setup.flush()
|
await setup.flush()
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ export class PickerMenu<T> {
|
|||||||
const directions = `${this.windowStart > 0 ? "↑" : ""}${end < this.matches.length ? "↓" : ""}`
|
const directions = `${this.windowStart > 0 ? "↑" : ""}${end < this.matches.length ? "↓" : ""}`
|
||||||
this.root.add(new TextRenderable(this.renderer, {
|
this.root.add(new TextRenderable(this.renderer, {
|
||||||
id: `${this.options.id}-overflow`,
|
id: `${this.options.id}-overflow`,
|
||||||
content: ` ${this.windowStart + 1}–${end} of ${this.matches.length} · ${directions}`,
|
content: ` ${this.windowStart + 1}–${end} of ${this.matches.length} ${directions}`,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: 1,
|
height: 1,
|
||||||
wrapMode: "none",
|
wrapMode: "none",
|
||||||
|
|||||||
Reference in new issue
Block a user