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 3fe8d65936d..697da70a6db 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
@@ -2132,7 +2132,7 @@ export function setTagName(el, newTagName) {
return el;
}
const n = document.createElement(newTagName);
- if (paragraphRelatedElements.includes(el.nodeName)) {
+ if (el.nodeName !== 'LI') {
const attributes = el.attributes;
for (const attr of attributes) {
n.setAttribute(attr.name, attr.value);
diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/list.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/list.test.js
index 377d261860c..33f89acf04d 100644
--- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/list.test.js
+++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/list.test.js
@@ -38,6 +38,20 @@ describe('List', () => {
contentAfter: '
',
});
});
+ it('should turn a ordered list into a unordered list', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '- ab[]cd
',
+ stepFunction: toggleUnorderedList,
+ contentAfter: '',
+ });
+ });
+ it('should turn a checked list into a unordered list', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '',
+ stepFunction: toggleUnorderedList,
+ contentAfter: '',
+ });
+ });
it('should turn a heading into a list', async () => {
await testEditor(BasicEditor, {
contentBefore: 'ab[]cd
',
@@ -307,6 +321,20 @@ describe('List', () => {
contentAfter: '- ab[]cd
',
});
});
+ it('should turn a unordered list into a ordered list', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '',
+ stepFunction: toggleOrderedList,
+ contentAfter: '- ab[]cd
',
+ });
+ });
+ it('should turn a checked list into a ordered list', async () => {
+ await testEditor(BasicEditor, {
+ contentBefore: '',
+ stepFunction: toggleOrderedList,
+ contentAfter: '- ab[]cd
',
+ });
+ });
it('should turn a heading into a list', async () => {
await testEditor(BasicEditor, {
contentBefore: 'ab[]cd
',
@@ -525,6 +553,22 @@ describe('List', () => {
contentAfter: '',
});
});
+ it('should turn a ordered list into a checklist', async () => {
+ await testEditor(BasicEditor, {
+ removeCheckIds: true,
+ contentBefore: '- ab[]cd
',
+ stepFunction: toggleCheckList,
+ contentAfter: '',
+ });
+ });
+ it('should turn a unordered list into a checklist', async () => {
+ await testEditor(BasicEditor, {
+ removeCheckIds: true,
+ contentBefore: '',
+ stepFunction: toggleCheckList,
+ contentAfter: '',
+ });
+ });
it('should turn a heading into a checklist', async () => {
await testEditor(BasicEditor, {
removeCheckIds: true,