Skip to main content

MockInputObject

Stand-in InputObject for PlayerMock.fireInput to hand a bound action, a real one not being Instance.new-able.

Only the fields are own-keys, so an instance handed to PlayerMock.fireServiceSignal still crosses the BindableEvent boundary with its values intact -- the methods, like any metatable, do not survive that copy.

Use PlayerMock.makeInputObject.

Functions

new

MockInputObject.new(propsInputObjectProps?) → MockInputObject

Constructs a stand-in input object, defaulting every unspecified field.

Use PlayerMock.makeInputObject.

GetPropertyChangedSignal

MockInputObject.GetPropertyChangedSignal(
propertyNamestring
) → Signal<()>

Returns the signal that fires when the given property changes, the same signal every time. Mirrors InputObject:GetPropertyChangedSignal(propertyName).

SetUserInputState

MockInputObject.SetUserInputState(
userInputStateEnum.UserInputState
) → ()

Sets UserInputState and fires its changed signal, which is how a test drives the press lifecycle -- ending a press the engine would have ended itself.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a stand-in input object, defaulting every unspecified field.\n\nUse [PlayerMock.makeInputObject].",
            "params": [
                {
                    "name": "props",
                    "desc": "",
                    "lua_type": "InputObjectProps?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "MockInputObject"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 52,
                "path": "src/player-mock/src/Shared/Helpers/Input/MockInputObject.lua"
            }
        },
        {
            "name": "GetPropertyChangedSignal",
            "desc": "Returns the signal that fires when the given property changes, the same signal every time.\nMirrors `InputObject:GetPropertyChangedSignal(propertyName)`.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "MockInputObject"
                },
                {
                    "name": "propertyName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Signal<()>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 77,
                "path": "src/player-mock/src/Shared/Helpers/Input/MockInputObject.lua"
            }
        },
        {
            "name": "SetUserInputState",
            "desc": "Sets `UserInputState` and fires its changed signal, which is how a test drives the press\nlifecycle -- ending a press the engine would have ended itself.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "MockInputObject"
                },
                {
                    "name": "userInputState",
                    "desc": "",
                    "lua_type": "Enum.UserInputState"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 96,
                "path": "src/player-mock/src/Shared/Helpers/Input/MockInputObject.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "MockInputObject",
    "desc": "Stand-in `InputObject` for [PlayerMock.fireInput] to hand a bound action, a real one not being\n`Instance.new`-able.\n\nOnly the fields are own-keys, so an instance handed to [PlayerMock.fireServiceSignal] still\ncrosses the `BindableEvent` boundary with its values intact -- the methods, like any metatable, do\nnot survive that copy.\n\nUse [PlayerMock.makeInputObject].",
    "source": {
        "line": 14,
        "path": "src/player-mock/src/Shared/Helpers/Input/MockInputObject.lua"
    }
}