From 2d2f8e65621d3b8a4e2e70f925bfe75735925c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Thu, 22 Oct 2020 14:35:31 +0000 Subject: [PATCH] [FIX] web_editor: adapt iframe Qunit test to new editor - iframe editor Qunit test closes odoo/odoo#60551 Signed-off-by: David Monjoie (dmo) --- .../static/tests/field_html_tests.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index 9daab308a51..5988c1b1846 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -430,9 +430,8 @@ QUnit.module('web_editor', {}, function () { QUnit.module('cssReadonly'); - // TODO : need to be checked and fixed to pass with new JW editor - QUnit.skip('rendering with iframe for readonly mode', async function (assert) { - assert.expect(3); + QUnit.test('rendering with iframe for readonly mode', async function (assert) { + assert.expect(2); var form = await testUtils.createView({ View: FormView, @@ -444,18 +443,12 @@ QUnit.module('web_editor', {}, function () { res_id: 1, }); var $field = form.$('.oe_form_field[name="body"]'); - var $iframe = $field.find('iframe.o_readonly'); - await $iframe.data('loadDef'); - var doc = $iframe.contents()[0]; - assert.strictEqual($(doc).find('#iframe_target').html(), - '

toto toto toto

tata

', - "should have rendered a div with correct content in readonly"); - - assert.strictEqual(doc.defaultView.getComputedStyle(doc.body).backgroundColor, - 'rgb(255, 0, 0)', - "should load the asset css"); + assert.strictEqual($field[0].shadowRoot.innerHTML, + '

toto toto toto

tata

', + "should have rendered a div with correct content in readonly and should load the asset css"); await testUtils.form.clickEdit(form); + await testUtils.nextTick(); $field = form.$('.oe_form_field[name="body"]'); assert.strictEqual($field.find('.note-editable').html(),