fix formatting

This commit is contained in:
Kanstantsin_Vikhor 2024-02-28 15:14:40 +04:00
parent 7cd05fe6eb
commit 398b0118a4
2 changed files with 19 additions and 6 deletions

View file

@ -16,10 +16,13 @@ export function isMutationBelongsToElement(mutationRecord: MutationRecord, eleme
*/
if (type === 'childList') {
const elementAddedItself = Array.from(addedNodes).some(node => node === element);
if (elementAddedItself) {
return true;
}
const elementRemovedItself = Array.from(removedNodes).some(node => node === element);
if (elementRemovedItself) {
return true;
}

View file

@ -28,7 +28,7 @@ describe('onChange callback', () => {
const config = {
tools: {
header: Header,
code: Code
code: Code,
},
onChange: (api, event): void => {
console.log('something changed', event);
@ -790,15 +790,24 @@ describe('onChange callback', () => {
});
it('should be fired when the whole text inside some descendant of the block is removed', () => {
/**
* Mock of Tool with nested contenteditable element
*/
class ToolWithContentEditableDescendant extends ToolMock {
/**
* Creates element with nested contenteditable element
*/
public render(): HTMLElement {
const contenteditable = document.createElement('div');
contenteditable.contentEditable = 'true';
contenteditable.innerText = 'a';
contenteditable.setAttribute('data-cy', 'nested-contenteditable');
const wrapper = document.createElement('div');
wrapper.appendChild(contenteditable);
return wrapper;
}
}
@ -813,14 +822,15 @@ describe('onChange callback', () => {
blocks: [
{
type: 'testTool',
data: 'a'
}
]
data: 'a',
},
],
},
onChange: (): void => {
console.log('something changed');
}
}
},
};
cy.spy(config, 'onChange').as('onChange');
cy.createEditor(config).as('editorInstance');