1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 09:59:48 +02:00

Add Safari workaround inside shadow DOM. (#5648)

* Add Safari workaround inside shadow DOM.

* Add E2E test.

* Move browser checks to environment.ts

* Remove leftover @ts-ignore.
Fix linting change.

* Update `getActiveElement`

* Create red-poems-wave.md

* Fix prettier.

* Update E2E test.
This commit is contained in:
Mahmoud Elsayad
2024-05-15 18:17:18 +03:00
committed by GitHub
parent d0d4c63649
commit 0bb7be5496
6 changed files with 103 additions and 3 deletions

View File

@@ -12,4 +12,22 @@ test.describe('shadow-dom example', () => {
await expect(innerShadow.getByRole('textbox')).toHaveCount(1)
})
test('renders slate editor inside nested shadow and edits content', async ({
page,
}) => {
const outerShadow = page.locator('[data-cy="outer-shadow-root"]')
const innerShadow = outerShadow.locator('> div')
const textbox = innerShadow.getByRole('textbox')
// Ensure the textbox is present
await expect(textbox).toHaveCount(1)
// Clear any existing text and type new text into the textbox
await textbox.fill('') // Clears the textbox
await textbox.type('Hello, Playwright!')
// Assert that the textbox contains the correct text
await expect(textbox).toHaveValue('Hello, Playwright!')
})
})