fix(tui): stop disabled tab pulse rendering (#42346)

This commit is contained in:
Kit Langton
2026-08-13 15:56:36 -04:00
committed by GitHub
parent 90fd61225e
commit 4836356c17
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ class PulseState {
}
get live() {
return this.active || this.breathing || this.envelopes.some(envelopeActive)
return this.enabled && (this.active || this.breathing || this.envelopes.some(envelopeActive))
}
get running() {
@@ -1,6 +1,10 @@
import { expect, test } from "bun:test"
/** @jsxImportSource @opentui/solid */
import { RGBA } from "@opentui/core"
import { testRender } from "@opentui/solid"
import { createSignal } from "solid-js"
import {
TabPulse,
blendTabPulseColor,
completionPulseOpacity,
glowIgnitionLevel,
@@ -9,6 +13,26 @@ import {
} from "../../src/component/tab-pulse"
import { tint } from "../../src/theme/color"
test("a disabled pulse stays idle when it becomes active", async () => {
const background = RGBA.fromHex("#101010")
const [active, setActive] = createSignal(false)
const app = await testRender(
() => <TabPulse enabled={false} active={active()} color={background} backgroundColor={background} />,
{ width: 8, height: 1 },
)
try {
await app.renderOnce()
expect(app.renderer.root.liveCount).toBe(0)
setActive(true)
await app.renderOnce()
expect(app.renderer.root.liveCount).toBe(0)
} finally {
app.renderer.destroy()
}
})
test("completion pulse rises quickly and fades over the remaining duration", () => {
expect(completionPulseOpacity(0)).toBe(0)
expect(completionPulseOpacity(0.06)).toBeCloseTo(0.5)