mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(editor): code block ui issues (#12609)
Close BS-3423 Close BS-3505 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Style** - Updated toolbar button background color and adjusted layout spacing for toolbar and preview buttons to improve visual consistency. - **Refactor** - Reorganized toolbar menu groups for better clarity, separating toggle and clipboard actions within the code block toolbar. - **Bug Fixes** - Improved UI interaction in code block tests to ensure menus behave as expected without closing prematurely. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -219,6 +219,8 @@ test('duplicate code block', async ({ page }, testInfo) => {
|
||||
await codeBlockController.codeBlock.hover();
|
||||
await (await codeBlockController.openMore()).wrapButton.click();
|
||||
|
||||
await page.mouse.click(300, 300);
|
||||
|
||||
// duplicate
|
||||
await codeBlockController.codeBlock.hover();
|
||||
await (await codeBlockController.openMore()).duplicateButton.click();
|
||||
@@ -270,6 +272,8 @@ test('toggle code block wrap can work', async ({ page }, testInfo) => {
|
||||
await codeBlockController.codeBlock.hover();
|
||||
await (await codeBlockController.openMore()).wrapButton.click();
|
||||
|
||||
await page.mouse.click(300, 300);
|
||||
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_2.json`
|
||||
);
|
||||
@@ -335,6 +339,8 @@ test('toggle code block line number can work', async ({ page }) => {
|
||||
await codeBlockController.codeBlock.hover();
|
||||
await (await codeBlockController.openMore()).cancelLineNumberButton.click();
|
||||
|
||||
await page.mouse.click(300, 300);
|
||||
|
||||
await expect(lineNumber).toBeHidden();
|
||||
|
||||
await undoByKeyboard(page);
|
||||
@@ -389,7 +395,9 @@ test('should tab works in code block', async ({ page }) => {
|
||||
await assertRichTexts(page, ['const a = 10;\n \nconst b = "NothingToSay"']);
|
||||
});
|
||||
|
||||
test('should open more menu and close on selecting', async ({ page }) => {
|
||||
test('should open more menu and do not close after selecting', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyCodeBlockState(page);
|
||||
await focusRichText(page);
|
||||
@@ -401,7 +409,7 @@ test('should open more menu and close on selecting', async ({ page }) => {
|
||||
|
||||
await expect(moreMenu.menu).toBeVisible();
|
||||
await moreMenu.wrapButton.click();
|
||||
await expect(moreMenu.menu).toBeHidden();
|
||||
await expect(moreMenu.menu).toBeVisible();
|
||||
});
|
||||
|
||||
test('should code block lang input supports alias', async ({ page }) => {
|
||||
|
||||
Reference in New Issue
Block a user