"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const Mocks_1 = require("../../Babylon/Mocks");
const TouchInput_1 = require("../../TouchController/Entities/TouchInput");
const Mock_1 = require("../../TouchController/Mock");
const ToggleLabelDropTargetUcMock_1 = require("../Mocks/ToggleLabelDropTargetUcMock");
const TouchLabelDropAuthor_1 = require("./TouchLabelDropAuthor");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const touchInput = (0, TouchInput_1.makeTouchInput)(appObjects.getOrCreate("Input"));
    const registerSpy = jest.spyOn(touchInput, "registerController");
    const mockUC = (0, ToggleLabelDropTargetUcMock_1.makeToggleLabelDropTargetUcMock)(appObjects);
    const touchLabelDrop = (0, TouchLabelDropAuthor_1.makeTouchLabelDropAuthor)(appObjects.getOrCreate("AO"));
    (0, Mocks_1.makeMockPixelToSceneRayUC)(appObjects).pixelToSceneRay.mockReturnValue(core_2.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 = (0, Mock_1.mockTouchInputEvent)([new core_2.Vector2(2, 3)]);
        touchLabelDrop.onTap(evt);
        expect(mockUC.tryToggleFromPixel).toHaveBeenCalledWith(new core_2.Vector2(2, 3));
    });
});
//# sourceMappingURL=TouchLabelDropAuthor.test.js.map