"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const MouseInput_1 = require("../../MouseInput/Entities/MouseInput");
const ToggleLabelDropTargetUcMock_1 = require("../Mocks/ToggleLabelDropTargetUcMock");
const MouseLabelDropAuthor_1 = require("./MouseLabelDropAuthor");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const mouseInput = (0, MouseInput_1.makeMouseInput)(appObjects.getOrCreate("Input"));
    const registerSpy = jest.spyOn(mouseInput, "registerController");
    const mockUC = (0, ToggleLabelDropTargetUcMock_1.makeToggleLabelDropTargetUcMock)(appObjects);
    const controller = (0, MouseLabelDropAuthor_1.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 core_2.Vector2(2, 3),
            button: 0,
            event: new MouseEvent("buttondown"),
        };
        controller.onClick(evt);
        expect(mockUC.tryToggleFromPixel).toHaveBeenCalledWith(new core_2.Vector2(2, 3));
    });
    it("Registers with the mouse input when constructed", () => {
        const { registerSpy, controller } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(controller);
    });
});
//# sourceMappingURL=MouseLabelDropAuthor.test.js.map