From 2c966909e2c0b5e45912a6ff85577f0b19a5f4c9 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 5 Jul 2018 13:17:59 +0200 Subject: [FIX] *: fix some side-effects of https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548 - JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems. --- addons/web/static/tests/fields/basic_fields_tests.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index d95d34431b3..98775ebab3c 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1880,7 +1880,7 @@ QUnit.module('basic_fields', { // Actual flow: click on an element of the m2m to get its form view form.$('tbody td:contains(gold)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, 'The modal should have opened'); assert.verifySteps([ "The view's image should have been fetched", @@ -2608,7 +2608,7 @@ QUnit.module('basic_fields', { // switch to form view form.$('.o_field_widget[name=p] .o_data_row').click(); - assert.strictEqual($('[role="dialog"] .o_field_date[name=datetime]').text(), '02/07/2017', + assert.strictEqual($('.modal .o_field_date[name=datetime]').text(), '02/07/2017', 'the datetime (date widget) should be correctly displayed in form view'); form.destroy(); @@ -2652,7 +2652,7 @@ QUnit.module('basic_fields', { // switch to form view form.$('.o_field_widget[name=p] .o_data_row').click(); - assert.strictEqual($('[role="dialog"] .o_field_date[name=datetime]').text(), '02/08/2017', + assert.strictEqual($('.modal .o_field_date[name=datetime]').text(), '02/08/2017', 'the datetime (date widget) should be correctly displayed in form view'); form.destroy(); @@ -4640,13 +4640,13 @@ QUnit.module('basic_fields', { // open the selection form.$(".o_domain_show_selection_button").click(); - assert.strictEqual($('[role="dialog"] .o_list_view .o_data_row').length, 2, + assert.strictEqual($('.modal .o_list_view .o_data_row').length, 2, "should have open a list view with 2 records in a dialog"); // click on a record -> should not open the record // we don't actually check that it doesn't open the record because even // if it tries to, it will crash as we don't define an arch in this test - $('[role="dialog"] .o_list_view .o_data_row:first .o_data_cell').click(); + $('.modal .o_list_view .o_data_row:first .o_data_cell').click(); form.destroy(); }); -- cgit v1.2.3