import { makeAppObjectRepo } from "@vived/core";
import { ParametricLine, Vector2 } from "@vived/core";
import { makeMockPixelToSceneRayUC } from "../../Babylon/Mocks";
import { makeTouchInput } from "../../TouchController/Entities/TouchInput";
import { mockTouchInputEvent } from "../../TouchController/Mock";
import { makeToggleLabelDropTargetUcMock } from "../Mocks/ToggleLabelDropTargetUcMock";
import { makeTouchLabelDropAuthor } from "./TouchLabelDropAuthor";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const touchInput = makeTouchInput(appObjects.getOrCreate("Input"));
    const registerSpy = jest.spyOn(touchInput, "registerController");
    const mockUC = makeToggleLabelDropTargetUcMock(appObjects);
    const touchLabelDrop = makeTouchLabelDropAuthor(appObjects.getOrCreate("AO"));
    makeMockPixelToSceneRayUC(appObjects).pixelToSceneRay.mockReturnValue(ParametricLine.Forward());
    return {
        appObjects,
        mockUC,
        touchLabelDrop,
        registerSpy,
    };
}
describe("Touch Label Drop Controller", () => {
    it("Registers with the mouse input when constructed", () => {
        const { registerSpy, touchLabelDrop } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(touchLabelDrop);
    });
    it("Calls the UC on tap", () => {
        const { touchLabelDrop, mockUC } = makeTestRig();
        const evt = mockTouchInputEvent([new Vector2(2, 3)]);
        touchLabelDrop.onTap(evt);
        expect(mockUC.tryToggleFromPixel).toHaveBeenCalledWith(new Vector2(2, 3));
    });
});
//# sourceMappingURL=TouchLabelDropAuthor.test.js.map