summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/static/tests/mass_mailing_html_tests.js
diff options
context:
space:
mode:
authorGorash <chm@odoo.com>2019-08-13 14:18:41 +0000
committerDavid Monjoie <dmo@odoo.com>2019-08-21 19:11:31 +0000
commit1eb1c2b029c7216c70becbf4cd0d9e6535deea96 (patch)
treefa58b034e569278d605e6363fb471e0b2e44d2b4 /addons/mass_mailing/static/tests/mass_mailing_html_tests.js
parent912996fe902c41cafa12dcfe09713ce9857f95ab (diff)
[REF] web_editor: adapt wysiwyg tests to older summernote version
These modifications crystalize the behavior of the old editor, even if it makes less sense than the behavior of the saas-12.2 one. In some cases, the only reasonable adaptation we could do for 13.0 was to delete the tests, as these tests relied on mechanisms of the newer version of summernote introduced in saas-12.2 which cannot be easily replicated in the older version from 12.0 that we are reintroducing in this PR. It is sad to see these tests go, but we knew this was going to be something we would lose in reverting back to the older editor. That being said, since these tests were not present back in 12.0, we are simply back to the 12.0 state of things, not worse. Don't weep for them though, they will be back in Odoo 14. Part of PR 35677. Co-authored-by: Nicolas Bayet <nby@odoo.com> Co-authored-by: Antoine Guenet <age@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com>
Diffstat (limited to 'addons/mass_mailing/static/tests/mass_mailing_html_tests.js')
-rw-r--r--addons/mass_mailing/static/tests/mass_mailing_html_tests.js88
1 files changed, 1 insertions, 87 deletions
diff --git a/addons/mass_mailing/static/tests/mass_mailing_html_tests.js b/addons/mass_mailing/static/tests/mass_mailing_html_tests.js
index ee5b45c1b0d..e039fa14c86 100644
--- a/addons/mass_mailing/static/tests/mass_mailing_html_tests.js
+++ b/addons/mass_mailing/static/tests/mass_mailing_html_tests.js
@@ -64,7 +64,7 @@ QUnit.module('field html', {
}, function () {
QUnit.test('save arch and html', async function (assert) {
- assert.expect(6);
+ assert.expect(4);
var form = await testUtils.createView({
View: FormView,
@@ -85,19 +85,6 @@ QUnit.test('save arch and html', async function (assert) {
' />'+
'</form>',
res_id: 1,
- mockRPC: function (route, args) {
- if (args.method === "write") {
- var values = args.args[1];
- assert.strictEqual(values.body_html,
- '<div class="field_body" style="background-color:red;"><p>c<b>od</b>e to edit</p></div>',
- "should save the content");
- assert.strictEqual(values.body_arch,
- '<div class="field_body"><p>c<b>od</b>e to edit</p></div>',
- "should save the content");
-
- }
- return this._super.apply(this, arguments);
- },
});
var $fieldReadonly = form.$('.oe_form_field[name="body_html"]');
var $fieldEdit = form.$('.oe_form_field[name="body_arch"]');
@@ -113,79 +100,6 @@ QUnit.test('save arch and html', async function (assert) {
assert.strictEqual($fieldReadonly.css('display'), 'none', "should hide the readonly mode");
assert.strictEqual($fieldEdit.css('display'), 'block', "should display the edit mode");
- var $iframe = $fieldEdit.find('iframe');
- await testUtils.nextTick();
- await $iframe.data('loadDef');
- await testUtils.nextTick();
- var doc = $iframe.contents()[0];
- var $content = $('#iframe_target', doc);
-
- // select the text
- var pText = $content.find('.note-editable p').first().contents()[0];
- Wysiwyg.setRange(pText, 1, pText, 3);
- // text is selected
- await testUtils.nextTick();
-
- await testUtils.dom.triggerEvents($content.find('.note-toolbar .note-font .note-btn-bold'),['mousedown','click']);
-
- await testUtils.dom.click(form.$buttons.find('.o_form_button_save'));
-
- form.destroy();
-});
-
-QUnit.test('save and edit arch wysiwyg', async function (assert) {
- assert.expect(4);
-
- testUtils.mock.patch(FieldHtml, {
- commitChanges: function () {
- assert.step("FieldHtml");
- return this._super.apply(this, arguments);
- },
- });
-
- testUtils.mock.patch(MassMailingFieldHtml, {
- commitChanges: function () {
- assert.step("MassMailingFieldHtml");
- return this._super.apply(this, arguments);
- },
- });
-
- var form = await testUtils.createView({
- View: FormView,
- model: 'mailing.mailing',
- data: this.data,
- arch: '<form>' +
- ' <header style="min-height:31px;">' +
- ' <button name="action_put_in_queue" type="object" class="oe_highlight" string="Send Now"/>' +
- ' </header>' +
- ' <field name="body_arch" class="oe_edit_only" widget="mass_mailing_html"' +
- ' options="{' +
- ' \'snippets\': \'template.assets\',' +
- ' \'cssEdit\': \'template.assets\',' +
- ' \'inline-field\': \'body_html\'' +
- ' }"' +
- ' />' +
- '</form>',
- res_id: 1,
- intercepts: {
- execute_action: function (event) {
- event.data.on_success();
- },
- },
- });
-
- await testUtils.dom.click($('[name=action_put_in_queue]'));
- await testUtils.form.clickEdit(form);
- var $fieldEdit = form.$('.oe_form_field[name="body_arch"]');
- var $iframe = $fieldEdit.find('iframe');
-
- await $iframe.data('loadDef');
- await testUtils.nextTick();
- await testUtils.dom.click($('[name=action_put_in_queue]'));
- assert.verifySteps(["MassMailingFieldHtml", "FieldHtml", "MassMailingFieldHtml"]);
-
- testUtils.mock.unpatch(FieldHtml);
- testUtils.mock.unpatch(MassMailingFieldHtml);
form.destroy();
});