Use context provided RoomViewStore within the RoomView component hierarchy (#31077)

* Update ContentMessages.ts

Update ContentMessages.ts

* update PlaybackQueue.ts

* Update SpaceHierarchy.tsx

* Update ThreadView.tsx

* Update RoomCallBanner.tsx

* Update useRoomCall.tsx

* Update DateSeparator.tsx

* Update TimelineCard.tsx

* Update UserInfoBasicOptions

* Update slask-commands/utils.ts

* lint

* Update PlaybackQueue, MVoiceMessageBody and UserInfoBasicOptionsView tests.

* Update RoomHeader-test.tsx

* lint

* Add ts docs

* Update utils-test.tsx

* Update message-test.ts

* coverage

* lint

* Improve naming

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
David Langley
2025-10-29 09:40:21 +00:00
committed by GitHub
co-authored by Michael Telatynski
parent 209dfece21
commit ae2acdf311
38 changed files with 520 additions and 104 deletions
@@ -16,6 +16,9 @@ import * as TestUtils from "../../../../test-utils";
import { MatrixClientPeg } from "../../../../../src/MatrixClientPeg";
import EditorModel from "../../../../../src/editor/model";
import { createPartCreator, createRenderer } from "../../../editor/mock";
import { CommandPartCreator } from "../../../../../src/editor/parts";
import DocumentOffset from "../../../../../src/editor/offset";
import { SdkContextClass } from "../../../../../src/contexts/SDKContext";
import SettingsStore from "../../../../../src/settings/SettingsStore";
describe("BasicMessageComposer", () => {
@@ -103,6 +106,25 @@ describe("BasicMessageComposer", () => {
const placeholder = input[0].style.getPropertyValue("--placeholder");
expect(placeholder).toMatch("'w\\\\e'");
});
it("should not consider typing for unknown or disabled slash commands", async () => {
// create a command part which represents a slash command the client doesn't recognise
const commandPc = new CommandPartCreator(room as unknown as Room, client as unknown as MatrixClient, null);
const commandPart = commandPc.command("/unknown do stuff");
const model = new EditorModel([commandPart], commandPc, renderer);
// spy on typingStore.setSelfTyping
const spy = jest.spyOn(SdkContextClass.instance.typingStore, "setSelfTyping");
render(<BasicMessageComposer model={model} room={room} />);
// simulate typing by updating the model - this will call the component's update callback
await model.update(commandPart.text, "insertText", new DocumentOffset(commandPart.text.length, true));
// Since the command is not in CommandMap, it should not be considered typing
expect(spy).toHaveBeenCalledWith(room.roomId, null, false);
spy.mockRestore();
});
});
function generateMockDataTransferForString(string: string): DataTransfer {