import { describe, it } from '@ephox/bedrock-client'; import { LegacyUnit, TinyAssertions, TinyHooks, TinySelections } from '@ephox/wrap-mcagar'; import { assert } from 'chai'; import Editor from 'tinymce/core/api/Editor'; import Tools from 'tinymce/core/api/util/Tools'; import * as HtmlUtils from '../../module/test/HtmlUtils'; describe('browser.tinymce.core.keyboard.EnterKeyTest', () => { const hook = TinyHooks.bddSetupLight({ add_unload_trigger: false, disable_nodechange: true, schema: 'html5', extended_valid_elements: 'div[id|style|contenteditable],span[id|style|contenteditable],#dt,#dd', entities: 'raw', indent: false, text_patterns: false, // TODO TINY-8341 investigate why this is needed base_url: '/project/tinymce/js/tinymce' }, []); const pressEnter = (editor: Editor, shouldBeParagraph: boolean, evt?: any) => { const inputEvents: string[] = []; const dom = editor.dom; const target = editor.selection.getNode(); const collect = (event: InputEvent) => { inputEvents.push(event.inputType); }; evt = Tools.extend({ keyCode: 13, shiftKey: false }, evt); editor.on('input', collect); dom.dispatch(target, 'keydown', evt); dom.dispatch(target, 'keypress', evt); dom.dispatch(target, 'keyup', evt); editor.off('input', collect); assert.deepEqual([ shouldBeParagraph ? 'insertParagraph' : 'insertLineBreak' ], inputEvents, 'Events not fired as expected'); }; it('Enter at end of H1', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'h1', 3); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); assert.equal(editor.selection.getRng().startContainer.nodeName, 'P'); }); it('Enter in midde of H1', () => { const editor = hook.editor(); editor.setContent('

abcd

'); LegacyUnit.setSelection(editor, 'h1', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

cd

'); assert.equal(editor.selection.getRng().startContainer.parentNode?.nodeName, 'H1'); }); it('Enter before text after EM', () => { const editor = hook.editor(); editor.setContent('

ab

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

a

b

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeValue, 'b'); }); it('Enter before first IMG in P', () => { const editor = hook.editor(); editor.setContent('

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

'); }); it('Enter before first wrapped IMG in P', () => { const editor = hook.editor(); editor.setContent('

'); editor.selection.setCursorLocation(editor.getBody().firstChild?.firstChild as HTMLElement, 0); pressEnter(editor, true); assert.equal((editor.getBody().firstChild as HTMLElement).innerHTML, '
'); TinyAssertions.assertContent(editor, '

\u00a0

'); }); it('Enter before last IMG in P with text', () => { const editor = hook.editor(); editor.setContent('

abc

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'P'); assert.equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG'); }); it('Enter before last IMG in P with IMG sibling', () => { const editor = hook.editor(); editor.setContent('

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'P'); assert.equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG'); }); it('Enter after last IMG in P', () => { const editor = hook.editor(); editor.setContent('

abc

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); }); it('Enter before last INPUT in P with text', () => { const editor = hook.editor(); editor.setContent('

abc

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'P'); assert.equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT'); }); it('Enter before last INPUT in P with IMG sibling', () => { const editor = hook.editor(); editor.setContent('

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'P'); assert.equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT'); }); it('Enter after last INPUT in P', () => { const editor = hook.editor(); editor.setContent('

abc

'); editor.selection.setCursorLocation(editor.getBody().firstChild as HTMLParagraphElement, 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); }); it('Enter at end of P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'p', 3); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); assert.equal(editor.selection.getRng().startContainer.nodeName, 'P'); }); it('Enter at end of EM inside P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'em', 3); pressEnter(editor, true); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML).replace(/]+|)>| /g, ''), '

abc

' ); assert.equal(editor.selection.getRng().startContainer.nodeName, 'EM'); }); it('Enter at middle of EM inside P', () => { const editor = hook.editor(); editor.setContent('

abcd

'); LegacyUnit.setSelection(editor, 'em', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

cd

'); assert.equal(editor.selection.getRng().startContainer.parentNode?.nodeName, 'EM'); }); it('Enter at beginning EM inside P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'em', 0); pressEnter(editor, true); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML).replace(/]+|)>| /g, ''), '

abc

' ); assert.equal(editor.selection.getRng().startContainer.nodeValue, 'abc'); }); it('Enter at end of STRONG in EM inside P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'strong', 3); pressEnter(editor, true); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML).replace(/]+|)>| /g, ''), '

abc

