You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Fixes around URL tooltips and in-app matrix.to link handling (#9139)
* Add regression test for tooltipify exposing raw HTML * Handle m.to links involving children better * Comments * Fix mistaken assertion
This commit is contained in:
committed by
GitHub
parent
48ae16b5a5
commit
e63072e21f
@ -57,4 +57,19 @@ describe('tooltipify', () => {
|
||||
expect(containers).toHaveLength(0);
|
||||
expect(root.outerHTML).toEqual(originalHtml);
|
||||
});
|
||||
|
||||
it("does not re-wrap if called multiple times", () => {
|
||||
const component = mount(<div><a href="/foo">click</a></div>);
|
||||
const root = component.getDOMNode();
|
||||
const containers: Element[] = [];
|
||||
tooltipifyLinks([root], [], containers);
|
||||
tooltipifyLinks([root], [], containers);
|
||||
tooltipifyLinks([root], [], containers);
|
||||
tooltipifyLinks([root], [], containers);
|
||||
expect(containers).toHaveLength(1);
|
||||
const anchor = root.querySelector("a");
|
||||
expect(anchor?.getAttribute("href")).toEqual("/foo");
|
||||
const tooltip = anchor.querySelector(".mx_TextWithTooltip_target");
|
||||
expect(tooltip).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user