mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-15 17:08:21 -04:00
fix(tui): stop disabled tab pulse rendering (#42346)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user