mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
feat(player): add speed control with popup menu and CSS theming (#241)
Add playback speed control to the player controls bar: - Popup menu with logarithmic presets (0.25x-4x) - Custom presets via speed-presets attribute - Full CSS custom property theming (--hfp-accent, --hfp-controls-bg, etc.) - ratechange event dispatch - Exports: SPEED_PRESETS, formatSpeed, ControlsOptions - Fix package.json export condition ordering
This commit is contained in:
@@ -1,5 +1,29 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { formatTime } from "./controls.js";
|
||||
import { formatTime, formatSpeed, SPEED_PRESETS } from "./controls.js";
|
||||
|
||||
describe("SPEED_PRESETS", () => {
|
||||
it("contains logarithmic speed steps", () => {
|
||||
expect(SPEED_PRESETS).toEqual([0.25, 0.5, 1, 1.5, 2, 4]);
|
||||
});
|
||||
|
||||
it("includes 1x as default speed", () => {
|
||||
expect(SPEED_PRESETS).toContain(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatSpeed", () => {
|
||||
it("formats integer speeds", () => {
|
||||
expect(formatSpeed(1)).toBe("1x");
|
||||
expect(formatSpeed(2)).toBe("2x");
|
||||
expect(formatSpeed(4)).toBe("4x");
|
||||
});
|
||||
|
||||
it("formats fractional speeds", () => {
|
||||
expect(formatSpeed(0.25)).toBe("0.25x");
|
||||
expect(formatSpeed(0.5)).toBe("0.5x");
|
||||
expect(formatSpeed(1.5)).toBe("1.5x");
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatTime", () => {
|
||||
it("formats 0 seconds", () => {
|
||||
|
||||
Reference in New Issue
Block a user