Fix spotlight opening in TAC (#12315)

* Fix spotlight opening in TAC

* Add tests

* Remove `RovingTabIndexProvider`
This commit is contained in:
Florian Duros 2024-03-08 11:18:30 +01:00 committed by GitHub
parent 70365c891b
commit ddbc6439ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 95 additions and 31 deletions

View file

@ -180,4 +180,31 @@ describe("ThreadsActivityCentre", () => {
expect(screen.getByRole("menu")).toMatchSnapshot();
});
it("should block Ctrl/CMD + k shortcut", async () => {
cli.getVisibleRooms = jest.fn().mockReturnValue([roomWithHighlight]);
const keyDownHandler = jest.fn();
render(
<div
onKeyDown={(evt) => {
keyDownHandler(evt.key, evt.ctrlKey);
}}
>
<MatrixClientContext.Provider value={cli}>
<ThreadsActivityCentre />
</MatrixClientContext.Provider>
</div>,
{ wrapper: TooltipProvider },
);
await userEvent.click(getTACButton());
// CTRL/CMD + k should be blocked
await userEvent.keyboard("{Control>}k{/Control}");
expect(keyDownHandler).not.toHaveBeenCalledWith("k", true);
// Sanity test
await userEvent.keyboard("{Control>}a{/Control}");
expect(keyDownHandler).toHaveBeenCalledWith("a", true);
});
});