authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:27:48-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:27:48-07:00
log4e59b06b84fdfa36f78b4fc9079dff88b4ff3dc4
treedea94852cf850e7716c1cedc40a1e05ec214bcff
parent1449deca0afb98a422ea54b0d0fbed56da9f9f8f
signature Signed by PGP key B5690EEEBB952194

test(web): keep pull request menu items private (#10016)


2 files changed, 2 insertions(+), 9 deletions(-)

apps/web/src/components/pullRequest/pullRequestLinkContextMenu.test.ts+1-8
...@@ -1,15 +1,8 @@...@@ -1,15 +1,8 @@
1import { describe, expect, it } from "vite-plus/test";1import { describe, expect, it } from "vite-plus/test";
22
3import { openOnHostLabel, pullRequestLinkContextMenuItems } from "./pullRequestLinkContextMenu";3import { openOnHostLabel } from "./pullRequestLinkContextMenu";
44
5describe("pull request link context menu", () => {5describe("pull request link context menu", () => {
6 it("offers the copy first and the host's own page after it", () => {
7 expect(pullRequestLinkContextMenuItems("Open on GitHub")).toEqual([
8 { id: "copy-link", label: "Copy link", icon: "copy" },
9 { id: "open-external", label: "Open on GitHub" },
10 ]);
11 });
12
13 it("names every host it knows, and says nothing false about one it does not", () => {6 it("names every host it knows, and says nothing false about one it does not", () => {
14 expect(openOnHostLabel("github")).toBe("Open on GitHub");7 expect(openOnHostLabel("github")).toBe("Open on GitHub");
15 expect(openOnHostLabel("gitlab")).toBe("Open on GitLab");8 expect(openOnHostLabel("gitlab")).toBe("Open on GitLab");
apps/web/src/components/pullRequest/pullRequestLinkContextMenu.ts+1-1
...@@ -19,7 +19,7 @@ export const openOnHostLabel = (provider: string): string =>...@@ -19,7 +19,7 @@ export const openOnHostLabel = (provider: string): string =>
19 OPEN_ON_HOST_LABELS[provider] ?? "Open on host";19 OPEN_ON_HOST_LABELS[provider] ?? "Open on host";
2020
21/** Copy first: it is the reason to right-click a number rather than click it. */21/** Copy first: it is the reason to right-click a number rather than click it. */
22export function pullRequestLinkContextMenuItems(22function pullRequestLinkContextMenuItems(
23 openLabel: string,23 openLabel: string,
24): readonly ContextMenuItem<PullRequestLinkContextMenuAction>[] {24): readonly ContextMenuItem<PullRequestLinkContextMenuAction>[] {
25 return [25 return [