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:
@@ -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",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user