|
1 | 1 | import { createEditorWithTextBlocks } from '../../support/utils/createEditorWithTextBlocks'; |
2 | 2 | import type EditorJS from '../../../../types/index'; |
3 | | -import { NestedEditorTool } from '../../fixtures/tools/NestedEditorTool'; |
| 3 | +import NestedEditor, { NESTED_EDITOR_ID } from '../../support/utils/nestedEditorInstance'; |
4 | 4 |
|
5 | 5 | describe('Ui module', function () { |
6 | 6 | describe('documentKeydown', function () { |
@@ -142,58 +142,37 @@ describe('Ui module', function () { |
142 | 142 | }); |
143 | 143 |
|
144 | 144 | it('click on block of nested editor should also set the block of parent editor as current', function () { |
145 | | - cy.window() |
146 | | - .then((window) => { |
147 | | - const editorJsClass = window.EditorJS; |
148 | | - |
149 | | - cy.createEditor({ |
150 | | - tools: { |
151 | | - nestedEditor: { |
152 | | - class: NestedEditorTool, |
153 | | - config: { |
154 | | - editorLibrary: editorJsClass |
155 | | - } |
| 145 | + cy.createEditor({ |
| 146 | + tools: { |
| 147 | + nestedEditor: { |
| 148 | + class: NestedEditor, |
| 149 | + }, |
| 150 | + }, |
| 151 | + data: { |
| 152 | + blocks: [ |
| 153 | + { |
| 154 | + type: 'paragraph', |
| 155 | + data: { |
| 156 | + text: 'First block of parent editor', |
156 | 157 | }, |
157 | 158 | }, |
158 | | - data: { |
159 | | - blocks: [ |
160 | | - { |
161 | | - id: 'block1', |
162 | | - type: 'paragraph', |
163 | | - data: { |
164 | | - text: 'First block of parent editor', |
165 | | - }, |
166 | | - }, |
167 | | - { |
168 | | - id: 'block2', |
169 | | - type: 'paragraph', |
170 | | - data: { |
171 | | - text: 'Second block of parent editor', |
172 | | - }, |
173 | | - }, |
174 | | - { |
175 | | - id: 'block3', |
176 | | - type: 'nestedEditor', |
177 | | - data: { |
178 | | - nestedEditor: { |
179 | | - blocks: [ |
180 | | - { |
181 | | - id: 'nestedBlock1', |
182 | | - type: 'paragraph', |
183 | | - data: { |
184 | | - text: 'First block of nested editor', |
185 | | - }, |
186 | | - } |
187 | | - ] |
188 | | - } |
189 | | - } |
190 | | - } |
191 | | - ], |
| 159 | + { |
| 160 | + type: 'paragraph', |
| 161 | + data: { |
| 162 | + text: 'Second block of parent editor', |
| 163 | + }, |
192 | 164 | }, |
193 | | - }).as('editorInstance'); |
194 | | - }); |
| 165 | + { |
| 166 | + type: 'nestedEditor', |
| 167 | + data: { |
| 168 | + text: 'First block of nested editor', |
| 169 | + }, |
| 170 | + }, |
| 171 | + ], |
| 172 | + }, |
| 173 | + }).as('editorInstance'); |
195 | 174 |
|
196 | | - cy.get('[data-id=nestedBlock1]') |
| 175 | + cy.get(`[data-cy=${NESTED_EDITOR_ID}]`) |
197 | 176 | .find('.ce-paragraph') |
198 | 177 | .click(); |
199 | 178 |
|
|
0 commit comments