Show USB/drop JPEGs in the library from a local blob before upload finishes, and expose LightCraft spot remove/heal/clone/fill in Revelar without waiting on generative AI or a WASM rebuild.
22 lines
1.0 KiB
TypeScript
22 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { addSpot, removeSpotAt, spotsOf, spotsPartial } from "./spots.js";
|
|
|
|
describe("spots", () => {
|
|
it("adds a fill spot and round-trips through merge partial", () => {
|
|
const settings = "{}";
|
|
const next = addSpot(settings, { mode: "fill", x: 0.4, y: 0.6, size: 0.03, feather: 40, opacity: 100 });
|
|
expect(next).toHaveLength(1);
|
|
expect(next[0]?.mode).toBe("fill");
|
|
expect(next[0]?.points[0]).toEqual({ x: 0.4, y: 0.6 });
|
|
const merged = JSON.stringify({ ...JSON.parse(settings), ...spotsPartial(next) });
|
|
expect(spotsOf(merged)).toEqual(next);
|
|
});
|
|
|
|
it("removes by index", () => {
|
|
let spots = addSpot("{}", { mode: "remove", x: 0.1, y: 0.1, size: 0.02, feather: 50, opacity: 100 });
|
|
spots = addSpot(JSON.stringify({ spots }), { mode: "heal", x: 0.2, y: 0.2, size: 0.02, feather: 50, opacity: 100 });
|
|
expect(removeSpotAt(JSON.stringify({ spots }), 0)).toHaveLength(1);
|
|
expect(removeSpotAt(JSON.stringify({ spots }), 0)[0]?.mode).toBe("heal");
|
|
});
|
|
});
|