summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/tests/web_editor_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
committerChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
commitbf51fe55a149fb642a410f579dc4b6dcbd794eac (patch)
treef4f208f06094bcef6541fd1fc034e0265de4ad21 /addons/web_editor/static/tests/web_editor_tests.js
parentbf32940142beb879211b7034bb77a7845c9d0555 (diff)
parent0f2b2c4e2b99df8d68456016a4bea86e26c1c80e (diff)
[MERGE] forward port branch saas-16 up to 0f2b2c4e2b9
Diffstat (limited to 'addons/web_editor/static/tests/web_editor_tests.js')
-rw-r--r--addons/web_editor/static/tests/web_editor_tests.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/addons/web_editor/static/tests/web_editor_tests.js b/addons/web_editor/static/tests/web_editor_tests.js
index a053ad99043..283931e9b0d 100644
--- a/addons/web_editor/static/tests/web_editor_tests.js
+++ b/addons/web_editor/static/tests/web_editor_tests.js
@@ -3,6 +3,9 @@ odoo.define('web_editor.web_editor_tests', function (require) {
var FormView = require('web.FormView');
var testUtils = require('web.test_utils');
+var core = require('web.core');
+
+var _t = core._t;
QUnit.module('web_editor', {
beforeEach: function() {
@@ -87,6 +90,43 @@ QUnit.test('field html widget (with options inline-style)', function (assert) {
}, 0);
});
+QUnit.test('field html translatable', function (assert) {
+ assert.expect(3);
+
+ var multiLang = _t.database.multi_lang;
+ _t.database.multi_lang = true;
+
+ this.data['mass.mailing'].fields.body.translate = true;
+
+ var form = testUtils.createView({
+ View: FormView,
+ model: 'mass.mailing',
+ data: this.data,
+ arch: '<form string="Partners">' +
+ '<field name="body" widget="html"/>' +
+ '</form>',
+ res_id: 1,
+ mockRPC: function (route, args) {
+ if (route === '/web/dataset/call_button' && args.method === 'translate_fields') {
+ assert.deepEqual(args.args, ['mass.mailing',1,'body',{}], "should call 'call_button' route");
+ return $.when();
+ }
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ assert.strictEqual(form.$('.oe_form_field_html_text .o_field_translate').length, 0,
+ "should not have a translate button in readonly mode");
+
+ form.$buttons.find('.o_form_button_edit').click();
+ var $button = form.$('.oe_form_field_html_text .o_field_translate');
+ assert.strictEqual($button.length, 1, "should have a translate button");
+ $button.click();
+
+ form.destroy();
+ _t.database.multi_lang = multiLang;
+});
+
QUnit.test('field html_frame widget', function (assert) {
assert.expect(6);