' ); assert.equal(editor.selection.getRng().startContainer.nodeName, 'STRONG'); }); it('Enter at middle of STRONG in EM inside P', () => { const editor = hook.editor(); editor.setContent('

abcd

'); LegacyUnit.setSelection(editor, 'strong', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

cd

'); assert.equal(editor.selection.getRng().startContainer.parentNode?.nodeName, 'STRONG'); }); it('Enter at beginning STRONG in EM inside P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'strong', 0); pressEnter(editor, true); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML).replace(/]+|)>| /g, ''), '

abc

' ); assert.equal(editor.selection.getRng().startContainer.nodeValue, 'abc'); }); it('Enter at beginning of P', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

abc

'); assert.equal(editor.selection.getRng().startContainer.nodeValue, 'abc'); }); it('Enter at middle of P with style, id and class attributes', () => { const editor = hook.editor(); editor.setContent('

abcd

'); LegacyUnit.setSelection(editor, 'p', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

cd

'); assert.equal(editor.selection.getRng().startContainer.parentNode?.nodeName, 'P'); }); it('Enter at a range between H1 and P', () => { const editor = hook.editor(); editor.setContent('

abcd

efgh

'); LegacyUnit.setSelection(editor, 'h1', 2, 'p', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

gh

'); assert.equal(editor.selection.getNode().nodeName, 'H1'); }); it('Enter at a range between LI elements', () => { const editor = hook.editor(); editor.setContent('
  • abcd
  • efgh
'); LegacyUnit.setSelection(editor, 'li:nth-child(1)', 2, 'li:nth-child(2)', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
  • ab
  • gh
'); assert.equal(editor.selection.getNode().nodeName, 'LI'); }); it('Enter at end of H1 in HGROUP', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'h1', 3); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); assert.equal(editor.selection.getRng().startContainer.nodeName, 'H1'); }); it('Enter inside empty TD', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
'; LegacyUnit.setSelection(editor, 'td', 0); pressEnter(editor, true); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML).replace(/]+|)>| /g, ''), '

' ); assert.equal(editor.selection.getNode().nodeName, 'P'); }); it('Shift+Enter inside STRONG inside TD with BR', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
d e
'; LegacyUnit.setSelection(editor, 'strong', 1); pressEnter(editor, false, { shiftKey: true }); assert.equal( HtmlUtils.cleanHtml(editor.getBody().innerHTML), '
d e

' ); assert.equal(editor.selection.getNode().nodeName, 'STRONG'); }); it('Enter inside middle of text node in body', () => { const editor = hook.editor(); editor.getBody().innerHTML = 'abcd'; LegacyUnit.setSelection(editor, 'body', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

ab

cd

'); assert.equal(editor.selection.getNode().nodeName, 'P'); }); it('Enter inside at beginning of text node in body', () => { const editor = hook.editor(); editor.getBody().innerHTML = 'abcd'; LegacyUnit.setSelection(editor, 'body', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

abcd

'); assert.equal(editor.selection.getNode().nodeName, 'P'); }); it('Enter inside at end of text node in body', () => { const editor = hook.editor(); editor.getBody().innerHTML = 'abcd'; LegacyUnit.setSelection(editor, 'body', 4); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abcd

\u00a0

'); assert.equal(editor.selection.getNode().nodeName, 'P'); }); it('Enter inside empty body', () => { const editor = hook.editor(); editor.getBody().innerHTML = ''; LegacyUnit.setSelection(editor, 'body', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

\u00a0

'); assert.equal(editor.selection.getNode().nodeName, 'P'); }); it('Enter in empty P at the end of a blockquote and end_container_on_empty_block: true', () => { const editor = hook.editor(); editor.options.set('end_container_on_empty_block', true); editor.getBody().innerHTML = '

abc


'; LegacyUnit.setSelection(editor, 'p:last-of-type', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); editor.options.set('forced_root_block', 'p'); }); it('Enter in empty P at the beginning of a blockquote and end_container_on_empty_block: true', () => { const editor = hook.editor(); editor.options.set('end_container_on_empty_block', true); editor.getBody().innerHTML = '


abc

'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

abc

'); editor.options.set('forced_root_block', 'p'); }); it('Enter in empty P at in the middle of a blockquote and end_container_on_empty_block: true', () => { const editor = hook.editor(); editor.options.set('end_container_on_empty_block', true); editor.getBody().innerHTML = '

abc


123

'; LegacyUnit.setSelection(editor, 'p:nth-child(2)', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

123

'); editor.getBody().innerHTML = '

abc

