Skip to content

Commit 300e320

Browse files
committed
fix(code-server): open external links in new tabs
1 parent dcce1ca commit 300e320

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

plugins/code-server/app/components/LauncherView.stories.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/vue3-vite'
22
import type { CodeServerDetection } from '../connect'
3+
import { expect, within } from 'storybook/test'
34
import LauncherView from './LauncherView.vue'
45

56
const localCodeServer: CodeServerDetection = {
@@ -44,6 +45,18 @@ export const NotInstalled: Story = {
4445
server: { status: 'stopped' },
4546
busy: false,
4647
},
48+
play: async ({ canvasElement }) => {
49+
const canvas = within(canvasElement)
50+
const docsLink = canvas.getByRole('link', { name: 'Installation docs' })
51+
const repoLink = canvas.getByRole('link', { name: 'GitHub' })
52+
53+
await expect(docsLink).toHaveAttribute('href', 'https://coder.com/docs/code-server/latest/install')
54+
await expect(docsLink).toHaveAttribute('target', '_blank')
55+
await expect(docsLink).toHaveAttribute('rel', 'noreferrer')
56+
await expect(repoLink).toHaveAttribute('href', 'https://github.com/coder/code-server')
57+
await expect(repoLink).toHaveAttribute('target', '_blank')
58+
await expect(repoLink).toHaveAttribute('rel', 'noreferrer')
59+
},
4760
}
4861

4962
/** Short dock panel with install instructions available through scrolling. */

plugins/code-server/app/components/LauncherView.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,24 @@ const errorText = computed(() => (props.server.status === 'error' ? props.server
130130
>
131131
{{ busy ? 'Checking…' : 'Re-check' }}
132132
</ActionButton>
133-
<ActionButton variant="text" size="sm" :href="DOCS_URL" icon="i-ph-arrow-square-out">
133+
<ActionButton
134+
variant="text"
135+
size="sm"
136+
:href="DOCS_URL"
137+
target="_blank"
138+
rel="noreferrer"
139+
icon="i-ph-arrow-square-out"
140+
>
134141
Installation docs
135142
</ActionButton>
136-
<ActionButton variant="text" size="sm" :href="REPO_URL" icon="i-ph-github-logo">
143+
<ActionButton
144+
variant="text"
145+
size="sm"
146+
:href="REPO_URL"
147+
target="_blank"
148+
rel="noreferrer"
149+
icon="i-ph-github-logo"
150+
>
137151
GitHub
138152
</ActionButton>
139153
</div>

0 commit comments

Comments
 (0)