fix(editor): format text in code block (#10575)

Closes: [BS-2724](https://linear.app/affine-design/issue/BS-2724/code-block%E9%87%8C%E4%B8%8D%E5%BA%94%E8%AF%A5%E6%98%BE%E7%A4%BAtoolbar)
This commit is contained in:
Flrande
2025-03-03 08:52:38 +00:00
parent 86c449319b
commit 5d3c365d97
3 changed files with 41 additions and 5 deletions

View File

@@ -597,7 +597,21 @@ test('format text in code block', async ({ page }, testInfo) => {
await type(page, 'https://www.baidu.com');
await pressEnter(page);
expect(await line.innerText()).toBe('const aaa = 1000;');
const linkLocator = page.locator('[data-block-id="3"] affine-link a');
expect(await linkLocator.count()).toBe(3);
await expect(linkLocator.nth(0)).toHaveAttribute(
'href',
'https://www.baidu.com'
);
await expect(linkLocator.nth(1)).toHaveAttribute(
'href',
'https://www.baidu.com'
);
await expect(linkLocator.nth(2)).toHaveAttribute(
'href',
'https://www.baidu.com'
);
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
`${testInfo.title}_link.json`
);