\u00a0


123

'; LegacyUnit.setSelection(editor, 'p:nth-child(3)', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

\u00a0

123

'); editor.options.set('forced_root_block', 'p'); }); it('Enter inside empty P with empty P siblings', () => { const editor = hook.editor(); // Tests that a workaround for an IE bug is working correctly editor.getBody().innerHTML = '

X

'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

\u00a0

\u00a0

X

'); }); it('Enter at end of H1 with forced_root_block_attrs', () => { const editor = hook.editor(); editor.options.set('forced_root_block_attrs', { class: 'class1' }); editor.getBody().innerHTML = '

a

'; LegacyUnit.setSelection(editor, 'h1', 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

a

\u00a0

'); editor.options.unset('forced_root_block_attrs'); }); it('Shift+Enter at beginning of P', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

abc

'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, false, { shiftKey: true }); TinyAssertions.assertContent(editor, '


abc

'); }); it('Shift+Enter in the middle of P', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

abcd

'; LegacyUnit.setSelection(editor, 'p', 2); pressEnter(editor, false, { shiftKey: true }); TinyAssertions.assertContent(editor, '

ab
cd

'); }); it('Shift+Enter at the end of P', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

abcd

'; LegacyUnit.setSelection(editor, 'p', 4); pressEnter(editor, false, { shiftKey: true }); TinyAssertions.assertContent(editor, '

abcd

'); }); it('Shift+Enter in the middle of B with a BR after it', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

abcd

'; LegacyUnit.setSelection(editor, 'strong', 2); pressEnter(editor, false, { shiftKey: true }); TinyAssertions.assertContent(editor, '

ab
cd

'); }); it('Shift+Enter at the end of B with a BR after it', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

abcd

'; LegacyUnit.setSelection(editor, 'strong', 4); pressEnter(editor, false, { shiftKey: true }); TinyAssertions.assertContent(editor, '

abcd

'); }); it('Enter in beginning of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abc
'; LegacyUnit.setSelection(editor, 'pre', 0); pressEnter(editor, false); TinyAssertions.assertContent(editor, '

