Allow jumping to message search from spotlight (#29850)

* Allow jumping to message search from spotlight

replaces the message search hint which referenced the old UX

Fixes #29831

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update RoomSummaryCard.tsx

* Update actions.ts

* Delete src/hooks/useTransition.ts

* Update RoomSummaryCard.tsx

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-04-30 11:23:35 +00:00
committed by GitHub
parent 23597e959b
commit 4bf28f8159
14 changed files with 212 additions and 240 deletions
@@ -353,12 +353,12 @@ describe("Spotlight Dialog", () => {
});
it("should find Rooms", () => {
expect(options).toHaveLength(4);
expect(options).toHaveLength(5);
expect(options[0]!.innerHTML).toContain(testRoom.name);
});
it("should not find LocalRooms", () => {
expect(options).toHaveLength(4);
expect(options).toHaveLength(5);
expect(options[0]!.innerHTML).not.toContain(testLocalRoom.name);
});
});
@@ -648,4 +648,20 @@ describe("Spotlight Dialog", () => {
});
});
});
it("should allow jumping into message search", async () => {
const onFinished = jest.fn();
render(<SpotlightDialog initialText="search term" onFinished={onFinished} />);
jest.advanceTimersByTime(200);
await flushPromisesWithFakeTimers();
fireEvent.click(screen.getByText("Messages"));
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith(
expect.objectContaining({
action: Action.FocusMessageSearch,
initialText: "search term",
}),
);
});
});