import { makeAppObjectRepo } from "@vived/core";
import { Vector2 } from "@vived/core";
import { makeMouseInput, } from "../../MouseInput/Entities/MouseInput";
import { makeToggleLabelDropTargetUcMock } from "../Mocks/ToggleLabelDropTargetUcMock";
import { makeMouseLabelDropAuthor } from "./MouseLabelDropAuthor";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const mouseInput = makeMouseInput(appObjects.getOrCreate("Input"));
    const registerSpy = jest.spyOn(mouseInput, "registerController");
    const mockUC = makeToggleLabelDropTargetUcMock(appObjects);
    const controller = makeMouseLabelDropAuthor(appObjects.getOrCreate("AO"));
    return {
        appObjects,
        registerSpy,
        mockUC,
        controller,
    };
}
describe("Mouse Label Drop Controller", () => {
    it("UC is called on click if", () => {
        const { controller, mockUC } = makeTestRig();
        const evt = {
            position: new Vector2(2, 3),
            button: 0,
            event: new MouseEvent("buttondown"),
        };
        controller.onClick(evt);
        expect(mockUC.tryToggleFromPixel).toHaveBeenCalledWith(new Vector2(2, 3));
    });
    it("Registers with the mouse input when constructed", () => {
        const { registerSpy, controller } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(controller);
    });
});
//# sourceMappingURL=MouseLabelDropAuthor.test.js.map