summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/html_editor.test.js
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2019-01-25 15:02:14 +0000
committerRomain Derie <rde@odoo.com>2019-01-29 16:06:23 +0000
commit751ea9634a690bb1642be6d66d4124d6311766c7 (patch)
tree1f534a852f053e3b7c475253bb2d5ca06b9be9a1 /addons/website/static/src/js/html_editor.test.js
parent6bd579bd6b501d316761bfc50ba8bf168f776d9f (diff)
[IMP] website: add tests for scss edition on html editor
As this behavior was recently broken (fixed in #30403), this commit adds a test tour for that flow. task-1934279 Fix #30447
Diffstat (limited to 'addons/website/static/src/js/html_editor.test.js')
-rw-r--r--addons/website/static/src/js/html_editor.test.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/addons/website/static/src/js/html_editor.test.js b/addons/website/static/src/js/html_editor.test.js
index cfbcd896bde..a57e7d4ea22 100644
--- a/addons/website/static/src/js/html_editor.test.js
+++ b/addons/website/static/src/js/html_editor.test.js
@@ -72,4 +72,71 @@ tour.register('html_editor_multiple_templates', {
},
]
);
+
+tour.register('test_html_editor_scss', {
+ test: true,
+ url: '/aboutus',
+ wait_for: base.ready(),
+},
+ [
+ // 1. Open Html Editor and select a scss file
+ {
+ content: "open customize menu",
+ extra_trigger: '#wrap:visible', // ensure state for later
+ trigger: '#customize-menu > a',
+ },
+ {
+ content: "open html editor",
+ trigger: '#html_editor',
+ },
+ {
+ content: "open type switcher",
+ trigger: '.o_ace_type_switcher button',
+ },
+ {
+ content: "select scss files",
+ trigger: '.o_ace_type_switcher_choice[data-type="scss"]',
+ },
+ {
+ content: "select 'website.ui.scss'",
+ trigger: '#ace-scss-list',
+ run: function () {
+ var scssId = $('#ace-scss-list option:contains("website.ui")').val();
+ $('#ace-scss-list').val(scssId).trigger('change');
+ },
+ },
+ // 2. Edit that file and ensure it was saved then reset it
+ {
+ content: "add some scss content in the file",
+ trigger: 'div.ace_line .ace_variable:contains("body.o_connected_user")',
+ run: function () {
+ ace.edit('ace-view-editor').getSession().insert({row: 2, column: 0}, '#wrap {display: none;}\n');
+ },
+ },
+ {
+ content: "save the html editor",
+ extra_trigger: 'div.ace_line:contains("#wrap {display: none;}")',
+ trigger: ".o_ace_view_editor button[data-action=save]",
+ },
+ {
+ content: "check that the scss modification got applied",
+ trigger: 'body:has(#wrap:hidden)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "reset view (after reload, html editor should have been reopened where it was)",
+ trigger: '#ace-view-id button[data-action="reset"]',
+ },
+ {
+ content: "confirm reset warning",
+ trigger: '.modal-footer .btn-primary',
+ },
+ {
+ content: "check that the scss file was reset correctly, wrap content should now be visible again",
+ trigger: '#wrap:visible',
+ run: function () {}, // it's a check
+ },
+ ]
+);
+
});