Fix issues with the new topic dialog (#8608)

This commit is contained in:
Šimon Brandner 2022-05-16 14:10:00 +02:00 committed by GitHub
parent e1d11db256
commit fb30b67b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 112 additions and 51 deletions

View file

@ -22,7 +22,23 @@ describe("Linkify", () => {
const wrapper = mount(<Linkify>
https://perdu.com
</Linkify>);
expect(wrapper.html()).toBe('<div><a href="https://perdu.com">https://perdu.com</a></div>');
expect(wrapper.html()).toBe(
"<div><a href=\"https://perdu.com\" class=\"linkified\" target=\"_blank\" rel=\"noreferrer noopener\">"+
"https://perdu.com" +
"</a></div>",
);
});
it("correctly linkifies a room alias", () => {
const wrapper = mount(<Linkify>
#element-web:matrix.org
</Linkify>);
expect(wrapper.html()).toBe(
"<div>" +
"<a href=\"https://matrix.to/#/#element-web:matrix.org\" class=\"linkified\" rel=\"noreferrer noopener\">" +
"#element-web:matrix.org" +
"</a></div>",
);
});
it("changes the root tag name", () => {
@ -55,10 +71,20 @@ describe("Linkify", () => {
const wrapper = mount(<DummyTest />);
expect(wrapper.html()).toBe('<div><div><a href="https://perdu.com">https://perdu.com</a></div></div>');
expect(wrapper.html()).toBe(
"<div><div>" +
"<a href=\"https://perdu.com\" class=\"linkified\" target=\"_blank\" rel=\"noreferrer noopener\">" +
"https://perdu.com" +
"</a></div></div>",
);
wrapper.find('div').at(0).simulate('click');
expect(wrapper.html()).toBe('<div><div><a href="https://matrix.org">https://matrix.org</a></div></div>');
expect(wrapper.html()).toBe(
"<div><div>" +
"<a href=\"https://matrix.org\" class=\"linkified\" target=\"_blank\" rel=\"noreferrer noopener\">" +
"https://matrix.org" +
"</a></div></div>",
);
});
});