mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* 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
43 lines
1.4 KiB
TypeScript
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)
|
|
}
|
|
})
|