diff options
| author | fja-odoo <fja@odoo.com> | 2019-10-21 13:27:16 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-11-18 09:56:40 +0000 |
| commit | 22c5fc5dd2fcc7e37f103876a219727122d23293 (patch) | |
| tree | 7fb91b5832971643e8b97974574ec34a66dfdacd /addons/web_editor/static/tests/field_html_tests.js | |
| parent | 2006959761a0fb584f3dcfc45c7cac1aebd12430 (diff) | |
[IMP] web_editor, website: generalize colorpicker
Currently we have:
- a colorpicker for background color of snippets
- a colorpicker for foreground and background text (topbar)
- a colorpicker for menu/footer/navbar/etc
These 3 are separate colorpickers with different options.
After this Commit
All 3 will use the same color palette wich allow you to select
theme color, common colors, custom color and transparent filter.
Part of https://github.com/odoo/odoo/pull/38959
maintask-2066614
task-2087383
Diffstat (limited to 'addons/web_editor/static/tests/field_html_tests.js')
| -rw-r--r-- | addons/web_editor/static/tests/field_html_tests.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index 9a19beac4f6..612277bcd08 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -150,12 +150,20 @@ QUnit.module('web_editor', {}, function () { assert.strictEqual(range.sc, pText, "should select the text"); - 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'); assert.ok($field.find('.note-back-color-preview').hasClass('show'), "should display the color picker"); - await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button[data-value="#00FFFF"]')); + await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button[style="background-color:#00FFFF;"]')); assert.ok(!$field.find('.note-back-color-preview').hasClass('show'), "should close the color picker"); @@ -180,8 +188,8 @@ QUnit.module('web_editor', {}, function () { Wysiwyg.setRange(fontContent, 5, pText, 2); // text is selected - await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button:first')); - await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button[data-value="bg-gamma"]')); + await openColorpicker('.note-toolbar .note-back-color-preview'); + await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button.bg-gamma')); assert.strictEqual($field.find('.note-editable').html(), '<p>t<font style="background-color: rgb(0, 255, 255);">oto t</font><font style="" class="bg-gamma">oto </font><font class="bg-gamma" style="">to</font>to</p><p>tata</p>', @@ -329,7 +337,7 @@ QUnit.module('web_editor', {}, function () { // text is selected await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button:first')); - await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button[data-value="bg-gamma"]')); + await testUtils.dom.click($field.find('.note-toolbar .note-back-color-preview button.bg-gamma')); await testUtils.form.clickSave(form); |
