diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index 519e10cea28..be1dacca72f 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -1973,6 +1973,11 @@ export function splitElement(element, offset) { index < offset ? before.appendChild(child) : after.appendChild(child); index++; } + // e.g.:

Test/banner

+ ENTER <=>

Test


", + }, + ], + }, + }, + }; + setupViewRegistries(); + patchWithCleanup(Wysiwyg.prototype, { + init() { + super.init(...arguments); + wysiwyg = this; + }, + }); + await makeView({ + type: "form", + serverData, + resModel: "note", + arch: + "
" + + '' + + "", + resId: 1, + }); + }, + }, + function () { + + QUnit.module("insert a new banner"); + QUnit.test("should insert a banner followed by a paragraph", async function (assert) { + const { editor, editable } = onMount(); + const node = editable.querySelector("p"); + setSelection(node, 0); + insertText(editor, "Test"); + setSelection(node.firstChild, 3, node.firstChild, 3); + insertText(editor, '/banner'); + triggerEvent(editor.editable, "keydown", { key: "Enter" }); + await nextTick(); + assert.strictEqual( + editable.innerHTML, + `

Test

+ +
+


+
+


`, + ); + }); + } +);