mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
+13
-2
@@ -24,7 +24,18 @@ export const focusEditor = async ({
|
||||
await getEditors(page).focus();
|
||||
};
|
||||
|
||||
export async function clearEditor({ page }: { page: Page }) {
|
||||
await page.keyboard.press('ControlOrMeta+a');
|
||||
export async function clearEditor({
|
||||
page,
|
||||
browserName
|
||||
}: {
|
||||
page: Page;
|
||||
browserName: string;
|
||||
}) {
|
||||
// TODO: replace with ControlOrMeta when it's supported
|
||||
if (browserName === 'webkit') {
|
||||
await page.keyboard.press('Meta+a');
|
||||
} else {
|
||||
await page.keyboard.press('Control+a');
|
||||
}
|
||||
await page.keyboard.press('Backspace');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user