fix(editor): should keep color on custom color button (#11773)

Closes: [BS-3167](https://linear.app/affine-design/issue/BS-3167/自定义按钮显示错误)
This commit is contained in:
fundon
2025-04-17 12:21:39 +00:00
parent 8dc21e53ca
commit a46bb446e2
5 changed files with 129 additions and 7 deletions
+14 -4
View File
@@ -4,7 +4,11 @@ import { Path } from '../playwright';
const fixturesDir = Path.dir(import.meta.url).join('../../../fixtures');
export async function importAttachment(page: Page, file: string) {
export async function importFile(
page: Page,
file: string,
fn?: (page: Page) => Promise<void>
) {
await page.evaluate(() => {
// Force fallback to input[type=file] in tests
// See https://github.com/microsoft/playwright/issues/8850
@@ -13,9 +17,15 @@ export async function importAttachment(page: Page, file: string) {
const fileChooser = page.waitForEvent('filechooser');
// open slash menu
await page.keyboard.type('/attachment', { delay: 50 });
await page.keyboard.press('Enter');
if (fn) await fn(page);
await (await fileChooser).setFiles(fixturesDir.join(file).value);
}
export async function importAttachment(page: Page, file: string) {
// open slash menu
await importFile(page, file, async page => {
await page.keyboard.type('/attachment', { delay: 50 });
await page.keyboard.press('Enter');
});
}