forked from codex-team/editor.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(block): remember plugin's content element instead of dom search (c…
…odex-team#2311) * fix(block): remember plugin's content element instead of dom search * improve doc * test case added
- Loading branch information
Showing
5 changed files
with
51 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
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
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,37 @@ | ||
import type EditorJS from '../../../../types/index'; | ||
|
||
describe('Saver module', function () { | ||
describe('save()', function () { | ||
it('should correctly save block if there are some 3rd party (eg. browser extensions) nodes inserted into the layout', function () { | ||
cy.createEditor({ | ||
data: { | ||
blocks: [ | ||
{ | ||
type: 'paragraph', | ||
data: { | ||
text: 'The block with some text', | ||
}, | ||
}, | ||
], | ||
}, | ||
}).then((editor: EditorJS) => { | ||
/** | ||
* Add some node just like browser extensions doing | ||
*/ | ||
const extensionNode = document.createElement('extension-node'); | ||
|
||
cy.get('[data-cy=editorjs]') | ||
.find('.ce-block__content') | ||
.then((blockContent) => { | ||
blockContent.append(extensionNode); | ||
}) | ||
.then(async () => { | ||
const savedData = await editor.save(); | ||
|
||
expect(savedData.blocks.length).to.equal(1); | ||
expect(savedData.blocks[0].data.text).to.equal('The block with some text'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |