editor.js/test/cypress/support/utils/createEditorWithTextBlocks.ts
Peter Savchenko afa99a4a8e
fix(caret): trailing spaces handling (#2741)
* Imporove caret.isAtStart

* use selection to simplify caret at start/end check

* caret util and tests

* lint

* eslint fix

* fix tests

* patch version, changelog

* fix navigation out of delimiter

* arrow left tests

* left/right arrow tests

* chore: Fix typo in comment for block navigation

* lint fix

* resolve some ts errors in strict mode

* Revert "resolve some ts errors in strict mode"

This reverts commit 3252ac679f.

* ts errors fix

* rename utils
2024-06-28 21:20:53 +03:00

21 lines
500 B
TypeScript

import Chainable = Cypress.Chainable;
import type EditorJS from '../../../../types/index';
/**
* Creates Editor instance with list of Paragraph blocks of passed texts
*
* @param textBlocks - list of texts for Paragraph blocks
*/
export function createEditorWithTextBlocks(textBlocks: string[]): Chainable<EditorJS> {
return cy.createEditor({
data: {
blocks: textBlocks.map((text) => ({
type: 'paragraph',
data: {
text,
},
})),
},
});
}