diff --git a/webapp/src/lib/marked/renderers/InternalLink.svelte b/webapp/src/lib/marked/renderers/InternalLink.svelte index 58b687a..e7275bf 100644 --- a/webapp/src/lib/marked/renderers/InternalLink.svelte +++ b/webapp/src/lib/marked/renderers/InternalLink.svelte @@ -20,7 +20,7 @@ - + {#if useSlot} {:else} diff --git a/webapp/src/lib/marked/renderers/Link.svelte b/webapp/src/lib/marked/renderers/Link.svelte index 9e32b37..c046f14 100644 --- a/webapp/src/lib/marked/renderers/Link.svelte +++ b/webapp/src/lib/marked/renderers/Link.svelte @@ -15,7 +15,7 @@ {#if isWebLink} - + {:else} diff --git a/webapp/src/test/markdown/internalLinks.test.ts b/webapp/src/test/markdown/internalLinks.test.ts index cc0b3fe..a2ed3b7 100644 --- a/webapp/src/test/markdown/internalLinks.test.ts +++ b/webapp/src/test/markdown/internalLinks.test.ts @@ -10,35 +10,41 @@ describe('rendering [[internal]] links', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Normal internal link$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders [[links|with alias]] correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Link with alias$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders [[links#heading]] correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Page with headings > heading A$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders [[links#heading|with alias]] correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Link with heading alias$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders [[links#heading|with alias#fakeheading]] correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Link with heading alias#false heading$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Does not render [[]] empty links', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const textEl = await screen.findByText('[[]]', { exact: false }); expect(textEl).toBeInTheDocument(); + expect(textEl).not.toHaveClass('internal-link'); }); }); diff --git a/webapp/src/test/markdown/markdownLink.test.ts b/webapp/src/test/markdown/markdownLink.test.ts index f437918..089d1d2 100644 --- a/webapp/src/test/markdown/markdownLink.test.ts +++ b/webapp/src/test/markdown/markdownLink.test.ts @@ -9,23 +9,27 @@ describe('rendering [md style](links)', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Classic internal link \(URL encoded\)$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders URL-encoded internal links correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Classic internal link \(tag format\)$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('internal-link'); }); it('Renders http links correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/^Wikipedia \(http\)$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('external-link'); }); it('Renders https links correctly', async () => { render(MarkdownRenderer, { plaintext: plaintext }); const linkEl = await screen.findByText(/Wikipedia \(https\)$/); expect(linkEl).toBeInTheDocument(); + expect(linkEl).toHaveClass('external-link'); }); });