summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/tests/field_html_tests.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-05-28 10:04:27 +0000
committerqsm-odoo <qsm@odoo.com>2020-05-31 13:36:45 +0000
commit3d20d36bad8b4bb9f71e5e4df576b144d19778c9 (patch)
treecbee6baea856a984902d477b5daf4cd8bb480d0f /addons/web_editor/static/tests/field_html_tests.js
parent43557ecbc7db6477defa14cd248a297eaa975c86 (diff)
[FIX] web_editor: make a test more robust
Don't know how this test worked before but it will stop working with next updates. This just make it more robust using the same trick as other tests: wait for the colorpicker to be opened before actually using it. Part of https://github.com/odoo/odoo/pull/52211 Related to task-2197038
Diffstat (limited to 'addons/web_editor/static/tests/field_html_tests.js')
-rw-r--r--addons/web_editor/static/tests/field_html_tests.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js
index 7e49f7fce01..ea20cdc5623 100644
--- a/addons/web_editor/static/tests/field_html_tests.js
+++ b/addons/web_editor/static/tests/field_html_tests.js
@@ -376,7 +376,16 @@ QUnit.module('web_editor', {}, function () {
Wysiwyg.setRange(pText, 1, pText, 10);
// text is selected
- await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button:first'));
+ async function openColorpicker(selector) {
+ const $colorpicker = $field.find(selector);
+ const openingProm = new Promise(resolve => {
+ $colorpicker.one('shown.bs.dropdown', () => resolve());
+ });
+ await testUtils.dom.click($colorpicker.find('button:first'));
+ return openingProm;
+ }
+
+ await openColorpicker('.note-toolbar .note-back-color-preview');
await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button.bg-gamma'));
await testUtils.form.clickSave(form);