diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js
index 506646d4697..59dbdd2c477 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js
@@ -173,6 +173,7 @@ var BulletPlugin = AbstractPlugin.extend({
} else {
ul = this.document.createElement(sorted === "ol" ? "ol" : "ul");
ul.className = ol.className;
+ $(ul).removeClass('o_checklist');
$(ul).insertBefore(ol).append(lis);
parent.removeChild(ol);
}
diff --git a/addons/web_editor/static/tests/wysiwyg_tests.js b/addons/web_editor/static/tests/wysiwyg_tests.js
index 3146f908520..98c08f504b8 100644
--- a/addons/web_editor/static/tests/wysiwyg_tests.js
+++ b/addons/web_editor/static/tests/wysiwyg_tests.js
@@ -1193,7 +1193,7 @@ QUnit.test('Text bgcolor', function (assert) {
QUnit.test('Unordered list', function (assert) {
var done = assert.async();
- assert.expect(10);
+ assert.expect(34);
return weTestUtils.createWysiwyg({
debug: false,
@@ -1275,6 +1275,176 @@ QUnit.test('Unordered list', function (assert) {
end: 'p:eq(2):contents()[0]->5',
},
},
+ // Conversion from OL
+ {
+ name: "Click UL: ol -> ul",
+ content: '
dom not to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ol -> ul (across li's)",
+ content: 'dom not to edit
dom to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ol -> ul (from second li)",
+ content: 'dom not to edit
xxx
dom to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ol -> ul ul (from indented li)",
+ content: 'dom not to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ol -> ul ul (across several indented li)",
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ol -> ul ul (from second indented li)",
+ content: 'dom not to edit
xxx
dom not to edit
dom to edit
dom not to edit
',
+ start: 'li:eq(2) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom not to edit
dom not to edit
',
+ start: 'p:eq(3):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ // Conversion from Checklist
+ {
+ name: "Click UL: ul.o_checklist -> ul",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul.o_checklist -> ul (across li's)",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul.o_checklist -> ul (from second li)",
+ content: 'dom not to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ul.o_checklist -> ul ul (from indented li)",
+ content: 'dom not to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ul.o_checklist -> ul ul (across several indented li)",
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click UL: ul ul.o_checklist -> ul ul (from second indented li)",
+ content: 'dom not to edit
xxx
dom not to edit
dom to edit
dom not to edit
',
+ start: 'li:eq(2) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnUL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(3):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
];
_.each(ulTests, function (test) {
@@ -1294,7 +1464,7 @@ QUnit.test('Unordered list', function (assert) {
QUnit.test('Ordered list', function (assert) {
var done = assert.async();
- assert.expect(32);
+ assert.expect(56);
return weTestUtils.createWysiwyg({
debug: false,
@@ -1725,6 +1895,176 @@ QUnit.test('Ordered list', function (assert) {
start: 'font:contents(0)->11',
},
},
+ // Conversion from UL
+ {
+ name: "Click OL: ul -> ol",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul -> ol (across li's)",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul -> ol (from second li)",
+ content: 'dom not to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ol ul -> ol ol (from indented li)",
+ content: 'dom not to edit
xxx
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ol ul -> ol ol (across several indented li)",
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ol ul -> ol ol (from second indented li)",
+ content: 'dom not to edit
xxx
dom not to edit
dom to edit
dom not to edit
',
+ start: 'li:eq(2) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit
',
+ start: 'p:eq(3):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ // Conversion from Checklist
+ {
+ name: "Click OL: ul.o_checklist -> ol",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(1):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul.o_checklist -> ol (across li's)",
+ content: 'dom not to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
dom to edit
',
+ start: 'p:eq(1):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul.o_checklist -> ol (from second li)",
+ content: 'dom not to edit
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
dom to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ol ul.o_checklist -> ol ol (from indented li)",
+ content: 'dom not to edit
xxx
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(1) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(2):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul ul.o_checklist -> ul ol (across several indented li)",
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'li:eq(1) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
xxx
dom to edit 1
dom to edit 2
',
+ start: 'p:eq(2):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
+ {
+ name: "Click OL: ul ul.o_checklist -> ul ol (from second indented li)",
+ content: 'dom not to edit
xxx
dom not to edit
dom to edit
dom not to edit
',
+ start: 'li:eq(2) p:contents()[0]->1',
+ end: 'li:eq(2) p:contents()[0]->5',
+ do: function () {
+ $btnOL.mousedown().click();
+ },
+ test: {
+ content: 'dom not to edit
',
+ start: 'p:eq(3):contents()[0]->1',
+ end: 'p:eq(3):contents()[0]->5',
+ },
+ },
];
_.each(olTests, function (test) {