mirror of
https://github.com/codex-team/editor.js
synced 2024-06-09 17:32:31 +02:00
add test case verifying that 'onChange' is fired when the whole text inside some nested descendant of the block is removed
This commit is contained in:
parent
439adcd410
commit
bea6dea6cc
|
@ -47,6 +47,7 @@
|
|||
"@editorjs/header": "^2.7.0",
|
||||
"@editorjs/paragraph": "^2.11.3",
|
||||
"@editorjs/simple-image": "^1.4.1",
|
||||
"@editorjs/checklist": "^1.6.0",
|
||||
"@types/node": "^18.15.11",
|
||||
"chai-subset": "^1.6.0",
|
||||
"codex-notifier": "^1.1.2",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Header from '@editorjs/header';
|
||||
import Code from '@editorjs/code';
|
||||
import Checklist from '@editorjs/checklist';
|
||||
import Delimiter from '@editorjs/delimiter';
|
||||
import { BlockAddedMutationType } from '../../../types/events/block/BlockAdded';
|
||||
import { BlockChangedMutationType } from '../../../types/events/block/BlockChanged';
|
||||
|
@ -28,6 +29,7 @@ describe('onChange callback', () => {
|
|||
tools: {
|
||||
header: Header,
|
||||
code: Code,
|
||||
checklist: Checklist
|
||||
},
|
||||
onChange: (api, event): void => {
|
||||
console.log('something changed', event);
|
||||
|
@ -787,4 +789,32 @@ describe('onChange callback', () => {
|
|||
}));
|
||||
});
|
||||
});
|
||||
|
||||
it('should be fired when the whole text inside some descendant of the block is removed', () => {
|
||||
createEditor([
|
||||
{
|
||||
type: "checklist",
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
text: 'a',
|
||||
checked: false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
cy.get('[data-cy=editorjs')
|
||||
.get('div.cdx-checklist__item-text')
|
||||
.click()
|
||||
.clear();
|
||||
|
||||
cy.get('@onChange').should('be.calledWithMatch', EditorJSApiMock, Cypress.sinon.match({
|
||||
type: BlockChangedMutationType,
|
||||
detail: {
|
||||
index: 0,
|
||||
},
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -550,6 +550,13 @@
|
|||
debug "^3.1.0"
|
||||
lodash.once "^4.1.1"
|
||||
|
||||
"@editorjs/checklist@^1.6.0":
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@editorjs/checklist/-/checklist-1.6.0.tgz#f3e501b0422917ca78fd08cb51578098a26a1823"
|
||||
integrity sha512-hRNP36DInr73mSK3noHBQeoQb7DA12ANfqTXufEkTgQzx+k4mRJ0HdeGukTIR4JbwjHJ9ecUBnnQqIEGnxCFEg==
|
||||
dependencies:
|
||||
"@codexteam/icons" "^0.3.0"
|
||||
|
||||
"@editorjs/code@^2.7.0":
|
||||
version "2.8.0"
|
||||
resolved "https://registry.yarnpkg.com/@editorjs/code/-/code-2.8.0.tgz#d31fdd947b9c763daae2cd2eabdf8dc37c0c6f5a"
|
||||
|
|
Loading…
Reference in a new issue