Add test for cmd-down deleting typed text

pull/7326/head
Phoenix Eliot 2022-11-13 19:03:15 -05:00 committed by Tienson Qin
parent bce90001a5
commit a4e581b4b9
1 changed files with 37 additions and 0 deletions

View File

@ -537,3 +537,40 @@ test('should show text after soft return when node is collapsed #5074', async ({
'Before soft return\nAfter soft return'
)
})
test('should not erase typed text when expanding block quickly after typing #3891', async ({ page, block }) => {
await createRandomPage(page)
await block.mustFill('initial text,')
await page.waitForTimeout(500)
await page.type('textarea >> nth=0', ' then expand', { delay: 10 })
// A quick cmd-down must not destroy the typed text
if (IsMac) {
await page.keyboard.press('Meta+ArrowDown')
} else {
await page.keyboard.press('Control+ArrowDown')
}
await page.waitForTimeout(500)
expect(await page.inputValue('textarea >> nth=0')).toBe(
'initial text, then expand'
)
// First undo should delete the last typed information, not undo a no-op expand action
if (IsMac) {
await page.keyboard.press('Meta+z')
} else {
await page.keyboard.press('Control+z')
}
expect(await page.inputValue('textarea >> nth=0')).toBe(
'initial text,'
)
if (IsMac) {
await page.keyboard.press('Meta+z')
} else {
await page.keyboard.press('Control+z')
}
expect(await page.inputValue('textarea >> nth=0')).toBe(
''
)
})