RTE plain text mentions as pills (#10852)

* insert mentions as links styled as pills

* post merge fix and update test

* update comments, move typeguard out

* create a text node instead of setting innerText

* update test

* update test

* fix broken cypress test, remove .only

* make it able to deal with inserting in middle of blank lines

* update comment

* fix strict null error

* use typeguard

* avoid implicit truth check

* add hook tests

* add comment

* Update test/components/views/rooms/wysiwyg_composer/hooks/usePlainTextListeners-test.tsx

Co-authored-by: Andy Balaam <andy.balaam@matrix.org>

---------

Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
This commit is contained in:
alunturner 2023-05-16 12:54:16 +01:00 committed by GitHub
parent acdbae3e8c
commit 0d981326ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 146 additions and 40 deletions

View file

@ -225,9 +225,10 @@ describe("Composer", () => {
});
// ...inserts the username into the composer
cy.findByRole("textbox").within(() => {
// TODO update this test when the mentions are inserted as pills, instead
// of as text
cy.findByText(otherUserName, { exact: false }).should("exist");
cy.findByText(otherUserName, { exact: false })
.should("exist")
.should("have.attr", "contenteditable", "false")
.should("have.attr", "data-mention-type", "user");
});
// Send the message to clear the composer
@ -250,9 +251,10 @@ describe("Composer", () => {
// Selecting the autocomplete option using Enter inserts it into the composer
cy.findByRole("textbox").type(`{Enter}`);
cy.findByRole("textbox").within(() => {
// TODO update this test when the mentions are inserted as pills, instead
// of as text
cy.findByText(otherUserName, { exact: false }).should("exist");
cy.findByText(otherUserName, { exact: false })
.should("exist")
.should("have.attr", "contenteditable", "false")
.should("have.attr", "data-mention-type", "user");
});
});
});