mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-06 00:32:26 -08:00
Change settings links to use explicit markers
This commit is contained in:
16 files changed
+171
-301
No files matched your search
@@ -148,9 +148,10 @@ describe('react custom html parser', () => {
|
||||
{renderLink({
|
||||
tagName: 'a',
|
||||
attributes: {
|
||||
href: 'https://app.example/settings/appearance?focus=message-link-preview',
|
||||
href: 'https://app.example/settings/appearance?focus=message-link-preview&moe.sable.client.action=settings',
|
||||
},
|
||||
content: 'https://app.example/settings/appearance?focus=message-link-preview',
|
||||
content:
|
||||
'https://app.example/settings/appearance?focus=message-link-preview&moe.sable.client.action=settings',
|
||||
} as never)}
|
||||
</div>
|
||||
);
|
||||
@@ -165,14 +166,14 @@ describe('react custom html parser', () => {
|
||||
|
||||
it('renders same-origin settings links as internal app links with settings metadata', () => {
|
||||
renderParsedHtml(
|
||||
'<a href="https://app.example/settings/appearance?focus=message-link-preview">Appearance</a>',
|
||||
'<a href="https://app.example/settings/appearance?focus=message-link-preview&moe.sable.client.action=settings">Appearance</a>',
|
||||
{ sanitize: false }
|
||||
);
|
||||
|
||||
const link = screen.getByRole('link', { name: 'Appearance' });
|
||||
expect(link).toHaveAttribute(
|
||||
'href',
|
||||
'https://app.example/settings/appearance?focus=message-link-preview'
|
||||
'https://app.example/settings/appearance?focus=message-link-preview&moe.sable.client.action=settings'
|
||||
);
|
||||
expect(link).toHaveAttribute('data-settings-link-section', 'appearance');
|
||||
expect(link).toHaveAttribute('data-settings-link-focus', 'message-link-preview');
|
||||
@@ -181,6 +182,21 @@ describe('react custom html parser', () => {
|
||||
expect(link.className).toContain(customHtmlCss.MentionWithIcon);
|
||||
});
|
||||
|
||||
it('renders marked cross-instance settings links as internal app links with settings metadata', () => {
|
||||
renderParsedHtml(
|
||||
'<a href="https://other.example/#/client/settings/account?focus=status&moe.sable.client.action=settings">Account</a>',
|
||||
{ sanitize: false }
|
||||
);
|
||||
|
||||
const link = screen.getByRole('link', { name: 'Account' });
|
||||
expect(link).toHaveAttribute(
|
||||
'href',
|
||||
'https://other.example/#/client/settings/account?focus=status&moe.sable.client.action=settings'
|
||||
);
|
||||
expect(link).toHaveAttribute('data-settings-link-section', 'account');
|
||||
expect(link).toHaveAttribute('data-settings-link-focus', 'status');
|
||||
});
|
||||
|
||||
it('renders matrix message permalinks with an icon instead of the Message prefix', () => {
|
||||
render(
|
||||
<div>
|
||||
|
||||
Reference in new issue
Block a user