From ddb8fc1f628433e40ae3196115f7b9a11e5b5254 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 29 Apr 2019 15:15:35 +0000 Subject: [FIX] web: checkbox in favorites menu: don't close on click Following f4fbaf1efae11e8bd3b1a2938ab765d391764a1b which changes the label/checkbox structure into: ```
``` So, before this commit, there may have been multiple input with the same Id. The consequence is that, when clicking on a label, the browser would take the first Id it found which was erroneous, because all checkboxes in Favorites menu had the same Id In reality, the use case goes as: - open a x2m, - search more - Favorites > Save current search > click on one the two checkboxes > The dropdown closed, without checking the box After this commit, when clicking on the checkbox in the favorites menu the checkbox is toggled and the dropdown stays. Also, the checkboxed have now unique ids OPW 1974587 closes odoo/odoo#33032 Signed-off-by: Lucas Perais (lpe) --- addons/board/static/tests/dashboard_tests.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'addons/board/static/tests/dashboard_tests.js') diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 588690463e9..52815921499 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -5,6 +5,7 @@ var BoardView = require('board.BoardView'); var ListController = require('web.ListController'); var testUtils = require('web.test_utils'); +var testUtilsDom = require('web.test_utils_dom'); var ListRenderer = require('web.ListRenderer'); var pyUtils = require('web.py_utils'); @@ -740,18 +741,33 @@ QUnit.test('save two searches to dashboard', function (assert) { $('.o_searchview_extended_prop_value .o_input').val('a') $('.o_apply_filter').click(); // Add it to dashboard - $('.o_add_to_dashboard_button').click(); + testUtilsDom.click($('.o_search_options button:contains(Favorites)')); + $('.o_search_options .dropdown-menu.o_favorites_menu').one('click', function (ev) { + // This handler is on the webClient + // But since the test suite doesn't have one + // We manually set it here + ev.stopPropagation(); + }); + testUtilsDom.click($('.o_search_options .o_add_to_dashboard_link')); + testUtilsDom.click($('.o_add_to_dashboard_button')); // Remove it $('.o_facet_remove').click(); // Add the second filter $('span.fa-filter').click(); - $('span.fa-filter').click(); $('.o_add_custom_filter:visible').click(); $('.o_searchview_extended_prop_value .o_input').val('b') $('.o_apply_filter').click(); // Add it to dashboard - $('.o_add_to_dashboard_button').click(); + testUtilsDom.click($('.o_search_options button:contains(Favorites)')); + $('.o_search_options .dropdown-menu.o_favorites_menu').one('click', function (ev) { + // This handler is on the webClient + // But since the test suite doesn't have one + // We manually set it here + ev.stopPropagation(); + }); + testUtilsDom.click($('.o_search_options .o_add_to_dashboard_link')); + testUtilsDom.click($('.o_add_to_dashboard_button')); actionManager.destroy(); }); -- cgit v1.2.3