abc
'); }); it('Enter in the middle of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 2); pressEnter(editor, false); TinyAssertions.assertContent(editor, '
ab
cd
'); }); it('Enter at the end of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 4); pressEnter(editor, false); TinyAssertions.assertContent(editor, '
abcd

'); }); it('Enter in beginning of PRE and br_in_pre: false', () => { const editor = hook.editor(); editor.options.set('br_in_pre', false); editor.getBody().innerHTML = '
abc
'; LegacyUnit.setSelection(editor, 'pre', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
\u00a0
abc
'); editor.options.unset('br_in_pre'); }); it('Enter in the middle of PRE and br_in_pre: false', () => { const editor = hook.editor(); editor.options.set('br_in_pre', false); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
ab
cd
'); editor.options.unset('br_in_pre'); }); it('Enter at the end of PRE and br_in_pre: false', () => { const editor = hook.editor(); editor.options.set('br_in_pre', false); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 4); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
abcd

\u00a0

'); editor.options.unset('br_in_pre'); }); it('Shift+Enter in beginning of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abc
'; LegacyUnit.setSelection(editor, 'pre', 0); pressEnter(editor, true, { shiftKey: true }); TinyAssertions.assertContent(editor, '
\u00a0
abc
'); }); it('Shift+Enter in the middle of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 2); pressEnter(editor, true, { shiftKey: true }); TinyAssertions.assertContent(editor, '
ab
cd
'); }); it('Shift+Enter at the end of PRE', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abcd
'; LegacyUnit.setSelection(editor, 'pre', 4); pressEnter(editor, true, { shiftKey: true }); TinyAssertions.assertContent(editor, '
abcd

\u00a0

'); }); it('Enter at the end of DIV layer', () => { const editor = hook.editor(); editor.options.set('br_in_pre', false); editor.setContent('
abcd
'); LegacyUnit.setSelection(editor, 'div', 4); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abcd

\u00a0

'); editor.options.unset('br_in_pre'); }); it('Enter at end of text in a span inside a P and keep_styles: false', () => { const editor = hook.editor(); editor.options.set('keep_styles', false); editor.getBody().innerHTML = '

X

'; LegacyUnit.setSelection(editor, 'span', 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

X

\u00a0

'); editor.options.unset('keep_styles'); }); it('keep_styles=false: P should not pass its styles and classes to the new P that is cloned from it when enter is pressed', () => { const editor = hook.editor(); editor.options.set('keep_styles', false); editor.getBody().innerHTML = '

X

'; LegacyUnit.setSelection(editor, 'span', 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

X

\u00a0

'); editor.options.unset('keep_styles'); }); it('Enter at end of br line', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

a
b

'; LegacyUnit.setSelection(editor, 'p', 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

a


b

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'P'); assert.equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'BR'); }); it('Enter before BR between DIVs', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
abc

d
'; const rng = editor.dom.createRng(); rng.setStartBefore(editor.dom.select('br')[0]); rng.setEndBefore(editor.dom.select('br')[0]); editor.selection.setRng(rng); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
abc

\u00a0

\u00a0

d
'); }); // Only test these on modern browsers it('Enter behind table element', () => { const editor = hook.editor(); const rng = editor.dom.createRng(); editor.getBody().innerHTML = '
x
'; rng.setStartAfter(editor.getBody().lastChild as HTMLTableElement); rng.setEndAfter(editor.getBody().lastChild as HTMLTableElement); editor.selection.setRng(rng); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
x

\u00a0

'); }); it('Enter before table element', () => { const editor = hook.editor(); const rng = editor.dom.createRng(); editor.getBody().innerHTML = '
x
'; rng.setStartBefore(editor.getBody().lastChild as HTMLTableElement); rng.setEndBefore(editor.getBody().lastChild as HTMLTableElement); editor.selection.setRng(rng); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

x
'); }); it('Enter behind table followed by a p', () => { const editor = hook.editor(); const rng = editor.dom.createRng(); editor.getBody().innerHTML = '
x

x

'; rng.setStartAfter(editor.getBody().firstChild as HTMLTableElement); rng.setEndAfter(editor.getBody().firstChild as HTMLTableElement); editor.selection.setRng(rng); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
x

\u00a0

x

'); }); it('Enter before table element preceded by a p', () => { const editor = hook.editor(); const rng = editor.dom.createRng(); editor.getBody().innerHTML = '

x

x
'; rng.setStartBefore(editor.getBody().lastChild as HTMLTableElement); rng.setStartBefore(editor.getBody().lastChild as HTMLTableElement); editor.selection.setRng(rng); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

x

\u00a0

x
'); }); it('Enter twice before table element', () => { const editor = hook.editor(); const rng = editor.dom.createRng(); editor.getBody().innerHTML = '
x
'; rng.setStartBefore(editor.getBody().lastChild as HTMLTableElement); rng.setEndBefore(editor.getBody().lastChild as HTMLTableElement); editor.selection.setRng(rng); pressEnter(editor, true); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

\u00a0

x
'); }); it('Enter after span with space', () => { const editor = hook.editor(); editor.setContent('

abc

'); LegacyUnit.setSelection(editor, 'strong', 3); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

abc

\u00a0

'); const rng = editor.selection.getRng(); assert.equal(rng.startContainer.nodeName, 'STRONG'); assert.equal(rng.startContainer.textContent !== ' ', true); }); it('Enter inside first li with block inside', () => { const editor = hook.editor(); editor.getBody().innerHTML = '

  • b

  • c
'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

\u00a0

  • b

  • c
'); }); it('Enter inside middle li with block inside', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
  • a

  • c
'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
  • a

\u00a0

  • c
'); }); it('Enter inside last li with block inside', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
  • a
  • b

'; LegacyUnit.setSelection(editor, 'p', 0); pressEnter(editor, true); TinyAssertions.assertContent(editor, '
  • a
  • b

\u00a0

'); }); it('Enter inside summary element', () => { const editor = hook.editor(); editor.getBody().innerHTML = '
ab
'; LegacyUnit.setSelection(editor, 'summary', 1); pressEnter(editor, false); TinyAssertions.assertContent(editor, '
a
b
'); }); it('Enter on expanded range', () => { const editor = hook.editor(); editor.setContent('

abc

'); TinySelections.setSelection(editor, [ 0, 0 ], 1, [ 0, 0 ], 2); pressEnter(editor, true); TinyAssertions.assertContent(editor, '

a

c

'); TinySelections.setSelection(editor, [ 1, 0 ], 0, [ 1, 0 ], 0); }); it('TINY-9461: Enter inside an editing host should not split the editing host', () => { const editor = hook.editor(); const initialContent = '

ab

'; editor.getBody().contentEditable = 'false'; editor.setContent(initialContent); TinySelections.setCursor(editor, [ 0, 0 ], 1); pressEnter(editor, true); TinyAssertions.assertContent(editor, initialContent); editor.getBody().contentEditable = 'false'; }); });