From d2bd97549ab3012de403700fa2fb6146b1dd6014 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 22 Apr 2026 14:24:57 -0300 Subject: [PATCH] fix: preserve spaces in shareable playground chat input (#12833) --- .../__tests__/input-wrapper.test.tsx | 306 ++++++++++++++++++ .../chatInput/components/input-wrapper.tsx | 4 + 2 files changed, 310 insertions(+) create mode 100644 src/frontend/src/modals/IOModal/components/chatView/chatInput/components/__tests__/input-wrapper.test.tsx diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/__tests__/input-wrapper.test.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/__tests__/input-wrapper.test.tsx new file mode 100644 index 0000000000..5622ab9111 --- /dev/null +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/__tests__/input-wrapper.test.tsx @@ -0,0 +1,306 @@ +import { render, screen } from "@testing-library/react"; +import React from "react"; +import InputWrapper from "../input-wrapper"; + +jest.mock("@/customization/feature-flags", () => ({ + __esModule: true, + get ENABLE_FILES_ON_PLAYGROUND() { + return mockFlags.ENABLE_FILES_ON_PLAYGROUND; + }, + get ENABLE_VOICE_ASSISTANT() { + return mockFlags.ENABLE_VOICE_ASSISTANT; + }, +})); + +jest.mock("@/controllers/API/queries/config/use-get-config", () => ({ + useGetConfig: () => ({ data: { voice_mode_available: mockVoiceAvailable } }), +})); + +const mockFlags = { + ENABLE_FILES_ON_PLAYGROUND: false, + ENABLE_VOICE_ASSISTANT: false, +}; +let mockVoiceAvailable = false; + +beforeEach(() => { + mockFlags.ENABLE_FILES_ON_PLAYGROUND = false; + mockFlags.ENABLE_VOICE_ASSISTANT = false; + mockVoiceAvailable = false; +}); + +jest.mock("react-i18next", () => ({ + useTranslation: () => ({ t: (key: string) => key }), +})); + +jest.mock("../upload-file-button", () => ({ + __esModule: true, + default: () =>
, +})); + +jest.mock("../button-send-wrapper", () => ({ + __esModule: true, + default: () =>
, +})); + +jest.mock("../voice-assistant/components/voice-button", () => ({ + __esModule: true, + default: () =>
, +})); + +jest.mock("../../../fileComponent/components/file-preview", () => ({ + __esModule: true, + default: () =>
, +})); + +jest.mock("../text-area-wrapper", () => ({ + __esModule: true, + default: () =>