Skip to content

Commit

Permalink
add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
megayu authored and tiensonqin committed Jul 5, 2023
1 parent 3127ea1 commit 1bf2371
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion e2e-tests/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,4 +817,45 @@ test.describe('Auto-pair symbols only with text selection', () => {
expect(selection).toBe('Lorem')
})
}
})
})

test('copy blocks should remove all ref-related values', async ({ page, block }) => {
await createRandomPage(page)

await block.mustFill('test')
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v')
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)

await page.keyboard.press('ArrowUp')
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await expect(page.locator('.ls-block.selected')).toHaveCount(1)
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v', { delay: 10 })
await block.clickNext() // let 3rd block leave editing state
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)
})

test('undo cut block should recover refs', async ({ page, block }) => {
await createRandomPage(page)

await block.mustFill('test')
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v')
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)

await page.keyboard.press('ArrowUp')
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await expect(page.locator('.ls-block.selected')).toHaveCount(1)
await page.keyboard.press(modKey + '+x', { delay: 10 })
await expect(page.locator('.ls-block')).toHaveCount(1)
await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)
await expect(page.locator('.ls-block')).toHaveCount(2)
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)
})

0 comments on commit 1bf2371

Please sign in to comment.