Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions desktop/src/shared/ui/markdown/ExternalLinkAnchor.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import assert from "node:assert/strict";
import test from "node:test";

import React from "react";
import { renderToStaticMarkup } from "react-dom/server";

import { TooltipProvider } from "../tooltip.tsx";
import { ExternalLinkAnchor } from "./ExternalLinkAnchor.tsx";

test("external markdown links rest without an underline", () => {
const html = renderToStaticMarkup(
React.createElement(
TooltipProvider,
null,
React.createElement(
ExternalLinkAnchor,
{
anchorProps: {},
href: "https://example.com/tasks/t_5873512f",
isLinearLink: false,
label: "t_5873512f",
},
"t_5873512f",
),
),
);

const className = html.match(/<a[^>]*class="([^"]+)"/)?.[1] ?? "";
assert.match(className, /(?:^| )no-underline(?: |$)/);
assert.match(className, /(?:^| )hover:underline(?: |$)/);
assert.doesNotMatch(className, /(?:^| )underline(?: |$)/);
});
2 changes: 1 addition & 1 deletion desktop/src/shared/ui/markdown/ExternalLinkAnchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function ExternalLinkAnchor({
<a
{...anchorProps}
className={cn(
"font-medium underline underline-offset-4 transition-colors",
"font-medium no-underline underline-offset-4 transition-colors hover:underline",
isLinearLink ? "linear-link" : "text-primary hover:text-primary/80",
)}
href={href}
Expand Down