Fix link creation with backward selection (#9986)

Fix link creation with backward selection
This commit is contained in:
Florian Duros 2023-01-26 11:08:23 +01:00 committed by GitHub
parent 222f8a919d
commit 406edfc27d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 5 deletions

View file

@ -98,7 +98,7 @@ describe("Composer", () => {
});
});
describe("WYSIWYG", () => {
describe("Rich text editor", () => {
beforeEach(() => {
cy.enableLabsFeature("feature_wysiwyg_composer");
cy.initTestUser(homeserver, "Janet").then(() => {
@ -165,5 +165,25 @@ describe("Composer", () => {
cy.contains(".mx_EventTile_body", "my message 3");
});
});
describe("links", () => {
it("create link with a forward selection", () => {
// Type a message
cy.get("div[contenteditable=true]").type("my message 0{selectAll}");
// Open link modal
cy.get('button[aria-label="Link"]').click();
// Fill the link field
cy.get('input[label="Link"]').type("https://matrix.org/");
// Click on save
cy.get('button[type="submit"]').click();
// Send the message
cy.get('div[aria-label="Send message"]').click();
// It was sent
cy.contains(".mx_EventTile_body a", "my message 0");
cy.get(".mx_EventTile_body a").should("have.attr", "href").and("include", "https://matrix.org/");
});
});
});
});