mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
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:
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user