-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: split pasting tests into collab/non-collab
- Loading branch information
1 parent
cec47b1
commit cb9beba
Showing
2 changed files
with
30 additions
and
22 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/editor/e2e-tests/__tests__/pasting-collaboration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** @jest-environment ./setup/collaborative.jest.env.ts */ | ||
|
||
import {describe, expect, it} from '@jest/globals' | ||
|
||
// Ideally pasting should be tested in a testing-library test, but I have not found a way to do it natively with testing-lib. | ||
// The problem is to get permission to write to the host clipboard. | ||
// We can do it in these test's though (as we can override browser permissions through packages/@sanity/portable-text-editor/test/setup/collaborative.jest.env.ts) | ||
describe('Feature: Pasting Collaboration', () => { | ||
it('can paste into an populated editor', async () => { | ||
const [editorA, editorB] = await getEditors() | ||
await editorB.insertText('Hey!') | ||
await editorA.paste('Yo!') | ||
const valueA = await editorA.getValue() | ||
expect(valueA).toMatchObject([ | ||
{ | ||
_key: 'B-4', | ||
_type: 'block', | ||
children: [{_type: 'span', marks: [], text: 'Hey!Yo!'}], // _key is random here (from @sanity/block-tools) and is left out. | ||
markDefs: [], | ||
style: 'normal', | ||
}, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters