diff --git a/src/components/views/dialogs/InviteDialog.tsx b/src/components/views/dialogs/InviteDialog.tsx index fa81a28bee0..05fe712bfa7 100644 --- a/src/components/views/dialogs/InviteDialog.tsx +++ b/src/components/views/dialogs/InviteDialog.tsx @@ -870,11 +870,17 @@ export default class InviteDialog extends React.PureComponent m.userId === address); if (member) { diff --git a/test/components/views/dialogs/InviteDialog-test.tsx b/test/components/views/dialogs/InviteDialog-test.tsx index 645492cd3d4..ab17540cff0 100644 --- a/test/components/views/dialogs/InviteDialog-test.tsx +++ b/test/components/views/dialogs/InviteDialog-test.tsx @@ -86,6 +86,7 @@ const aliceEmail = "foobar@email.com"; const bobId = "@bob:example.org"; const bobEmail = "bobbob@example.com"; // bob@example.com is already used as an example in the invite dialog const carolId = "@carol:example.com"; +const bobbob = "bobbob"; const aliceProfileInfo: IProfileInfo = { user_id: aliceId, @@ -290,6 +291,19 @@ describe("InviteDialog", () => { await screen.findByText(aliceEmail); expect(input).toHaveValue(""); }); + it("should support pasting one username that is not a mx id or email", async () => { + mockClient.getIdentityServerUrl.mockReturnValue("https://identity-server"); + mockClient.lookupThreePid.mockResolvedValue({}); + + render(); + + const input = screen.getByTestId("invite-dialog-input"); + input.focus(); + await userEvent.paste(`${bobbob}`); + + await screen.findAllByText(bobId); + expect(input).toHaveValue(`${bobbob}`); + }); it("should allow to invite multiple emails to a room", async () => { render();