You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Don't linkify code blocks (#7859)
* Don't linkify code blocks Signed-off-by: Robin Townsend <robin@robin.town> * Put the linkify ignoreTags option in the right place Signed-off-by: Robin Townsend <robin@robin.town> * Add code to list of ignored linkification tags as well Signed-off-by: Robin Townsend <robin@robin.town> * Test that code blocks skip linkification Signed-off-by: Robin Townsend <robin@robin.town> * Move test to the right spot Signed-off-by: Robin Townsend <robin@robin.town> * Use a snapshot instead for test Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
@@ -216,6 +216,26 @@ describe("<TextualBody />", () => {
|
||||
'</span></span></span>');
|
||||
});
|
||||
|
||||
it("linkification is not applied to code blocks", () => {
|
||||
const ev = mkEvent({
|
||||
type: "m.room.message",
|
||||
room: "room_id",
|
||||
user: "sender",
|
||||
content: {
|
||||
body: "Visit `https://matrix.org/`\n```\nhttps://matrix.org/\n```",
|
||||
msgtype: "m.text",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: "<p>Visit <code>https://matrix.org/</code></p>\n<pre>https://matrix.org/\n</pre>\n",
|
||||
},
|
||||
event: true,
|
||||
});
|
||||
|
||||
const wrapper = getComponent({ mxEvent: ev }, matrixClient);
|
||||
expect(wrapper.text()).toBe("Visit https://matrix.org/\n1https://matrix.org/\n\n");
|
||||
const content = wrapper.find(".mx_EventTile_body");
|
||||
expect(content.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
// If pills were rendered within a Portal/same shadow DOM then it'd be easier to test
|
||||
it("pills get injected correctly into the DOM", () => {
|
||||
const ev = mkEvent({
|
||||
|
Reference in New Issue
Block a user