mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 18:41:52 +08:00
fix(editor): textarea not focusing in AI panel (#11429)
Closes: [BS-3006](https://linear.app/affine-design/issue/BS-3006/insider上面,圈选yuan素后,ad-hoc的ai对话框焦点控制有大问题(无法对焦,总是会跳走))
This commit is contained in:
@@ -127,4 +127,15 @@ test.describe('AIChatWith/Text', () => {
|
||||
const content = await utils.editor.getEditorContent(page);
|
||||
expect(content).toBe('Apple');
|
||||
});
|
||||
|
||||
test('should focus on textarea', async ({ page, utils }) => {
|
||||
await utils.editor.askAIWithText(page, 'Apple');
|
||||
|
||||
const textarea = await utils.editor.whatAreYourThoughts(page, 'Coffee');
|
||||
|
||||
await expect(textarea).toBeFocused();
|
||||
|
||||
const value = await textarea.inputValue();
|
||||
expect(value).toBe('Coffee');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -582,4 +582,12 @@ export class EditorUtils {
|
||||
),
|
||||
} as const;
|
||||
}
|
||||
|
||||
public static async whatAreYourThoughts(page: Page, text: string) {
|
||||
const textarea = page.locator(
|
||||
'affine-ai-panel-widget .ai-panel-container textarea'
|
||||
);
|
||||
await textarea.fill(text);
|
||||
return textarea;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user