mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 15:15:47 +01:00
* fix types export * lint * changelog * tests fixed * fix tests imports * lint tests * upd submodule * Update yarn.lock * rename wrapper to factory * Update package.json * rename to adapters * Update tools.d.ts * BlockTool -> BlockToolAdapter etc * Update nested-list * Update collection.ts
23 lines
693 B
TypeScript
23 lines
693 B
TypeScript
import type { EditorConfig } from '../../../../types/index';
|
|
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
|
|
* @param editorConfig - config to pass to the editor
|
|
*/
|
|
export function createEditorWithTextBlocks(textBlocks: string[], editorConfig?: Omit<EditorConfig, 'data'>): Chainable<EditorJS> {
|
|
return cy.createEditor(Object.assign(editorConfig || {}, {
|
|
data: {
|
|
blocks: textBlocks.map((text) => ({
|
|
type: 'paragraph',
|
|
data: {
|
|
text,
|
|
},
|
|
})),
|
|
},
|
|
}));
|
|
}
|