Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/shared/InlineReference.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
outline-offset: 2px;
}

/* Channel hosts reset ordinary buttons to inherited text color. */
[data-mention-kind].link {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required DCO sign-off

This proposed commit has no Signed-off-by trailer, so it violates the repository’s DCO requirement and will fail the hosted DCO Check; recreate the commit with git commit --signoff using the verified effective author identity.

AGENTS.md reference: AGENTS.md:L98-L106

Useful? React with 👍 / 👎.

color: var(--link-text);
}

.icon {
display: inline-block;
width: 1em;
Expand Down
25 changes: 25 additions & 0 deletions tests/browser/composer-links.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ test("editable composer renders links and mentions while preserving source and n
await expect(preview.locator('[data-mention-kind="agent"]')).toHaveText(
"Build Bot",
);
const delivered = page.locator('[data-message-id="link-row"]');
const deliveredLink = delivered
.locator('a:has([data-link-kind="github"])')
.first();
const deliveredMentions = delivered.locator("[data-mention-kind]");
const inlineStyles = await Promise.all(
[deliveredLink, deliveredMentions.nth(0), deliveredMentions.nth(1)].map(
(locator) =>
locator.evaluate((element) => {
const style = getComputedStyle(element);
return {
color: style.color,
paddingBlock: [style.paddingTop, style.paddingBottom],
height: element.getBoundingClientRect().height,
};
}),
),
);
for (const mentionStyle of inlineStyles.slice(1)) {
expect(mentionStyle.color).toBe(inlineStyles[0].color);
expect(mentionStyle.paddingBlock).toEqual(inlineStyles[0].paddingBlock);
expect(
Math.abs(mentionStyle.height - inlineStyles[0].height),
).toBeLessThan(1);
}
await expect(preview.getByRole("link")).toHaveCount(0);
await expect(preview.getByRole("button")).toHaveCount(0);

Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/link-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { PluginModule } from "../../src/plugins/api";
import type { ChannelMessage } from "../../src/features/relay/contracts";
import type { RelaySession } from "../../src/features/relay/session";
import * as links from "../../src/bundled/links";
import channelStyles from "../../src/bundled/channels/Channels.module.css";
import { readView, writeView } from "../../src/shared/view-state";
import "../../src/shared/styles/globals.css";

Expand Down Expand Up @@ -120,6 +121,7 @@ const library = {
identities: [{ pubkey: "b".repeat(64), name: "Build Bot" }],
};
const emoji = { status: "ready", entries: [] };
const typing: readonly never[] = [];
const sent: Array<{ text: string; mentions: readonly string[] }> = [];
Object.assign(window, { linkComposerFixture: { sent } });
const previewSession = {
Expand All @@ -135,6 +137,10 @@ const previewSession = {
return `preview-${sent.length}`;
},
},
typing: {
snapshot: () => typing,
subscribe: () => () => {},
},
channels: { list: () => directory, subscribeList: () => () => {} },
profiles: {
snapshot: () => profiles,
Expand Down Expand Up @@ -186,6 +192,7 @@ function Preview() {
const [enabled, setEnabled] = useState("on");
return (
<main
className={channelStyles.root}
style={{
maxWidth: 760,
margin: "24px auto",
Expand Down
Loading