Files
orca/tests/e2e/markdown-fence-links.spec.ts
Neil 277c289bd4 fix(editor): share code-fence boundaries for Markdown links (#21574)
* fix(editor): share fence boundaries for Markdown links

* test(editor): assert highlighted lines across Monaco token spans

* perf(editor): scan fence lines without substring allocations

* fix(editor): match fence suffix whitespace rules
2026-09-19 00:06:56 -07:00

43 lines
1.4 KiB
TypeScript

import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import {
cleanupMarkdownFixture,
createMarkdownFixture,
getActiveWorktreeContext,
openMarkdownFixture
} from './helpers/markdown-editor-fixture'
test('source links stay outside mixed code fences', async ({ orcaPage }, testInfo) => {
await waitForSessionReady(orcaPage)
await waitForActiveWorktree(orcaPage)
const context = await getActiveWorktreeContext(orcaPage)
const file = await createMarkdownFixture(
context,
'markdown-fences',
'links',
testInfo.workerIndex,
'# Fence boundaries\n\n~~~text\n```\n[[inside-code]]\n~~~\n\n[[outside-code]]\n'
)
try {
await openMarkdownFixture(orcaPage, context, file)
await orcaPage.evaluate(() => {
const state = window.__store!.getState()
if (!state.activeFileId) {
throw new Error('missing active file')
}
state.setMarkdownViewMode(state.activeFileId, 'source')
})
const links = orcaPage.locator('.monaco-editor .view-line').filter({
has: orcaPage.locator('.monaco-markdown-doc-link')
})
await expect(links).toHaveCount(1)
await expect(links).toHaveText('[[outside-code]]')
await testInfo.attach('fence-links', {
body: await orcaPage.screenshot({ path: testInfo.outputPath('fence-links.png') }),
contentType: 'image/png'
})
} finally {
await cleanupMarkdownFixture(file)
}
})