diff --git a/tests/unit/entity-instances.test.ts b/tests/unit/entity-instances.test.ts index e2acc637..7fc7fc5a 100644 --- a/tests/unit/entity-instances.test.ts +++ b/tests/unit/entity-instances.test.ts @@ -18,6 +18,7 @@ import { DEFAULT_PLAYER_START_CAPSULE_RADIUS, DEFAULT_PLAYER_START_CROUCH_SETTINGS, DEFAULT_PLAYER_START_EYE_HEIGHT, + DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, DEFAULT_PLAYER_START_JUMP_SETTINGS, DEFAULT_PLAYER_START_MOVE_SPEED, DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES, @@ -49,6 +50,7 @@ describe("entity registry defaults", () => { position: { x: 0, y: 0, z: 0 }, yawDegrees: 0, navigationMode: "firstPerson", + interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, movementTemplate: { kind: "default", moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED, diff --git a/tests/unit/player-start-inspector.integration.test.tsx b/tests/unit/player-start-inspector.integration.test.tsx index 76ea1c41..1f2ec683 100644 --- a/tests/unit/player-start-inspector.integration.test.tsx +++ b/tests/unit/player-start-inspector.integration.test.tsx @@ -250,6 +250,56 @@ describe("Player Start inspector", () => { }); }); + it("persists the authored interaction reach for a selected Player Start", async () => { + const playerStart = createPlayerStartEntity({ + id: "entity-player-start-interaction-reach", + name: "Interaction Reach" + }); + const store = createEditorStore({ + initialDocument: { + ...createEmptySceneDocument({ name: "Player Start Reach Scene" }), + entities: { + [playerStart.id]: playerStart + } + } + }); + + render(); + + await waitFor(() => { + expect(viewportHostInstances.length).toBeGreaterThan(0); + }); + + act(() => { + store.setSelection({ + kind: "entities", + ids: [playerStart.id] + }); + }); + + const reachInput = await screen.findByTestId( + "player-start-interaction-reach" + ); + + expect(reachInput).toHaveValue(1.5); + + act(() => { + fireEvent.change(reachInput, { + target: { + value: "3.2" + } + }); + fireEvent.blur(reachInput); + }); + + await waitFor(() => { + expect(store.getState().document.entities[playerStart.id]).toMatchObject({ + kind: "playerStart", + interactionReachMeters: 3.2 + }); + }); + }); + it("shows authored jump, sprint, and crouch bindings for a selected Player Start", async () => { const playerStart = createPlayerStartEntity({ id: "entity-player-start-locomotion-bindings",