Fix pills being broken by unescaped characters
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
36fea4d487
commit
95eaf94cd8
4 changed files with 30 additions and 2 deletions
|
@ -148,6 +148,22 @@ describe('editor/deserialize', function() {
|
|||
expect(parts[1]).toStrictEqual({type: "user-pill", text: "Alice", resourceId: "@alice:hs.tld"});
|
||||
expect(parts[2]).toStrictEqual({type: "plain", text: "!"});
|
||||
});
|
||||
it('user pill with displayname containing backslash', function() {
|
||||
const html = "Hi <a href=\"https://matrix.to/#/@alice:hs.tld\">Alice\</a>!";
|
||||
const parts = normalize(parseEvent(htmlMessage(html), createPartCreator()));
|
||||
expect(parts.length).toBe(3);
|
||||
expect(parts[0]).toStrictEqual({type: "plain", text: "Hi "});
|
||||
expect(parts[1]).toStrictEqual({type: "user-pill", text: "Alice\\", resourceId: "@alice:hs.tld"});
|
||||
expect(parts[2]).toStrictEqual({type: "plain", text: "!"});
|
||||
});
|
||||
it('user pill with displayname containing closing square bracket', function() {
|
||||
const html = "Hi <a href=\"https://matrix.to/#/@alice:hs.tld\">Alice]</a>!";
|
||||
const parts = normalize(parseEvent(htmlMessage(html), createPartCreator()));
|
||||
expect(parts.length).toBe(3);
|
||||
expect(parts[0]).toStrictEqual({type: "plain", text: "Hi "});
|
||||
expect(parts[1]).toStrictEqual({type: "user-pill", text: "Alice]", resourceId: "@alice:hs.tld"});
|
||||
expect(parts[2]).toStrictEqual({type: "plain", text: "!"});
|
||||
});
|
||||
it('room pill', function() {
|
||||
const html = "Try <a href=\"https://matrix.to/#/#room:hs.tld\">#room:hs.tld</a>?";
|
||||
const parts = normalize(parseEvent(htmlMessage(html), createPartCreator()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue