|
|
@@ -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)
|