summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/tests
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-08-10 17:01:05 +0200
committerChristophe Simonis <chs@odoo.com>2017-08-10 17:01:05 +0200
commit48b2ce60ed12b9b0f3aaa0322465504798bd154e (patch)
tree0ac2c53a78f678ad4701943eb9eab6a4c8f5ff48 /addons/web_editor/static/tests
parent298eaca4d1e268c43185e9c1dd6d6973e02d9b57 (diff)
parent85571bb78c9acc4e867cc3b480be9236a756fc22 (diff)
[MERGE] forward port branch saas-16 up to 85571bb78c9
Diffstat (limited to 'addons/web_editor/static/tests')
-rw-r--r--addons/web_editor/static/tests/web_editor_tests.js30
1 files changed, 30 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 283931e9b0d..41ada113cba 100644
--- a/addons/web_editor/static/tests/web_editor_tests.js
+++ b/addons/web_editor/static/tests/web_editor_tests.js
@@ -188,4 +188,34 @@ QUnit.test('field htmlsimple does not crash when commitChanges is called in mode
form.destroy();
});
+QUnit.test('html_frame does not crash when saving in readonly', function (assert) {
+ // The 'Save' action may be triggered even in readonly (e.g. when clicking
+ // on a button in the form view)
+ assert.expect(0);
+
+ var form = testUtils.createView({
+ View: FormView,
+ model: 'mass.mailing',
+ data: this.data,
+ arch: '<form string="Partners">' +
+ '<sheet>' +
+ '<field name="body" widget="html_frame" options="{\'editor_url\': \'/test\'}"/>' +
+ '</sheet>' +
+ '</form>',
+ res_id: 1,
+ mockRPC: function (route) {
+ if (_.str.startsWith(route, '/test')) {
+ // manually call the callback to simulate that the iframe has
+ // been correctly loaded
+ window.odoo[$.deparam(route).callback + '_content'].call();
+ return $.when();
+ }
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ form.saveRecord(); // before the fix done in this commit, it crashed here
+ form.destroy();
+});
+
});