Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

test(editor): hold the speed and preset fixtures to the new bounds

EtienneLescotcce20db3ffba
diff --git a/src/components/ai-edition/v4/SpeedControl.test.tsx b/src/components/ai-edition/v4/SpeedControl.test.tsx
index 639be608a..4480e347c 100644
--- a/src/components/ai-edition/v4/SpeedControl.test.tsx
+++ b/src/components/ai-edition/v4/SpeedControl.test.tsx
@@ -33,11 +33,11 @@ describe("SpeedControl", () => {
it("commits a free-typed speed above the preset ceiling", () => {
// The regression this control exists for: the V4 shell only offered presets up to 3×,
- // while the underlying capability reaches 100×.
+ // while the underlying capability reaches 16× (`SETTING_BOUNDS.playbackSpeed`).
const { updateSpeedValue, field } = renderControl(1);
- fireEvent.change(field, { target: { value: "25" } });
+ fireEvent.change(field, { target: { value: "12" } });
fireEvent.blur(field);
- expect(updateSpeedValue).toHaveBeenCalledWith("sp1", 25);
+ expect(updateSpeedValue).toHaveBeenCalledWith("sp1", 12);
});
it("commits on Enter as well as on blur, and only once", () => {
@@ -54,7 +54,7 @@ describe("SpeedControl", () => {
fireEvent.change(field, { target: { value: "500" } });
fireEvent.blur(field);
expect(updateSpeedValue).not.toHaveBeenCalled();
- expect(toastError).toHaveBeenCalledWith("speed.maxSpeedError:100");
+ expect(toastError).toHaveBeenCalledWith("speed.maxSpeedError:16");
});
it("ignores an unparseable draft without touching the region", () => {
@@ -84,11 +84,11 @@ describe("SpeedControl", () => {
});
it("does not misreport a custom speed as a preset", () => {
- // 25× matches no preset: no button may claim it, and the field reads it back instead.
- renderControl(25);
+ // 12× matches no preset: no button may claim it, and the field reads it back instead.
+ renderControl(12);
for (const button of screen.getAllByRole("button")) {
expect(button).toHaveAttribute("aria-pressed", "false");
}
- expect(screen.getByPlaceholderText("25×")).toBeInTheDocument();
+ expect(screen.getByPlaceholderText("12×")).toBeInTheDocument();
});
});
diff --git a/src/lib/ai-edition/stylePresetsEditor.test.ts b/src/lib/ai-edition/stylePresetsEditor.test.ts
index 05c5987bd..e199a05e6 100644
--- a/src/lib/ai-edition/stylePresetsEditor.test.ts
+++ b/src/lib/ai-edition/stylePresetsEditor.test.ts
@@ -45,10 +45,10 @@ function styledSettings(): EditorSettingsSnapshot {
webcamWallpaper: "#123456",
webcamBlurIntensity: 0.9,
cursor: {
- size: 5,
+ size: 2.5,
smoothing: 0.1,
motionBlur: 0.9,
- clickBounce: 4,
+ clickBounce: 1.5,
model3d: true,
alwaysArrow: false,
},
@@ -69,8 +69,8 @@ describe("stylePresetsEditor", () => {
it("copies the cursor rather than sharing it", () => {
const settings = styledSettings();
const appearance = stylePresetAppearanceFromSettings(settings);
- appearance.cursor.size = 9;
- expect(settings.cursor.size).toBe(5);
+ appearance.cursor.size = 3;
+ expect(settings.cursor.size).toBe(2.5);
expect(appearance.cursor).not.toHaveProperty("autoHide");
});