diff --git a/addons/web_editor/static/tests/web_editor_tests.js b/addons/web_editor/static/tests/web_editor_tests.js
index 8d80ad2a73a..6a18566af2b 100644
--- a/addons/web_editor/static/tests/web_editor_tests.js
+++ b/addons/web_editor/static/tests/web_editor_tests.js
@@ -15,7 +15,7 @@ QUnit.module('web_editor', {
records: [{
id: 1,
display_name: "first record",
- body: "
yep
"
+ body: "
yep
",
}],
onchanges: {},
},
@@ -24,6 +24,70 @@ QUnit.module('web_editor', {
});
QUnit.test('field html widget', function (assert) {
+ var done = assert.async();
+ assert.expect(3);
+
+ var form = testUtils.createView({
+ View: FormView,
+ model: 'mass.mailing',
+ data: this.data,
+ arch: '
',
+ res_id: 1,
+ });
+
+ assert.strictEqual(form.$('.field_body').text(), 'yep',
+ "should have rendered a div with correct content in readonly");
+ assert.strictEqual(form.$('div[name=body]').attr('style'), 'height: 100px',
+ "should have applied the style correctly");
+
+ form.$buttons.find('.o_form_button_edit').click();
+
+ assert.strictEqual(form.$('.note-editable').html(), '
yep
',
+ "should have rendered the field correctly in edit");
+
+ // summernote invokes handlers after a setTimeout, so we must wait as well
+ // before destroying the widget (otherwise we'll have a crash later on)
+ setTimeout(function () {
+ form.destroy();
+ done();
+ }, 0);
+});
+
+QUnit.test('field html widget (with options inline-style)', function (assert) {
+ var done = assert.async();
+ assert.expect(3);
+
+ var form = testUtils.createView({
+ View: FormView,
+ model: 'mass.mailing',
+ data: this.data,
+ arch: '
',
+ res_id: 1,
+ });
+
+ assert.strictEqual(form.$('iframe').length, 1,
+ "should have rendered an iframe without crashing in readonly");
+ assert.strictEqual(form.$('div[name=body]').attr('style'), 'height: 100px',
+ "should have applied the style correctly");
+
+ form.$buttons.find('.o_form_button_edit').click();
+
+ assert.strictEqual(form.$('.note-editable').html(), '
yep
',
+ "should have rendered the field correctly in edit");
+
+ // summernote invokes handlers after a setTimeout, so we must wait as well
+ // before destroying the widget (otherwise we'll have a crash later on)
+ setTimeout(function () {
+ form.destroy();
+ done();
+ }, 0);
+});
+
+QUnit.test('field html_frame widget', function (assert) {
assert.expect(6);
var form = testUtils.createView({