diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-07-27 12:42:10 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-07-27 12:42:10 +0200 |
| commit | 2b3017974bc7cd4b3a74f83c956224cfe4e5a918 (patch) | |
| tree | ff6aab8dc6bfa7afbe9ef714ca157ebc0185d2fd /addons/web/static/tests | |
| parent | 8ed8b46f6434a2a3adea69e0134317e30bf9b936 (diff) | |
| parent | 519594e9cab9a6362ef7c3e911605e4507a0a008 (diff) | |
[MERGE] *: migrate Bootstrap 3.3.7 to 4.1.3
See sub-commits for details.
task-49280
Closes https://github.com/odoo/odoo/pull/25045
Diffstat (limited to 'addons/web/static/tests')
17 files changed, 402 insertions, 394 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 2f003c07577..f59f3b30767 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -394,12 +394,12 @@ QUnit.module('ActionManager', { data: this.data, }); actionManager.doAction(3); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); // push another action flagged with 'no_breadcrumbs=true' actionManager.doAction(4); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 0, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 0, "the breadcrumbs should be empty"); actionManager.destroy(); @@ -448,9 +448,9 @@ QUnit.module('ActionManager', { actionManager.doAction(3); actionManager.trigger_up('history_back'); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners Action 4', "breadcrumbs should display the display_name of the action"); actionManager.destroy(); @@ -718,7 +718,7 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should have rendered a form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Second record', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Second record', "should have opened the second record"); assert.verifySteps([ @@ -782,9 +782,9 @@ QUnit.module('ActionManager', { "should not have rendered a list view"); assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should have rendered a form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Second record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Second record', "breadcrumbs should contain the display_name of the opened record"); // go back to Lst @@ -843,9 +843,9 @@ QUnit.module('ActionManager', { "should not display the kanban view anymore"); assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should have switched to the form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Fourth record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Fourth record', "should have opened the requested record"); // verify steps to ensure that the whole action hasn't been re-executed @@ -881,7 +881,7 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should have rendered a form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "should have opened the first record"); // switch to record 4 @@ -893,9 +893,9 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should still display the form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Fourth record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Fourth record', "should have switched to the requested record"); // verify steps to ensure that the whole action hasn't been re-executed @@ -1019,7 +1019,7 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_client_action').text(), 'default value', "should have rendered the client action"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); // update param 'a' in the url @@ -1030,7 +1030,7 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_client_action').text(), 'new value', "should have rerendered the client action with the correct param"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should still be one controller in the breadcrumbs"); // should have executed the client action twice @@ -1069,7 +1069,7 @@ QUnit.module('ActionManager', { assert.strictEqual(actionManager.$('.o_kanban_view').length, 1, "should display a kanban view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners Action 4', "breadcrumbs should display the display_name of the action"); actionManager.loadState({ @@ -1077,7 +1077,7 @@ QUnit.module('ActionManager', { view_type: 'list', }); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners Action 4', "should still be in the same action"); assert.strictEqual(actionManager.$('.o_kanban_view').length, 0, "should no longer display a kanban view"); @@ -1207,7 +1207,7 @@ QUnit.module('ActionManager', { def.resolve(); - assert.strictEqual($('.o_control_panel .breadcrumb li.active').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item.active').text(), 'Partners Action 4', 'action 4 should be loaded'); actionManager.destroy(); @@ -1242,13 +1242,13 @@ QUnit.module('ActionManager', { // click on the breadcrumbs for the form view, then on the kanban view // before the form view is fully reloaded - $('.o_control_panel .breadcrumb li:eq(1)').click(); - $('.o_control_panel .breadcrumb li:eq(0)').click(); + $('.o_control_panel .breadcrumb-item:eq(1)').click(); + $('.o_control_panel .breadcrumb-item:eq(0)').click(); // resolve the form view read def.resolve(); - assert.strictEqual($('.o_control_panel .breadcrumb li.active').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item.active').text(), 'Partners Action 4', 'action 4 should be loaded and visible'); actionManager.destroy(); @@ -1500,7 +1500,7 @@ QUnit.module('ActionManager', { "should display the kanban view of action 4"); assert.strictEqual(actionManager.$('.o_list_view').length, 0, "should not display the list view of action 3"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); assert.verifySteps([ @@ -1547,7 +1547,7 @@ QUnit.module('ActionManager', { "should display the kanban view of action 4"); assert.strictEqual(actionManager.$('.o_list_view').length, 0, "should not display the list view of action 3"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); assert.verifySteps([ @@ -1670,9 +1670,9 @@ QUnit.module('ActionManager', { assert.strictEqual($('.o_control_panel:visible').length, 1, "should have rendered a control panel"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Hello', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Hello', "breadcrumbs should still display the title of the controller"); assert.strictEqual(actionManager.$('.o_client_action_test').text(), 'Hello World', "should have correctly rendered the client action"); @@ -2053,37 +2053,37 @@ QUnit.module('ActionManager', { }); actionManager.doAction(3); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners', "breadcrumbs should display the display_name of the action"); // switch to kanban view $('.o_control_panel .o_cp_switch_kanban').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should still be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners', "breadcrumbs should still display the display_name of the action"); // switch back to list view $('.o_control_panel .o_cp_switch_list').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should still be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners', "breadcrumbs should still display the display_name of the action"); // open a record in form view actionManager.$('.o_list_view .o_data_row:first').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "breadcrumbs should contain the display_name of the opened record"); // go back to list view using the breadcrumbs $('.o_control_panel .breadcrumb a').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li').text(), 'Partners', + assert.strictEqual($('.o_control_panel .breadcrumb-item').text(), 'Partners', "breadcrumbs should display the display_name of the action"); actionManager.destroy(); @@ -2235,14 +2235,14 @@ QUnit.module('ActionManager', { "should still display the list view"); assert.strictEqual(actionManager.$('.o_form_view').length, 0, "shouldn't display the form view yet"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should still be one controller in the breadcrumbs"); def.resolve(); assert.strictEqual(actionManager.$('.o_list_view').length, 0, "should no longer display the list view"); assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should display the form view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); // go back to list view using the breadcrumbs @@ -2252,14 +2252,14 @@ QUnit.module('ActionManager', { "should still display the form view"); assert.strictEqual(actionManager.$('.o_list_view').length, 0, "shouldn't display the list view yet"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should still be two controllers in the breadcrumbs"); def.resolve(); assert.strictEqual(actionManager.$('.o_form_view').length, 0, "should no longer display the form view"); assert.strictEqual(actionManager.$('.o_list_view').length, 1, "should display the list view"); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); actionManager.destroy(); @@ -2277,9 +2277,9 @@ QUnit.module('ActionManager', { // open a record in form view actionManager.$('.o_list_view .o_data_row:first').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "breadcrumbs should contain the display_name of the opened record"); // switch to edit mode and change the display_name @@ -2287,9 +2287,9 @@ QUnit.module('ActionManager', { actionManager.$('.o_field_widget[name=display_name]').val('New name').trigger('input'); $('.o_control_panel .o_form_button_save').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should still be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'New name', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'New name', "breadcrumbs should contain the display_name of the opened record"); actionManager.destroy(); @@ -2398,10 +2398,10 @@ QUnit.module('ActionManager', { actionManager.$('.o_list_view .o_data_row:first').click(); // click on 'Execute action' button (should execute an action) - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two parts in the breadcrumbs"); actionManager.$('.o_form_view button:contains(Execute action)').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 3, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 3, "the returned action should have been stacked over the previous one"); assert.strictEqual(actionManager.$('.o_kanban_view').length, 1, "the returned action should have been executed"); @@ -2480,7 +2480,7 @@ QUnit.module('ActionManager', { // open the first record in form view actionManager.$('.o_list_view .o_data_row:first').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "breadcrumbs should contain the display_name of the opened record"); assert.strictEqual(actionManager.$('.o_field_widget[name=foo]').text(), 'yop', "should have opened the correct record"); @@ -2490,7 +2490,7 @@ QUnit.module('ActionManager', { // open the second record in form view actionManager.$('.o_list_view .o_data_row:nth(1)').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Second record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Second record', "breadcrumbs should contain the display_name of the opened record"); assert.strictEqual(actionManager.$('.o_field_widget[name=foo]').text(), 'blip', "should have opened the correct record"); @@ -2670,20 +2670,20 @@ QUnit.module('ActionManager', { actionManager.$('input[name="foo"]').val('pinkypie').trigger('input'); // go back to kanban view - $('.o_control_panel .breadcrumb li:first a').click(); + $('.o_control_panel .breadcrumb-item:first a').click(); assert.strictEqual($('.modal .modal-body').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should display a modal dialog to confirm discard action"); // cancel - $('.modal .modal-footer button.btn-default').click(); + $('.modal .modal-footer button.btn-secondary').click(); assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should still be in form view"); // go back again to kanban view - $('.o_control_panel .breadcrumb li:first a').click(); + $('.o_control_panel .breadcrumb-item:first a').click(); // confirm discard $('.modal .modal-footer button.btn-primary').click(); @@ -2731,35 +2731,35 @@ QUnit.module('ActionManager', { // open a record in form view actionManager.$('.o_list_view .o_data_row:first').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "breadcrumbs should contain the display_name of the opened record"); // push another action on top of the first one, and come back to the form view actionManager.doAction(4); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 3, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 3, "there should be three controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Partners Action 4', "breadcrumbs should contain the name of the current action"); // go back using the breadcrumbs $('.o_control_panel .breadcrumb a:nth(1)').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 2, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 2, "there should be two controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'First record', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'First record', "breadcrumbs should contain the display_name of the opened record"); // push again the other action on top of the first one, and come back to the list view actionManager.doAction(4); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 3, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 3, "there should be three controllers in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Partners Action 4', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Partners Action 4', "breadcrumbs should contain the name of the current action"); // go back using the breadcrumbs $('.o_control_panel .breadcrumb a:first').click(); - assert.strictEqual($('.o_control_panel .breadcrumb li').length, 1, + assert.strictEqual($('.o_control_panel .breadcrumb-item').length, 1, "there should be one controller in the breadcrumbs"); - assert.strictEqual($('.o_control_panel .breadcrumb li:last').text(), 'Partners', + assert.strictEqual($('.o_control_panel .breadcrumb-item:last').text(), 'Partners', "breadcrumbs should contain the name of the current action"); actionManager.destroy(); diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index e23483b4276..443fb194d87 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -233,12 +233,12 @@ QUnit.module('basic_fields', { "checkbox should now be unchecked"); // check the checkbox by clicking on label - form.$('label').click(); + form.$('label:first').click(); assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1, "checkbox should now be checked"); // uncheck it back - form.$('label').click(); + form.$('label:first').click(); assert.strictEqual(form.$('.o_field_boolean input:checked').length, 0, "checkbox should now be unchecked"); @@ -273,52 +273,52 @@ QUnit.module('basic_fields', { arch: '<tree editable="bottom"><field name="bar"/></tree>', }); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input').length, 5, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input').length, 5, "should have 5 checkboxes"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input:checked').length, 4, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input:checked').length, 4, "should have 4 checked input"); // Edit a line - var $cell = list.$('tr.o_data_row:has(.o_checkbox input:checked) td:not(.o_list_record_selector)').first(); - assert.ok($cell.find('.o_checkbox input:checked').prop('disabled'), + var $cell = list.$('tr.o_data_row:has(.custom-checkbox input:checked) td:not(.o_list_record_selector)').first(); + assert.ok($cell.find('.custom-checkbox input:checked').prop('disabled'), "input should be disabled in readonly mode"); $cell.click(); - assert.ok(!$cell.find('.o_checkbox input:checked').prop('disabled'), + assert.ok(!$cell.find('.custom-checkbox input:checked').prop('disabled'), "input should not have the disabled property in edit mode"); - $cell.find('.o_checkbox input:checked').click(); + $cell.find('.custom-checkbox input:checked').click(); // save list.$buttons.find('.o_list_button_save').click(); - $cell = list.$('tr.o_data_row:has(.o_checkbox input:not(:checked)) td:not(.o_list_record_selector)').first(); - assert.ok($cell.find('.o_checkbox input:not(:checked)').prop('disabled'), + $cell = list.$('tr.o_data_row:has(.custom-checkbox input:not(:checked)) td:not(.o_list_record_selector)').first(); + assert.ok($cell.find('.custom-checkbox input:not(:checked)').prop('disabled'), "input should be disabled again"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input').length, 5, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input').length, 5, "should still have 5 checkboxes"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input:checked').length, 3, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input:checked').length, 3, "should now have only 3 checked input"); // Re-Edit the line and fake-check the checkbox $cell.click(); - $cell.find('.o_checkbox input').click(); // Change the checkbox - $cell.find('.o_checkbox input').click(); // Undo the change + $cell.find('.custom-checkbox input').click(); // Change the checkbox + $cell.find('.custom-checkbox input').click(); // Undo the change // Save list.$buttons.find('.o_list_button_save').click(); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input').length, 5, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input').length, 5, "should still have 5 checkboxes"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input:checked').length, 3, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input:checked').length, 3, "should still have only 3 checked input"); // Re-Edit the line to check the checkbox back but this time click on // the checkbox directly in readonly mode ! - $cell = list.$('tr.o_data_row:has(.o_checkbox input:not(:checked)) td:not(.o_list_record_selector)').first(); - $cell.find('.o_checkbox span').click(); + $cell = list.$('tr.o_data_row:has(.custom-checkbox input:not(:checked)) td:not(.o_list_record_selector)').first(); + $cell.find('.custom-checkbox .custom-control-label').click(); // save list.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input').length, 5, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input').length, 5, "should still have 5 checkboxes"); - assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .o_checkbox input:checked').length, 4, + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector) .custom-checkbox input:checked').length, 4, "should now have 4 checked input back"); list.destroy(); }); @@ -370,8 +370,8 @@ QUnit.module('basic_fields', { res_id: 2, }); - assert.strictEqual(form.$(".o_checkbox.o_boolean_toggle").length, 1, "Boolean toggle widget applied to boolean field"); - assert.strictEqual(form.$(".o_checkbox.o_boolean_toggle").find(".slider").length, 1, "Boolean toggle contains slider to toggle"); + assert.strictEqual(form.$(".custom-checkbox.o_boolean_toggle").length, 1, "Boolean toggle widget applied to boolean field"); + assert.strictEqual(form.$(".custom-checkbox.o_boolean_toggle").find(".slider").length, 1, "Boolean toggle contains slider to toggle"); form.destroy(); }); @@ -1828,7 +1828,7 @@ QUnit.module('basic_fields', { "the widget should have the correct class"); assert.strictEqual(form.$('div[name="document"] > img').length, 1, "the widget should contain an image"); - assert.ok(form.$('div[name="document"] > img').hasClass('img-responsive'), + assert.ok(form.$('div[name="document"] > img').hasClass('img-fluid'), "the image should have the correct class"); assert.strictEqual(form.$('div[name="document"] > img').attr('width'), "90", "the image should correctly set its attributes"); @@ -2430,7 +2430,7 @@ QUnit.module('basic_fields', { form.destroy(); }); - QUnit.test('datetime field in form view', function (assert) { + QUnit.test('datetime field in form view 2', function (assert) { assert.expect(1); this.data.partner.fields.datetime.default = "2017-08-02 12:00:05"; @@ -2449,8 +2449,7 @@ QUnit.module('basic_fields', { }); testUtils.patch(basicFields.FieldDate, { _setValue: function () { - throw "The time format of the language must be taken into account." - return this._super.apply(this, arguments); + throw "The time format of the language must be taken into account."; }, }); form.$buttons.find('.o_form_button_create').click(); @@ -3226,7 +3225,7 @@ QUnit.module('basic_fields', { res_id: 1, config: { device: { - size_class: config.device.SIZES.XS, + size_class: config.device.SIZES.VSM, }, }, }); @@ -3270,7 +3269,7 @@ QUnit.module('basic_fields', { arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>', config: { device: { - size_class: config.device.SIZES.XS, + size_class: config.device.SIZES.VSM, }, }, }); @@ -3326,7 +3325,7 @@ QUnit.module('basic_fields', { res_id: 1, config: { device: { - size_class: config.device.SIZES.SM, + size_class: config.device.SIZES.MD, }, }, }); @@ -3365,7 +3364,7 @@ QUnit.module('basic_fields', { arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>', config: { device: { - size_class: config.device.SIZES.SM, + size_class: config.device.SIZES.MD, }, }, }); @@ -3418,7 +3417,7 @@ QUnit.module('basic_fields', { }, config: { device: { - size_class: config.device.SIZES.XS, + size_class: config.device.SIZES.VSM, }, }, }); @@ -3699,19 +3698,19 @@ QUnit.module('basic_fields', { "should have one red status since selection is the second, blocked state"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0, "should not have one green status since selection is the second, blocked state"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear form.$('.o_field_widget.o_selection .o_status').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(form.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the first option, "Normal" - form.$('ul.dropdown-menu.state:visible li').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + form.$('.dropdown-menu.state:visible .dropdown-item').first().click(); + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should not have one red status since selection is the first, normal state"); @@ -3722,7 +3721,7 @@ QUnit.module('basic_fields', { // switch to edit mode and check the result form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should still not be a dropdown"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should still not have one red status since selection is the first, normal state"); @@ -3733,14 +3732,14 @@ QUnit.module('basic_fields', { // Click on the status button to make the dropdown appear form.$('.o_field_widget.o_selection .o_status').first().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(form.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the last option, "Done" - form.$('ul.dropdown-menu.state:visible li').last().click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + form.$('.dropdown-menu.state:visible .dropdown-item').last().click(); + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should not have one red status since selection is the third, done state"); @@ -3749,7 +3748,7 @@ QUnit.module('basic_fields', { // save form.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(form.$('.dropdown-menu.state:visible').length, 0, "there should still not be a dropdown anymore"); assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0, "should still not have one red status since selection is the third, done state"); @@ -3778,7 +3777,7 @@ QUnit.module('basic_fields', { "should have one red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear @@ -3786,20 +3785,20 @@ QUnit.module('basic_fields', { list.$('.o_state_selection_cell .o_selection > a span.o_status').first().click(); assert.ok(!$cell.parent().hasClass('o_selected_row'), 'should not be in edit mode since we clicked on the state selection widget'); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the first option, "Normal" - list.$('ul.dropdown-menu.state:visible li').first().click(); + list.$('.dropdown-menu.state:visible .dropdown-item').first().click(); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status').length, 5, "should still have five status selection widgets"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_red').length, 0, "should now have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should still have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // switch to edit mode and check the result @@ -3813,21 +3812,21 @@ QUnit.module('basic_fields', { "should now have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 1, "should still have one green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // Click on the status button to make the dropdown appear list.$('.o_state_selection_cell .o_selection > a span.o_status').first().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on another row var $firstCell = list.$('tbody td.o_state_selection_cell').first(); var $lastCell = list.$('tbody td.o_state_selection_cell').last(); $lastCell.click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.ok(!$firstCell.parent().hasClass('o_selected_row'), 'first row should not be in edit mode anymore'); @@ -3836,14 +3835,14 @@ QUnit.module('basic_fields', { // Click on the last status button to make the dropdown appear list.$('.o_state_selection_cell .o_selection > a span.o_status').last().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 1, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 1, "there should be a dropdown"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible li').length, 2, + assert.strictEqual(list.$('.dropdown-menu.state:visible .dropdown-item').length, 2, "there should be two options in the dropdown"); // Click on the last option, "Done" - list.$('ul.dropdown-menu.state:visible li').last().click(); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + list.$('.dropdown-menu.state:visible .dropdown-item').last().click(); + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown anymore"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status').length, 5, "should still have five status selection widgets"); @@ -3851,7 +3850,7 @@ QUnit.module('basic_fields', { "should still have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 2, "should now have two green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); // save @@ -3862,7 +3861,7 @@ QUnit.module('basic_fields', { "should have no red status"); assert.strictEqual(list.$('.o_state_selection_cell .o_selection > a span.o_status.o_status_green').length, 2, "should have two green status"); - assert.strictEqual(list.$('ul.dropdown-menu.state:visible').length, 0, + assert.strictEqual(list.$('.dropdown-menu.state:visible').length, 0, "there should not be a dropdown"); list.destroy(); @@ -4005,42 +4004,42 @@ QUnit.module('basic_fields', { '<sheet>' + '<group>' + '<field name="selection" widget="label_selection" ' + - ' options="{\'classes\': {\'normal\': \'default\', \'blocked\': \'warning\',\'done\': \'success\'}}"/>' + + ' options="{\'classes\': {\'normal\': \'secondary\', \'blocked\': \'warning\',\'done\': \'success\'}}"/>' + '</group>' + '</sheet>' + '</form>', res_id: 1, }); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').length, 1, "should have a warning status label since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-secondary').length, 0, "should not have a default status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-success').length, 0, "should not have a success status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the label should say 'Blocked' since this is the label value for that state"); // // switch to edit mode and check the result form.$buttons.find('.o_form_button_edit').click(); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').length, 1, "should have a warning status label since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-secondary').length, 0, "should not have a default status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-success').length, 0, "should not have a success status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the label should say 'Blocked' since this is the label value for that state"); // save form.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').length, 1, "should have a warning status label since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-secondary').length, 0, "should not have a default status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0, + assert.strictEqual(form.$('.o_field_widget.badge.badge-success').length, 0, "should not have a success status since selection is the second, blocked state"); - assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(form.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the label should say 'Blocked' since this is the label value for that state"); form.destroy(); @@ -4056,57 +4055,57 @@ QUnit.module('basic_fields', { arch: '<tree editable="bottom">' + '<field name="foo"/>' + '<field name="selection" widget="label_selection"' + - ' options="{\'classes\': {\'normal\': \'default\', \'blocked\': \'warning\',\'done\': \'success\'}}"/>' + + ' options="{\'classes\': {\'normal\': \'secondary\', \'blocked\': \'warning\',\'done\': \'success\'}}"/>' + '</tree>', }); - assert.strictEqual(list.$('.o_field_widget.label:not(:empty)').length, 3, + assert.strictEqual(list.$('.o_field_widget.badge:not(:empty)').length, 3, "should have three visible status labels"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').length, 1, "should have one warning status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the warning label should read 'Blocked'"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').length, 1, "should have one default status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').text(), 'Normal', + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').text(), 'Normal', "the default label should read 'Normal'"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').length, 1, "should have one success status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').text(), 'Done', + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').text(), 'Done', "the success label should read 'Done'"); // switch to edit mode and check the result list.$('tbody td:not(.o_list_record_selector)').first().click(); - assert.strictEqual(list.$('.o_field_widget.label:not(:empty)').length, 3, + assert.strictEqual(list.$('.o_field_widget.badge:not(:empty)').length, 3, "should have three visible status labels"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').length, 1, "should have one warning status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the warning label should read 'Blocked'"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').length, 1, "should have one default status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').text(), 'Normal', + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').text(), 'Normal', "the default label should read 'Normal'"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').length, 1, "should have one success status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').text(), 'Done', + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').text(), 'Done', "the success label should read 'Done'"); // save and check the result list.$buttons.find('.o_list_button_save').click(); - assert.strictEqual(list.$('.o_field_widget.label:not(:empty)').length, 3, + assert.strictEqual(list.$('.o_field_widget.badge:not(:empty)').length, 3, "should have three visible status labels"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').length, 1, "should have one warning status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-warning').text(), 'Blocked', + assert.strictEqual(list.$('.o_field_widget.badge.badge-warning').text(), 'Blocked', "the warning label should read 'Blocked'"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').length, 1, "should have one default status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-default').text(), 'Normal', + assert.strictEqual(list.$('.o_field_widget.badge.badge-secondary').text(), 'Normal', "the default label should read 'Normal'"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').length, 1, + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').length, 1, "should have one success status label"); - assert.strictEqual(list.$('.o_field_widget.label.label-success').text(), 'Done', + assert.strictEqual(list.$('.o_field_widget.badge.badge-success').text(), 'Done', "the success label should read 'Done'"); list.destroy(); @@ -4680,14 +4679,14 @@ QUnit.module('basic_fields', { res_id: 2, }); - assert.strictEqual(form.$('.img.img-responsive').length, 2, + assert.strictEqual(form.$('.img.img-fluid').length, 2, "Two images should be rendered"); assert.strictEqual(form.$('.img.btn-info').length, 0, "No image should be selected"); // select first image - form.$(".img.img-responsive:first").click(); - assert.ok(form.$(".img.img-responsive:first").hasClass('btn-info'), + form.$(".img.img-fluid:first").click(); + assert.ok(form.$(".img.img-fluid:first").hasClass('btn-info'), "First image should be selected"); form.destroy(); diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 2001bed1d65..0910df88766 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -429,7 +429,7 @@ QUnit.module('relational_fields', { $('button:contains(Filters)').click(); $('.o_add_custom_filter:visible').click(); // Add a custom filter, datetime field is selected - assert.strictEqual($('li.o_filter_condition select.o_searchview_extended_prop_field').val(), 'datetime', + assert.strictEqual($('.o_filter_condition select.o_searchview_extended_prop_field').val(), 'datetime', "datetime field should be selected"); $('.o_apply_filter').click(); @@ -2622,7 +2622,7 @@ QUnit.module('relational_fields', { }); // First round: add 51 records in batch - form.$buttons.find('.btn.btn-primary.btn-sm.o_form_button_edit').click(); + form.$buttons.find('.btn.btn-primary.o_form_button_edit').click(); form.$('.o_field_x2many_list_row_add a').click(); var $modal = $('.modal-lg'); @@ -2632,16 +2632,16 @@ QUnit.module('relational_fields', { $modal.find('thead input[type=checkbox]').click(); //select all the records we created in batch + 'gold' - $modal.find('.btn.btn-sm.btn-primary.o_select_button').click(); + $modal.find('.btn.btn-primary.o_select_button').click(); var m2m_records = form.$('.o_field_many2many.o_field_widget.o_field_x2many.o_field_x2many_list .o_data_cell:not(.o_many2many_tags_cell)'); assert.equal(m2m_records.length, 51, 'We should have added all the records present in the search view to the m2m field'); // the 50 in batch + 'gold' - form.$buttons.find('.btn.btn-primary.btn-sm.o_form_button_save').click(); + form.$buttons.find('.btn.btn-primary.o_form_button_save').click(); // Secound round: remove one record - form.$buttons.find('.btn.btn-primary.btn-sm.o_form_button_edit').click(); + form.$buttons.find('.btn.btn-primary.o_form_button_edit').click(); var trash_buttons = form.$('.o_field_many2many.o_field_widget.o_field_x2many.o_field_x2many_list .o_list_record_remove'); trash_buttons.first().click(); @@ -2660,7 +2660,7 @@ QUnit.module('relational_fields', { $modal.find('thead input[type=checkbox]').click(); - $modal.find('.btn.btn-sm.btn-primary.o_select_button').click(); + $modal.find('.btn.btn-primary.o_select_button').click(); pager_limit = form.$('.o_field_many2many.o_field_widget.o_field_x2many.o_field_x2many_list .o_pager_limit'); assert.equal(pager_limit.text(), '51', @@ -4048,7 +4048,7 @@ QUnit.module('relational_fields', { "there should be two records in the one2many in the dialog"); // click on 'Discard' - $('.modal-footer .btn-default').click(); + $('.modal-footer .btn-secondary').click(); assert.strictEqual($('.modal').length, 0, "dialog should be closed"); @@ -4335,7 +4335,7 @@ QUnit.module('relational_fields', { '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + - '<a t-if="!read_only_mode" type="delete" class="fa fa-times pull-right delete_icon"/>' + + '<a t-if="!read_only_mode" type="delete" class="fa fa-times float-right delete_icon"/>' + '<span><t t-esc="record.display_name.value"/></span>' + '</div>' + '</t>' + @@ -4766,7 +4766,7 @@ QUnit.module('relational_fields', { '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + - '<a t-if="!read_only_mode" type="delete" class="fa fa-times pull-right delete_icon"/>' + + '<a t-if="!read_only_mode" type="delete" class="fa fa-times float-right delete_icon"/>' + '<span><t t-esc="record.display_name.value"/></span>' + '<span><t t-esc="record.color.value"/></span>' + '</div>' + @@ -4800,8 +4800,8 @@ QUnit.module('relational_fields', { 'delete icon should be visible in edit'); assert.ok(form.$('.o_field_one2many .o-kanban-button-new').length, '"Create" button should be visible in edit'); - assert.ok(form.$('.o_field_one2many .o-kanban-button-new').hasClass('btn-default'), - "'Create' button should have className 'btn-default'"); + assert.ok(form.$('.o_field_one2many .o-kanban-button-new').hasClass('btn-secondary'), + "'Create' button should have className 'btn-secondary'"); assert.strictEqual(form.$('.o_field_one2many .o-kanban-button-new').text().trim(), "Add", 'Create button should have "Add" label'); @@ -4890,7 +4890,7 @@ QUnit.module('relational_fields', { '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + - '<a t-if="!read_only_mode" type="delete" class="fa fa-times pull-right delete_icon"/>' + + '<a t-if="!read_only_mode" type="delete" class="fa fa-times float-right delete_icon"/>' + '<span><t t-esc="record.display_name.value"/></span>' + '</div>' + '</t>' + @@ -5380,7 +5380,7 @@ QUnit.module('relational_fields', { "pager should still display the correct total"); // click on cancel - $('.modal .modal-footer .btn-default').click(); // click on cancel + $('.modal .modal-footer .btn-secondary').click(); // click on cancel assert.strictEqual(form.$('.o_cp_pager').text().trim(), '1-3 / 4', "pager should again display the correct total"); @@ -5471,7 +5471,7 @@ QUnit.module('relational_fields', { 'a confirmation model should be opened'); // click on cancel, the line should still be selected - $('.modal .modal-footer button.btn-default').click(); + $('.modal .modal-footer button.btn-secondary').click(); assert.strictEqual(form.$('tr.o_data_row.o_selected_row').length, 1, "should still have 1 selected data row"); @@ -10154,7 +10154,7 @@ QUnit.module('relational_fields', { '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + - '<a t-if="!read_only_mode" type="delete" class="fa fa-times pull-right delete_icon"/>' + + '<a t-if="!read_only_mode" type="delete" class="fa fa-times float-right delete_icon"/>' + '<span><t t-esc="record.display_name.value"/></span>' + '</div>' + '</t>' + @@ -10325,7 +10325,7 @@ QUnit.module('relational_fields', { '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + - '<a t-if="!read_only_mode" type="delete" class="fa fa-times pull-right delete_icon"/>' + + '<a t-if="!read_only_mode" type="delete" class="fa fa-times float-right delete_icon"/>' + '<span><t t-esc="record.display_name.value"/></span>' + '</div>' + '</t>' + @@ -10698,23 +10698,23 @@ QUnit.module('relational_fields', { } }); - assert.notOk(form.$('.o_checkbox input').eq(0).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(0).prop('checked'), "first checkbox should not be checked"); - assert.notOk(form.$('.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); - assert.ok(form.$('.o_checkbox input').eq(2).prop('checked'), + assert.ok(form.$('.custom-checkbox input').eq(2).prop('checked'), "third checkbox should be checked"); - form.$('.o_checkbox input:checked').click(); // Uncheck default record - form.$('.o_checkbox input').first().click(); // Check first record - form.$('.o_checkbox input').first().click(); // Uncheck first record - form.$('.o_checkbox input').first().click(); // Recheck first record + form.$('.custom-checkbox input:checked').click(); // Uncheck default record + form.$('.custom-checkbox input').first().click(); // Check first record + form.$('.custom-checkbox input').first().click(); // Uncheck first record + form.$('.custom-checkbox input').first().click(); // Recheck first record - assert.ok(form.$('.o_checkbox input').eq(0).prop('checked'), + assert.ok(form.$('.custom-checkbox input').eq(0).prop('checked'), "first checkbox should be checked"); - assert.notOk(form.$('.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); - assert.notOk(form.$('.o_checkbox input').eq(2).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(2).prop('checked'), "third checkbox should not be checked"); form.$buttons.find('.o_form_button_save').click(); @@ -10745,23 +10745,23 @@ QUnit.module('relational_fields', { } }); - assert.notOk(form.$('.o_checkbox input').eq(0).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(0).prop('checked'), "first checkbox should not be checked"); - assert.notOk(form.$('.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); - assert.ok(form.$('.o_checkbox input').eq(2).prop('checked'), + assert.ok(form.$('.custom-checkbox input').eq(2).prop('checked'), "third checkbox should be checked"); - form.$('.o_checkbox input:checked').click(); // Uncheck default record - form.$('.o_checkbox input').first().click(); // Check first record - form.$('.o_checkbox input').first().click(); // Uncheck first record - form.$('.o_checkbox input').first().click(); // Recheck first record + form.$('.custom-checkbox input:checked').click(); // Uncheck default record + form.$('.custom-checkbox input').first().click(); // Check first record + form.$('.custom-checkbox input').first().click(); // Uncheck first record + form.$('.custom-checkbox input').first().click(); // Recheck first record - assert.ok(form.$('.o_checkbox input').eq(0).prop('checked'), + assert.ok(form.$('.custom-checkbox input').eq(0).prop('checked'), "first checkbox should be checked"); - assert.notOk(form.$('.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); - assert.notOk(form.$('.o_checkbox input').eq(2).prop('checked'), + assert.notOk(form.$('.custom-checkbox input').eq(2).prop('checked'), "third checkbox should not be checked"); form.$buttons.find('.o_form_button_save').click(); @@ -11139,9 +11139,9 @@ QUnit.module('relational_fields', { var $selectedStatus = form.$('.o_statusbar_status button[data-value="4"]'); assert.ok($selectedStatus.hasClass('btn-primary') && $selectedStatus.hasClass('disabled'), "selected status should be btn-primary and disabled"); - var $clickable = form.$('.o_statusbar_status button.btn-default:not(.dropdown-toggle):not(:disabled)'); + var $clickable = form.$('.o_statusbar_status button.btn-secondary:not(.dropdown-toggle):not(:disabled)'); assert.strictEqual($clickable.length, 2, - "other status should be btn-default and not disabled"); + "other status should be btn-secondary and not disabled"); $clickable.last().click(); // (last is visually the first here (css)) var $status = form.$('.o_statusbar_status button[data-value="1"]'); assert.ok($status.hasClass("btn-primary") && $status.hasClass("disabled"), @@ -11649,10 +11649,10 @@ QUnit.module('relational_fields', { // checkbox 'Hide in Kanban' $input = form.$('.o_field_many2manytags button[data-id=13]'); // selects 'red' tag $input.click(); // opens the colorpicker dropdown - assert.ok(form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .o_checkbox'), "should have a checkbox in the colorpicker dropdown menu"); + assert.ok(form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .custom-checkbox'), "should have a checkbox in the colorpicker dropdown menu"); $input.click(); - var $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .o_checkbox input'); + var $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .custom-checkbox input'); assert.notOk($checkBox.is(':checked'), "should have unticked checkbox in colorpicker dropdown menu"); $checkBox.mousedown(); @@ -11660,7 +11660,7 @@ QUnit.module('relational_fields', { assert.equal($input.data('color'), "0", "should become transparent when toggling on checkbox"); $input.click(); - $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .o_checkbox input'); // refresh + $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .custom-checkbox input'); // refresh assert.ok($checkBox.is(':checked'), "should have a ticked checkbox in colorpicker dropdown menu after mousedown"); $checkBox.mousedown(); @@ -11668,7 +11668,7 @@ QUnit.module('relational_fields', { assert.equal($input.data('color'), "8", "should revert to old color when toggling off checkbox"); $input.click(); - $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .o_checkbox input'); // refresh + $checkBox = form.$('.o_field_many2manytags button[data-id=13] .o_colorpicker .custom-checkbox input'); // refresh assert.notOk($checkBox.is(':checked'), "should have an unticked checkbox in colorpicker dropdown menu after 2nd click"); // TODO: it would be nice to test the behaviors of the autocomplete dropdown @@ -12285,24 +12285,24 @@ QUnit.module('relational_fields', { res_id: 1, }); - assert.strictEqual(form.$('div.o_field_widget div.o_checkbox').length, 2, + assert.strictEqual(form.$('div.o_field_widget div.custom-checkbox').length, 2, "should have fetched and displayed the 2 values of the many2many"); - assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'), + assert.ok(form.$('div.o_field_widget div.custom-checkbox input').eq(0).prop('checked'), "first checkbox should be checked"); - assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('div.o_field_widget div.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); - assert.ok(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'), + assert.ok(form.$('div.o_field_widget div.custom-checkbox input').prop('disabled'), "the checkboxes should be disabled"); form.$buttons.find('.o_form_button_edit').click(); - assert.notOk(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'), + assert.notOk(form.$('div.o_field_widget div.custom-checkbox input').prop('disabled'), "the checkboxes should not be disabled"); // add a m2m value by clicking on input - form.$('div.o_field_widget div.o_checkbox input').eq(1).click(); + form.$('div.o_field_widget div.custom-checkbox input').eq(1).click(); form.$buttons.find('.o_form_button_save').click(); assert.deepEqual(this.data.partner.records[0].timmy, [12, 14], "should have added the second element to the many2many"); @@ -12311,13 +12311,13 @@ QUnit.module('relational_fields', { // remove a m2m value by clinking on label form.$buttons.find('.o_form_button_edit').click(); - form.$('div.o_field_widget div.o_checkbox + label').eq(0).click(); + form.$('div.o_field_widget div.custom-checkbox > label').eq(0).click(); form.$buttons.find('.o_form_button_save').click(); assert.deepEqual(this.data.partner.records[0].timmy, [14], "should have removed the first element to the many2many"); - assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'), + assert.notOk(form.$('div.o_field_widget div.custom-checkbox input').eq(0).prop('checked'), "first checkbox should be checked"); - assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'), + assert.ok(form.$('div.o_field_widget div.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); form.destroy(); @@ -12338,12 +12338,12 @@ QUnit.module('relational_fields', { viewOptions: {mode: 'edit'}, }); - form.$('div.o_field_widget div.o_checkbox input').eq(0).click(); - form.$('div.o_field_widget div.o_checkbox input').eq(1).click(); + form.$('div.o_field_widget div.custom-checkbox input').eq(0).click(); + form.$('div.o_field_widget div.custom-checkbox input').eq(1).click(); form.$buttons.find('.o_form_button_save').click(); - assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'), + assert.notOk(form.$('div.o_field_widget div.custom-checkbox input').eq(0).prop('checked'), "first checkbox should not be checked"); - assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'), + assert.notOk(form.$('div.o_field_widget div.custom-checkbox input').eq(1).prop('checked'), "second checkbox should not be checked"); form.destroy(); diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/fields/upgrade_fields_tests.js index 427ec7b54e3..15c32eeeaf0 100644 --- a/addons/web/static/tests/fields/upgrade_fields_tests.js +++ b/addons/web/static/tests/fields/upgrade_fields_tests.js @@ -52,10 +52,10 @@ QUnit.module('upgrade_fields', { '</form>', }); - assert.strictEqual(form.$('.o_field .label').length, 0, - "the upgrade label shouldn't be inside the field section"); - assert.strictEqual(form.$('.o_label .label').length, 1, - "the upgrade label should be inside the label section"); + assert.strictEqual(form.$('.o_field .badge').length, 0, + "the upgrade badge shouldn't be inside the field section"); + assert.strictEqual(form.$('.o_label .badge').length, 1, + "the upgrade badge should be inside the label section"); assert.strictEqual(form.$('.o_label').text(), "Bar EnterpriseCoucou", "the upgrade label should be inside the label section"); form.destroy(); diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 0aa9f7acaad..c460bf95673 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -342,7 +342,7 @@ function addMockEnvironment(widget, params) { initialConfig.device = _.clone(config.device); if ('device' in params.config) { _.extend(config.device, params.config.device); - config.device.isMobile = config.device.size_class <= config.device.SIZES.XS; + config.device.isMobile = config.device.size_class <= config.device.SIZES.VSM; } if ('debug' in params.config) { config.debug = params.config.debug; diff --git a/addons/web/static/tests/services/notification_service_tests.js b/addons/web/static/tests/services/notification_service_tests.js index feb3a600550..aff3de8cc39 100644 --- a/addons/web/static/tests/services/notification_service_tests.js +++ b/addons/web/static/tests/services/notification_service_tests.js @@ -184,7 +184,7 @@ QUnit.module('Services', { var $notification = $('body .o_notification_manager .o_notification'); assert.strictEqual($notification.eq(0).find('.o_close').length, 1, "should display the close button in notification"); assert.strictEqual(_.str.trim($notification.eq(0).html().replace(/\s+/g, ' ')), - "<a aria-label=\"Close\" class=\"fa fa-times o_close\" href=\"#\" title=\"Close\"></a> <div class=\"o_notification_title\"> <span role=\"img\" aria-label=\"Notification undefined\" class=\"o_icon fa fa-3x fa-question-circle-o\" title=\"Notification undefined\"></span> a0 </div> <div class=\"o_notification_content\">b0</div> <div class=\"o_buttons\"> <button type=\"button\" class=\"btn btn-sm btn-primary\"> <span>accept0</span> </button><button type=\"button\" class=\"btn btn-sm btn-default\"> <span>refuse0</span> </button> </div>", + "<a aria-label=\"Close\" class=\"fa fa-times o_close\" href=\"#\" title=\"Close\"></a> <div class=\"o_notification_title\"> <span role=\"img\" aria-label=\"Notification undefined\" class=\"o_icon fa fa-3x fa-question-circle-o\" title=\"Notification undefined\"></span> a0 </div> <div class=\"o_notification_content\">b0</div> <div class=\"o_buttons\"> <button type=\"button\" class=\"btn btn-primary\"> <span>accept0</span> </button><button type=\"button\" class=\"btn btn-secondary\"> <span>refuse0</span> </button> </div>", "should display notification"); $notification.find('.o_buttons button:contains(accept0)').click(); diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 9a8d0e9f043..9614350a9f8 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -193,7 +193,7 @@ QUnit.module('Views', { // filters which has no value should show with string "Undefined" and should show at the last assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last').data('value'), false, "filters having false value should be displayed at last in filter items"); - assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last > span').text(), "Undefined", "filters having false value should display 'Undefined' string"); + assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last span').text(), "Undefined", "filters having false value should display 'Undefined' string"); var $attendeesFilter = $sidebar.find('.o_calendar_filter:has(h3:contains(attendees))'); assert.ok($attendeesFilter.length, "should display 'attendees' filter"); @@ -202,9 +202,9 @@ QUnit.module('Views', { assert.strictEqual(calendar.$('.fc-event').length, 7, "should display 7 events ('event 5' counts for 2 because it spans two weeks and thus generate two fc-event elements)"); - calendar.$('.o_calendar_filter .o_checkbox input').first().click(); // Disable first filter + calendar.$('.o_calendar_filter .custom-checkbox input').first().click(); // Disable first filter assert.strictEqual(calendar.$('.fc-event').length, 4, "should now only display 4 event"); - calendar.$('.o_calendar_filter .o_checkbox input').eq(1).click(); // Disable second filter + calendar.$('.o_calendar_filter .custom-checkbox input').eq(1).click(); // Disable second filter assert.strictEqual(calendar.$('.fc-event').length, 0, "should not display any event anymore"); // test search bar in filter @@ -253,17 +253,17 @@ QUnit.module('Views', { actionManager.doAction(1); // displays month mode by default - assert.strictEqual(actionManager.controlPanel.$('.breadcrumb li').text(), + assert.strictEqual(actionManager.controlPanel.$('.breadcrumb-item').text(), 'Meetings Test (Dec 11 – 17, 2016)', "should display the current week"); // switch to day mode actionManager.controlPanel.$('.o_calendar_button_day').click(); - assert.strictEqual(actionManager.controlPanel.$('.breadcrumb li').text(), + assert.strictEqual(actionManager.controlPanel.$('.breadcrumb-item').text(), 'Meetings Test (December 12, 2016)', "should display the current day"); // switch to month mode actionManager.controlPanel.$('.o_calendar_button_month').click(); - assert.strictEqual(actionManager.controlPanel.$('.breadcrumb li').text(), + assert.strictEqual(actionManager.controlPanel.$('.breadcrumb-item').text(), 'Meetings Test (December 2016)', "should display the current month"); actionManager.destroy(); @@ -549,7 +549,7 @@ QUnit.module('Views', { // delete record $newevent.trigger('click'); - $('.modal button.btn-default:contains(Delete)').trigger('click'); + $('.modal button.btn-secondary:contains(Delete)').trigger('click'); $('.modal button.btn-primary:contains(Ok)').trigger('click'); assert.strictEqual(calendar.$('.fc-content').length, 0, "should delete the record"); @@ -798,7 +798,7 @@ QUnit.module('Views', { // delete record $newevent.trigger('click'); - $('.modal button.btn-default:contains(Delete)').trigger('click'); + $('.modal button.btn-secondary:contains(Delete)').trigger('click'); $('.modal button.btn-primary:contains(Ok)').trigger('click'); assert.strictEqual(calendar.$('.fc-content').length, 0, "should delete the record"); diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index a7463d1ef11..1c817e0bfeb 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -165,7 +165,7 @@ QUnit.module('Views', { assert.strictEqual(form.$('div.o_field_one2many table').length, 1, "should render a one2many relation"); - assert.strictEqual(form.$('tbody td:not(.o_list_record_selector) .o_checkbox input:checked').length, 1, + assert.strictEqual(form.$('tbody td:not(.o_list_record_selector) .custom-checkbox input:checked').length, 1, "1 checkboxes should be checked"); assert.strictEqual(form.get('title'), "second record", @@ -504,20 +504,20 @@ QUnit.module('Views', { }); form.$buttons.find('.o_form_button_edit').click(); - assert.ok(form.$('.o_notebook .nav li:first()').hasClass('active'), + assert.ok(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'), 'first tab should be active'); - assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'), + assert.ok(!form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'), 'first tab should be visible'); // set a value on the m2o var $dropdown = form.$('.o_field_many2one input').autocomplete('widget'); form.$('.o_field_many2one input').click(); $dropdown.find('li:first()').click(); - assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('active'), + assert.ok(!form.$('.o_notebook .nav .nav-link:first()').hasClass('active'), 'first tab should not be active'); - assert.ok(form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'), + assert.ok(form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'), 'first tab should be invisible'); - assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'), 'second tab should be active'); assert.ok(form.$('.o_notebook .tab-content .tab-pane:nth(1)').hasClass('active'), 'second page should be active'); @@ -547,9 +547,9 @@ QUnit.module('Views', { res_id: 1, }); - assert.notOk(form.$('.o_notebook .nav li:first()').is(':visible'), + assert.notOk(form.$('.o_notebook .nav .nav-item:first()').is(':visible'), 'first tab should be invisible'); - assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'), 'second tab should be active'); form.destroy(); @@ -578,9 +578,9 @@ QUnit.module('Views', { res_id: 1, }); - assert.notOk(form.$('.o_notebook .nav li:first()').hasClass('active'), + assert.notOk(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'), 'first tab should not active'); - assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'), 'second tab should be active'); form.destroy(); @@ -1077,7 +1077,7 @@ QUnit.module('Views', { return this._super.apply(this, arguments); }, }); - assert.strictEqual(form.$('button.btn.btn-sm i.fa.fa-check').length, 1, + assert.strictEqual(form.$('button.btn i.fa.fa-check').length, 1, "should contain a button with correct content"); assert.strictEqual(form.$('.o_form_statusbar button').length, 2, @@ -1122,7 +1122,7 @@ QUnit.module('Views', { '<button name="0"/>' + '<button name="1" class="btn-primary"/>' + '<button name="2" class="oe_highlight"/>' + - '<button name="3" class="btn-default"/>' + + '<button name="3" class="btn-secondary"/>' + '<button name="4" class="btn-link"/>' + '<button name="5" class="oe_link"/>' + '<button name="6" class="btn-success"/>' + @@ -1132,7 +1132,7 @@ QUnit.module('Views', { '<button name="8"/>' + '<button name="9" class="btn-primary"/>' + '<button name="10" class="oe_highlight"/>' + - '<button name="11" class="btn-default"/>' + + '<button name="11" class="btn-secondary"/>' + '<button name="12" class="btn-link"/>' + '<button name="13" class="oe_link"/>' + '<button name="14" class="btn-success"/>' + @@ -1142,37 +1142,37 @@ QUnit.module('Views', { res_id: 2, }); - assert.strictEqual(form.$('button[name="0"]').attr('class'), 'btn btn-sm btn-default', + assert.strictEqual(form.$('button[name="0"]').attr('class'), 'btn btn-secondary', "header buttons without any class should receive the correct classes"); - assert.strictEqual(form.$('button[name="1"]').attr('class'), 'btn btn-sm btn-primary', + assert.strictEqual(form.$('button[name="1"]').attr('class'), 'btn btn-primary', "header buttons with bootstrap primary class should receive the correct classes"); - assert.strictEqual(form.$('button[name="2"]').attr('class'), 'btn btn-sm btn-primary', + assert.strictEqual(form.$('button[name="2"]').attr('class'), 'btn btn-primary', "header buttons with oe_highlight class should receive the correct classes"); - assert.strictEqual(form.$('button[name="3"]').attr('class'), 'btn btn-sm btn-default', + assert.strictEqual(form.$('button[name="3"]').attr('class'), 'btn btn-secondary', "header buttons with bootstrap default class should receive the correct classes"); - assert.strictEqual(form.$('button[name="4"]').attr('class'), 'btn btn-sm btn-link', + assert.strictEqual(form.$('button[name="4"]').attr('class'), 'btn btn-link', "header buttons with bootstrap link class should receive the correct classes"); - assert.strictEqual(form.$('button[name="5"]').attr('class'), 'btn btn-sm btn-link', + assert.strictEqual(form.$('button[name="5"]').attr('class'), 'btn btn-link', "header buttons with oe_link class should receive the correct classes"); - assert.strictEqual(form.$('button[name="6"]').attr('class'), 'btn btn-sm btn-success', + assert.strictEqual(form.$('button[name="6"]').attr('class'), 'btn btn-success', "header buttons with bootstrap state class should receive the correct classes"); - assert.strictEqual(form.$('button[name="7"]').attr('class'), 'btn btn-sm o_this_is_a_button btn-default', + assert.strictEqual(form.$('button[name="7"]').attr('class'), 'btn o_this_is_a_button btn-secondary', "header buttons with custom classes should receive the correct classes"); - assert.strictEqual(form.$('button[name="8"]').attr('class'), 'btn btn-sm btn-default', + assert.strictEqual(form.$('button[name="8"]').attr('class'), 'btn btn-secondary', "sheet header buttons without any class should receive the correct classes"); - assert.strictEqual(form.$('button[name="9"]').attr('class'), 'btn btn-sm btn-primary', + assert.strictEqual(form.$('button[name="9"]').attr('class'), 'btn btn-primary', "sheet buttons with bootstrap primary class should receive the correct classes"); - assert.strictEqual(form.$('button[name="10"]').attr('class'), 'btn btn-sm btn-primary', + assert.strictEqual(form.$('button[name="10"]').attr('class'), 'btn btn-primary', "sheet buttons with oe_highlight class should receive the correct classes"); - assert.strictEqual(form.$('button[name="11"]').attr('class'), 'btn btn-sm btn-default', + assert.strictEqual(form.$('button[name="11"]').attr('class'), 'btn btn-secondary', "sheet buttons with bootstrap default class should receive the correct classes"); - assert.strictEqual(form.$('button[name="12"]').attr('class'), 'btn btn-sm btn-link', + assert.strictEqual(form.$('button[name="12"]').attr('class'), 'btn btn-link', "sheet buttons with bootstrap link class should receive the correct classes"); - assert.strictEqual(form.$('button[name="13"]').attr('class'), 'btn btn-sm btn-link', + assert.strictEqual(form.$('button[name="13"]').attr('class'), 'btn btn-link', "sheet buttons with oe_link class should receive the correct classes"); - assert.strictEqual(form.$('button[name="14"]').attr('class'), 'btn btn-sm btn-success', + assert.strictEqual(form.$('button[name="14"]').attr('class'), 'btn btn-success', "sheet buttons with bootstrap state class should receive the correct classes"); - assert.strictEqual(form.$('button[name="15"]').attr('class'), 'btn btn-sm o_this_is_a_button', + assert.strictEqual(form.$('button[name="15"]').attr('class'), 'btn o_this_is_a_button', "sheet buttons with custom classes should receive the correct classes"); form.destroy(); @@ -1996,7 +1996,7 @@ QUnit.module('Views', { arch: '<form string="Partners">' + '<field name="foo"/>' + '<button string="Do something" class="btn-primary" name="abc" type="object"/>' + - '<button string="Discard" class="btn-default" special="cancel"/>' + + '<button string="Discard" class="btn-secondary" special="cancel"/>' + '</form>', res_id: 1, mockRPC: function (route, args) { @@ -2102,10 +2102,10 @@ QUnit.module('Views', { res_id: 1, }); - assert.strictEqual(form.$("label").length, 2, "should have rendered only two label"); - assert.strictEqual(form.$("label").first().text(), "Product", + assert.strictEqual(form.$("label.o_form_label").length, 2, "should have rendered only two label"); + assert.strictEqual(form.$("label.o_form_label").first().text(), "Product", "one should be the one for the product field"); - assert.strictEqual(form.$("label").eq(1).text(), "Bar", + assert.strictEqual(form.$("label.o_form_label").eq(1).text(), "Bar", "one should be the one for the bar field"); assert.strictEqual(form.$('.firstgroup td').first().attr('colspan'), undefined, @@ -2246,7 +2246,7 @@ QUnit.module('Views', { // click on discard and cancel the confirm request form.$buttons.find('.o_form_button_cancel').click(); assert.ok($('.modal').length, 'a confirm modal should be displayed'); - $('.modal-footer .btn-default').click(); // click on cancel + $('.modal-footer .btn-secondary').click(); // click on cancel assert.strictEqual(form.$('input').val(), 'new value', 'input should still contain new value'); // click on discard and confirm @@ -2482,7 +2482,7 @@ QUnit.module('Views', { // click on the pager to switch to the next record and cancel the confirm request form.pager.$('.o_pager_next').click(); // click on next assert.ok($('.modal').length, 'a confirm modal should be displayed'); - $('.modal-footer .btn-default').click(); // click on cancel + $('.modal-footer .btn-secondary').click(); // click on cancel assert.strictEqual(form.$('input').val(), 'new value', 'input should still contain new value'); assert.strictEqual(form.pager.$('.o_pager_value').text(), "1", 'pager value should still be 1'); @@ -2583,19 +2583,19 @@ QUnit.module('Views', { }); // click on second page tab - form.$('.o_notebook li:eq(1) a').click(); + form.$('.o_notebook .nav-link:eq(1)').click(); - assert.notOk(form.$('.o_notebook li:eq(0)').hasClass('active'), + assert.notOk(form.$('.o_notebook .nav-link:eq(0)').hasClass('active'), "first tab should not be active"); - assert.ok(form.$('.o_notebook li:eq(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav-link:eq(1)').hasClass('active'), "second tab should be active"); // click on the pager to switch to the next record form.pager.$('.o_pager_next').click(); - assert.notOk(form.$('.o_notebook li:eq(0)').hasClass('active'), + assert.notOk(form.$('.o_notebook .nav-link:eq(0)').hasClass('active'), "first tab should not be active"); - assert.ok(form.$('.o_notebook li:eq(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav-link:eq(1)').hasClass('active'), "second tab should be active"); form.destroy(); }); @@ -4265,9 +4265,9 @@ QUnit.module('Views', { assert.strictEqual(form.$('.oe_button_box').children().length, 2, "button box should contain two children"); - assert.strictEqual(form.$('.oe_button_box .oe_stat_button').length, 1, + assert.strictEqual(form.$('.oe_button_box > .oe_stat_button').length, 1, "button box should only contain one button"); - assert.strictEqual(form.$('.oe_button_box label').length, 1, + assert.strictEqual(form.$('.oe_button_box > label').length, 1, "button box should only contain one label"); form.destroy(); @@ -5003,8 +5003,8 @@ QUnit.module('Views', { } assert.strictEqual($actions.length, 3, "there should be 3 actions"); - var $customAction = $('.o_web_client .o_control_panel .btn-group .dropdown-menu li a')[2]; - assert.strictEqual($customAction.text.trim(), 'Action partner', + var $customAction = $('.o_web_client .o_control_panel .btn-group .dropdown-menu:last .dropdown-item:nth(2)'); + assert.strictEqual($customAction.text().trim(), 'Action partner', "the custom action should have 'Action partner' as name"); testUtils.intercept(form, 'do_action', function (event) { var context = event.data.action.context.__contexts[1]; @@ -5152,23 +5152,23 @@ QUnit.module('Views', { res_id: 1, }); - assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2, + assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 2, "both tabs should be visible"); - assert.ok(form.$('.o_notebook ul li:first').hasClass('active'), + assert.ok(form.$('.o_notebook .nav-link:first').hasClass('active'), "first tab should be active"); // click on the pager to switch to the next record form.pager.$('.o_pager_next').click(); - assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 1, + assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 1, "only the second tab should be visible"); - assert.ok(form.$('.o_notebook ul li:not(.o_invisible_modifier)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav-item:not(.o_invisible_modifier) .nav-link').hasClass('active'), "the visible tab should be active"); // click on the pager to switch back to the previous record form.pager.$('.o_pager_previous').click(); - assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2, + assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 2, "both tabs should be visible again"); - assert.ok(form.$('.o_notebook ul li:nth(1)').hasClass('active'), + assert.ok(form.$('.o_notebook .nav-link:nth(1)').hasClass('active'), "second tab should be active"); form.destroy(); @@ -5861,7 +5861,7 @@ QUnit.module('Views', { form.$('.o_statusbar_buttons button').click(); assert.ok(form.$('.o_statusbar_buttons button').prop('disabled'), 'button should be disabled'); - $('.modal-footer button.btn-default').click(); + $('.modal-footer button.btn-secondary').click(); assert.ok(!form.$('.o_statusbar_buttons button').prop('disabled'), 'button should no longer be disabled'); @@ -6519,7 +6519,7 @@ QUnit.module('Views', { } }); - form.$('.o_form_statusbar .btn-default').click(); + form.$('.o_form_statusbar .btn-secondary').click(); form.destroy(); }); @@ -6547,7 +6547,7 @@ QUnit.module('Views', { '</form>', }); - assert.strictEqual(form.$el.text(), '{"foo":"My little Foo Value","bar":false}', + assert.strictEqual(form.$('.o_widget').text(), '{"foo":"My little Foo Value","bar":false}', "widget should have been instantiated"); form.destroy(); diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js index 60e6680993c..1ed9e799a4a 100644 --- a/addons/web/static/tests/views/graph_tests.js +++ b/addons/web/static/tests/views/graph_tests.js @@ -175,9 +175,9 @@ QUnit.module('Views', { return concurrency.delay(0).then(function () { assert.ok(graph.$('text.nv-legend-text:contains(Count)').length, "should have used the correct measure"); - assert.ok(graph.$buttons.find('li[data-field="foo"]').length, + assert.ok(graph.$buttons.find('.dropdown-item[data-field="foo"]').length, "should have foo in the list of measures"); - graph.$buttons.find('li[data-field="foo"] a').click(); + graph.$buttons.find('.dropdown-item[data-field="foo"]').click(); return concurrency.delay(0); }).then(function () { @@ -268,7 +268,7 @@ QUnit.module('Views', { graph_intervalMapping: {}, }, "context should be correct"); - graph.$buttons.find('li[data-field="foo"] a').click(); // change measure + graph.$buttons.find('.dropdown-item[data-field="foo"]').click(); // change measure return concurrency.delay(0); }).then(function () { @@ -552,7 +552,7 @@ QUnit.module('Views', { return concurrency.delay(0).then(function () { // need to set the measure this way because it cannot be set in the // arch. - graph.$buttons.find('li[data-field="product_id"] a').click(); + graph.$buttons.find('.dropdown-item[data-field="product_id"]').click(); assert.strictEqual(graph.model.chart.data[0].value, 1, "should have first datapoint with value 1"); @@ -639,9 +639,9 @@ QUnit.module('Views', { '</graph>', }) - assert.strictEqual(graph.$buttons.find('.o_graph_measures_list li:first').data('field'), 'bouh', + assert.strictEqual(graph.$buttons.find('.o_graph_measures_list .dropdown-item:first').data('field'), 'bouh', "Bouh should be the first measure"); - assert.strictEqual(graph.$buttons.find('.o_graph_measures_list li:last').data('field'), '__count__', + assert.strictEqual(graph.$buttons.find('.o_graph_measures_list .dropdown-item:last').data('field'), '__count__', "Count should be the last measure"); graph.destroy(); diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index 1f7e2065638..6df7fe94ea9 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -184,7 +184,7 @@ QUnit.module('Views', { envIDs = [4]; kanban.$('.o_kanban_group:last .o_column_archive_records').click(); // Click on 'Archive All' assert.ok($('.modal').length, 'a confirm modal should be displayed'); - $('.modal-footer .btn-default').click(); // Click on 'Cancel' + $('.modal-footer .btn-secondary').click(); // Click on 'Cancel' assert.strictEqual(kanban.$('.o_kanban_group:last .o_kanban_record').length, 3, "still last column should contain 3 records"); kanban.$('.o_kanban_group:last .o_column_archive_records').click(); assert.ok($('.modal').length, 'a confirm modal should be displayed'); @@ -738,7 +738,7 @@ QUnit.module('Views', { // Select state in kanban kanban.$('.o_status').first().click(); - kanban.$('.o_selection ul:first li:first').click(); + kanban.$('.o_selection .dropdown-item:first').click(); assert.ok(kanban.$('.o_status').first().hasClass('o_status_green'), "Kanban state should be done (Green)"); kanban.destroy(); @@ -1795,7 +1795,7 @@ QUnit.module('Views', { // delete second column (first cancel the confirm request, then confirm) kanban.$('.o_kanban_group:last .o_column_delete').click(); // click on delete assert.ok($('.modal').length, 'a confirm modal should be displayed'); - $('.modal-footer .btn-default').click(); // click on cancel + $('.modal-footer .btn-secondary').click(); // click on cancel assert.strictEqual(kanban.$('.o_kanban_group:last').data('id'), 5, 'column [5, "xmo"] should still be there'); kanban.$('.o_kanban_group:last .o_column_delete').click(); // click on delete @@ -1928,7 +1928,7 @@ QUnit.module('Views', { kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit' $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value nbRPCs = 0; - $('.modal-footer .btn-default').click(); // click on discard + $('.modal-footer .btn-secondary').click(); // click on discard assert.ok(!$('.modal').length, 'the modal should be closed'); assert.strictEqual(kanban.$('.o_kanban_group[data-id=5] .o_column_title').text(), 'xmo', 'title of the column should still be "xmo"'); @@ -2760,7 +2760,7 @@ QUnit.module('Views', { '<t t-name="kanban-box">' + '<div>' + '<field name="foo"/>' + - '<button type="object" attrs="{\'invisible\':[\'|\', (\'bar\',\'=\',True), (\'category_ids\', \'!=\', [])]}" class="btn btn-primary pull-right btn-sm" name="channel_join_and_get_info">Join</button>' + + '<button type="object" attrs="{\'invisible\':[\'|\', (\'bar\',\'=\',True), (\'category_ids\', \'!=\', [])]}" class="btn btn-primary float-right" name="channel_join_and_get_info">Join</button>' + '</div>' + '</t>' + '</templates>' + @@ -2789,10 +2789,10 @@ QUnit.module('Views', { '<t t-name="kanban-box">' + '<div color="color">' + '<div class="o_dropdown_kanban dropdown">' + - '<a class="dropdown-toggle btn" data-toggle="dropdown" href="#">' + + '<a class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" href="#">' + '<span class="fa fa-bars fa-lg"/>' + '</a>' + - '<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">' + + '<ul class="dropdown-menu" role="menu">' + '<li>' + '<ul class="oe_kanban_colorpicker"/>' + '</li>' + diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 52b7eaed31b..b992b9f95ac 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -825,7 +825,7 @@ QUnit.module('Views', { }); QUnit.test('column width should not change when switching mode', function (assert) { - assert.expect(10); + assert.expect(4); // Warning: this test is css dependant var list = createView({ @@ -839,23 +839,31 @@ QUnit.module('Views', { '<field name="m2m" widget="many2many_tags"/>' + '</tree>', }); + var startWidths = _.pluck(list.$('thead th'), 'offsetWidth'); + var startWidth = list.$('table').addBack('table').width(); // start edition of first row list.$('td:not(.o_list_record_selector)').first().click(); var editionWidths = _.pluck(list.$('thead th'), 'offsetWidth'); + var editionWidth = list.$('table').addBack('table').width(); // leave edition list.$buttons.find('.o_list_button_save').click(); + var readonlyWidths = _.pluck(list.$('thead th'), 'offsetWidth'); + var readonlyWidth = list.$('table').addBack('table').width(); + + assert.strictEqual(editionWidth, startWidth, + "table should have kept the same width when switching from readonly to edit mode"); + assert.deepEqual(editionWidths, startWidths, + "width of columns should remain unchanged when switching from readonly to edit mode"); + assert.strictEqual(readonlyWidth, editionWidth, + "table should have kept the same width when switching from edit to readonly mode"); + assert.deepEqual(readonlyWidths, editionWidths, + "width of columns should remain unchanged when switching from edit to readonly mode"); - for (var i = 0; i < startWidths.length; i++) { - assert.strictEqual(startWidths[i], editionWidths[i], - 'width of columns should remain unchanged which switching from readonly to edit mode'); - assert.strictEqual(editionWidths[i], readonlyWidths[i], - 'width of columns should remain unchanged which switching from edit to readonly mode'); - } list.destroy(); }); @@ -917,7 +925,7 @@ QUnit.module('Views', { assert.verifySteps(['/web/dataset/search_read']); list.sidebar.$('a:contains(Archive)').click(); assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed'); - $('.modal-footer .btn-default').click(); // Click on 'Cancel' + $('.modal-footer .btn-secondary').click(); // Click on 'Cancel' assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 4, "still should have 4 records"); list.sidebar.$('a:contains(Archive)').click(); @@ -2347,8 +2355,8 @@ QUnit.module('Views', { var $actions = $('.o_web_client .o_control_panel .btn-group .dropdown-menu')[1].children; assert.strictEqual($actions.length, 3, "there should be 3 actions"); - var $customAction = $('.o_web_client .o_control_panel .btn-group .dropdown-menu li a')[2]; - assert.strictEqual($customAction.text.trim(), 'Action event', + var $customAction = $('.o_web_client .o_control_panel .btn-group .dropdown-item:nth(2)'); + assert.strictEqual($customAction.text().trim(), 'Action event', "the custom action should have 'Action event' as name"); list.destroy(); @@ -2674,7 +2682,7 @@ QUnit.module('Views', { list.destroy(); }); - QUnit.test('navigation: moving left/right with keydown', function (assert) { + QUnit.skip('navigation: moving left/right with keydown', function (assert) { assert.expect(8); this.data.foo.fields.foo.type = 'text'; @@ -3235,7 +3243,7 @@ QUnit.module('Views', { }); assert.verifySteps(['bar', 'res_currency'], "should have done 1 name_get by model in reference values"); - assert.strictEqual(list.$('tbody td').text(), "Value 1USDEUREUR", + assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').text(), "Value 1USDEUREUR", "should have the display_name of the reference"); list.destroy(); }); diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js index 138b620c4e0..6e034a19a79 100644 --- a/addons/web/static/tests/views/pivot_tests.js +++ b/addons/web/static/tests/views/pivot_tests.js @@ -259,7 +259,7 @@ QUnit.module('Views', { } }); - var $countMeasure = pivot.$buttons.find('li[data-field=__count]'); + var $countMeasure = pivot.$buttons.find('.dropdown-item[data-field=__count]:first'); assert.ok($countMeasure.hasClass('selected'), "The count measure should be activated"); pivot.destroy(); }); @@ -344,14 +344,15 @@ QUnit.module('Views', { // click on closed header to open dropdown pivot.$('tbody .o_pivot_header_cell_closed').click(); - assert.strictEqual(pivot.$('ul.o_pivot_field_menu > li[data-field="date"]').length, 1, + assert.strictEqual(pivot.$('.o_pivot_field_menu .dropdown-item[data-field="date"]:first').length, 1, "should have the date field as proposition"); - assert.strictEqual(pivot.$('.o_field_selection li[data-field="product_id"]').length, 1, + assert.strictEqual(pivot.$('.o_field_selection .dropdown-item[data-field="product_id"]:first').length, 1, "should have the product_id field as proposition"); - assert.strictEqual(pivot.$('.o_field_selection li[data-field="non_stored_m2o"]').length, 0, + assert.strictEqual(pivot.$('.o_field_selection .dropdown-item[data-field="non_stored_m2o"]:first').length, 0, "should not have the non_stored_m2o field as proposition"); - pivot.$('ul.o_pivot_field_menu > li[data-field="date"] a').click(); + + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="date"]:first').click(); assert.strictEqual(pivot.$('tbody tr').length, 4, "should have 4 rows: one for header, 3 for data"); @@ -376,7 +377,7 @@ QUnit.module('Views', { // open dropdown to zoom into first row pivot.$('tbody .o_pivot_header_cell_closed').first().click(); // click on date by day - pivot.$('ul.o_pivot_field_menu > li[data-field="date"] a[data-interval="day"]').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="date"][data-interval="day"]').click(); // open dropdown to zoom into second row pivot.$('tbody td.o_pivot_header_cell_closed:eq(1)').first().click(); @@ -437,22 +438,22 @@ QUnit.module('Views', { assert.strictEqual(pivot.$('.o_pivot_cell_value').length, 3, "should have 3 cells: 1 for the open header, and 2 for data"); - assert.ok(!pivot.$buttons.find('li[data-field=__count]').hasClass('selected'), + assert.ok(!pivot.$buttons.find('.dropdown-item[data-field=__count]:first').hasClass('selected'), "the __count measure should not be selected"); rpcCount = 0; - pivot.$buttons.find('li[data-field=__count] a').click(); + pivot.$buttons.find('.dropdown-item[data-field=__count]:first').click(); - assert.ok(pivot.$buttons.find('li[data-field=__count]').hasClass('selected'), + assert.ok(pivot.$buttons.find('.dropdown-item[data-field=__count]:first').hasClass('selected'), "the __count measure should be selected"); assert.strictEqual(pivot.$('.o_pivot_cell_value').length, 6, "should have 6 cells: 2 for the open header, and 4 for data"); assert.strictEqual(rpcCount, 2, "should have done 2 rpcs to reload data"); - pivot.$buttons.find('li[data-field=__count] a').click(); + pivot.$buttons.find('.dropdown-item[data-field=__count]:first').click(); - assert.ok(!pivot.$buttons.find('li[data-field=__count]').hasClass('selected'), + assert.ok(!pivot.$buttons.find('.dropdown-item[data-field=__count]:first').hasClass('selected'), "the __count measure should not be selected"); assert.strictEqual(pivot.$('.o_pivot_cell_value').length, 3, "should have 3 cells: 1 for the open header, and 2 for data"); @@ -477,7 +478,7 @@ QUnit.module('Views', { assert.strictEqual(pivot.$('table').length, 1, "should have a table in DOM"); - pivot.$buttons.find('li[data-field=__count] a').click(); + pivot.$buttons.find('.dropdown-item[data-field=__count]:first').click(); assert.strictEqual(pivot.$('.o_view_nocontent').length, 1, "should have a no_content_helper"); @@ -553,7 +554,7 @@ QUnit.module('Views', { // tries to open a field selection menu, to make sure it was not // removed from the dom. pivot.$('.o_pivot_header_cell_closed').first().click(); - assert.strictEqual(pivot.$('ul.o_pivot_field_menu').length, 1, + assert.strictEqual(pivot.$('.o_pivot_field_menu').length, 1, "the field selector menu exists"); pivot.destroy(); }); @@ -816,7 +817,7 @@ QUnit.module('Views', { // expand header on field customer pivot.$('thead .o_pivot_header_cell_closed:nth(1)').click(); - pivot.$('ul.o_pivot_field_menu > li[data-field="customer"] a').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="customer"]:first').click(); assert.deepEqual(pivot.getContext(), { pivot_column_groupby: ['date:day', 'customer'], pivot_measures: ['foo'], @@ -825,7 +826,7 @@ QUnit.module('Views', { // expand row on field product_id pivot.$('tbody .o_pivot_header_cell_closed').first().click(); - pivot.$('ul.o_pivot_field_menu > li[data-field="product_id"] a').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="product_id"]:first').click(); assert.deepEqual(pivot.getContext(), { pivot_column_groupby: ['date:day', 'customer'], pivot_measures: ['foo'], @@ -982,7 +983,7 @@ QUnit.module('Views', { }, }); - var $countMeasure = pivot.$buttons.find('li[data-field=__count]'); + var $countMeasure = pivot.$buttons.find('.dropdown-item[data-field=__count]:first'); assert.ok($countMeasure.hasClass('selected'), "The count measure should be activated"); pivot.destroy(); @@ -1056,7 +1057,7 @@ QUnit.module('Views', { }); pivot.$('tbody .o_pivot_header_cell_closed').first().click(); // click on date by month - pivot.$('ul.o_pivot_field_menu > li[data-field="date"] a[data-interval="month"]').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="date"][data-interval="month"]').click(); assert.strictEqual(pivot.$('.o_pivot_cell_value').text(), '2211', 'should have loaded the proper data'); @@ -1078,7 +1079,7 @@ QUnit.module('Views', { }, }); - pivot.$buttons.find('li[data-field=product_id] a').click(); + pivot.$buttons.find('.dropdown-item[data-field=product_id]:first').click(); assert.strictEqual(pivot.$('.o_pivot_cell_value').text(), '421131', 'should have loaded the proper data'); pivot.destroy(); @@ -1098,7 +1099,7 @@ QUnit.module('Views', { pivot.$('tbody .o_pivot_header_cell_closed').first().click(); - pivot.$('ul.o_pivot_field_menu > li[data-field="product_id"] a').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field="product_id"]:first').click(); assert.strictEqual(pivot.$('.o_pivot_cell_value').text(), '211', 'should have loaded the proper data'); @@ -1119,11 +1120,11 @@ QUnit.module('Views', { // Set a column groupby pivot.$('thead .o_pivot_header_cell_closed').click(); - pivot.$('.o_field_selection li[data-field=customer] a').click(); + pivot.$('.o_field_selection .dropdown-item[data-field=customer]:first').click(); // Set a Row groupby pivot.$('tbody .o_pivot_header_cell_closed').click(); - pivot.$('.o_pivot_field_menu li[data-field=product_id] a').click(); + pivot.$('.o_pivot_field_menu .dropdown-item[data-field=product_id]:first').click(); // Set a domain pivot.update({domain: [['product_id', '=', 41]]}); @@ -1195,9 +1196,9 @@ QUnit.module('Views', { '</pivot>', }) - assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list li:first').data('field'), 'bouh', + assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list .dropdown-item:first').data('field'), 'bouh', "Bouh should be the first measure"); - assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list li:last').data('field'), '__count', + assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list .dropdown-item:last').data('field'), '__count', "Count should be the last measure"); pivot.destroy(); diff --git a/addons/web/static/tests/views/search_filters_menu_tests.js b/addons/web/static/tests/views/search_filters_menu_tests.js index e6430527de7..70d57c1fd32 100644 --- a/addons/web/static/tests/views/search_filters_menu_tests.js +++ b/addons/web/static/tests/views/search_filters_menu_tests.js @@ -37,11 +37,11 @@ QUnit.module('FiltersMenu', { var filterMenu = createFiltersMenu([], this.fields); filterMenu.$('span.fa-filter').click(); - assert.strictEqual(filterMenu.$('.divider').length, 1); - assert.ok(!filterMenu.$('.divider').is(':visible')); - assert.strictEqual(filterMenu.$('li').length, 3, - 'should have 3 li: a hidden divider, a add custom filter item, a apply button + add condition button'); - assert.strictEqual(filterMenu.$('li.o_add_custom_filter.o_closed_menu').length, 1); + assert.strictEqual(filterMenu.$('.dropdown-divider').length, 1); + assert.ok(!filterMenu.$('.dropdown-divider').is(':visible')); + assert.strictEqual(filterMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 3, + 'should have 3 elements: a hidden divider, a add custom filter item, a apply button + add condition button'); + assert.strictEqual(filterMenu.$('.o_add_custom_filter.o_closed_menu').length, 1); filterMenu.destroy(); }); @@ -49,9 +49,9 @@ QUnit.module('FiltersMenu', { assert.expect(2); var filterMenu = createFiltersMenu(this.filters, this.fields); - assert.strictEqual(filterMenu.$('li').length, 5, - 'should have 4 li: a hidden, separator, a filter, a separator, a add custom filter item, a apply button + add condition button'); - assert.strictEqual(filterMenu.$('li.o_add_custom_filter.o_closed_menu').length, 1); + assert.strictEqual(filterMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 5, + 'should have 4 elements: a hidden, separator, a filter, a separator, a add custom filter item, a apply button + add condition button'); + assert.strictEqual(filterMenu.$('.o_add_custom_filter.o_closed_menu').length, 1); filterMenu.destroy(); }); @@ -62,11 +62,11 @@ QUnit.module('FiltersMenu', { // open menu dropdown filterMenu.$('span.fa-filter').click(); // open add custom filter submenu - filterMenu.$('li.o_add_custom_filter').click(); - assert.ok(filterMenu.$('li.o_add_custom_filter').hasClass('o_open_menu')); - assert.ok(filterMenu.$('li.o_add_filter_menu').is(':visible')); - assert.strictEqual(filterMenu.$('li').length, 4, - 'should have 3 li: a hidden divider, a add custom filter item, a proposition, a apply button + add condition button'); + filterMenu.$('.o_add_custom_filter').click(); + assert.ok(filterMenu.$('.o_add_custom_filter').hasClass('o_open_menu')); + assert.ok(filterMenu.$('.o_add_filter_menu').is(':visible')); + assert.strictEqual(filterMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4, + 'should have 3 elements: a hidden divider, a add custom filter item, a proposition, a apply button + add condition button'); filterMenu.destroy(); }); @@ -77,15 +77,15 @@ QUnit.module('FiltersMenu', { var filterMenu = createFiltersMenu([], this.fields); // open menu dropdown and custom filter submenu filterMenu.$('span.fa-filter').click(); - filterMenu.$('li.o_add_custom_filter').click(); + filterMenu.$('.o_add_custom_filter').click(); // remove the current unique proposition filterMenu.$('.o_searchview_extended_delete_prop').click(); assert.ok(filterMenu.$('.o_apply_filter').attr('disabled')); - assert.strictEqual(filterMenu.$('li').length, 3, - 'should have 3 li: a hidden separator, a add custom filter item, a apply button + add condition button'); + assert.strictEqual(filterMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 3, + 'should have 3 elements: a hidden separator, a add custom filter item, a apply button + add condition button'); filterMenu.destroy(); }); @@ -97,7 +97,7 @@ QUnit.module('FiltersMenu', { // open menu dropdown and custom filter submenu, remove existing prop filterMenu.$('span.fa-filter').click(); - filterMenu.$('li.o_add_custom_filter').click(); + filterMenu.$('.o_add_custom_filter').click(); filterMenu.$('.o_searchview_extended_delete_prop').click(); // read a proposition @@ -116,14 +116,14 @@ QUnit.module('FiltersMenu', { // open menu dropdown and custom filter submenu, remove existing prop filterMenu.$('span.fa-filter').click(); - filterMenu.$('li.o_add_custom_filter').click(); + filterMenu.$('.o_add_custom_filter').click(); // click on apply to activate filter filterMenu.$('.o_apply_filter').click(); assert.ok(filterMenu.$('.o_add_custom_filter').hasClass('o_closed_menu')); assert.strictEqual(filterMenu.$('.o_filter_condition').length, 0); - assert.strictEqual(filterMenu.$('.divider:visible').length, 1, + assert.strictEqual(filterMenu.$('.dropdown-divider:visible').length, 1, 'there should be a separator between filters and add custom filter menu'); filterMenu.destroy(); diff --git a/addons/web/static/tests/views/search_groupby_menu_tests.js b/addons/web/static/tests/views/search_groupby_menu_tests.js index 8dff7a581fe..d11b8ed0dbe 100644 --- a/addons/web/static/tests/views/search_groupby_menu_tests.js +++ b/addons/web/static/tests/views/search_groupby_menu_tests.js @@ -35,8 +35,8 @@ QUnit.module('GroupByMenu', { var groupByMenu = createGroupByMenu(this.groupbys, this.fields); groupByMenu.$('button:first').click(); - assert.strictEqual(groupByMenu.$('li').length, 2, 'should have 2 li'); - assert.strictEqual(groupByMenu.$('li:nth-child(2)').text().trim(), 'some group by', + assert.strictEqual(groupByMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 2, 'should have 2 elements'); + assert.strictEqual(groupByMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').eq(1).text().trim(), 'some group by', 'should have proper filter name'); groupByMenu.destroy(); }); @@ -46,7 +46,7 @@ QUnit.module('GroupByMenu', { var groupByMenu = createGroupByMenu([], {}); groupByMenu.$('button:first').click(); - assert.strictEqual(groupByMenu.$('li').length, 0, 'should have 0 li'); + assert.strictEqual(groupByMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 0, 'should have 0 element'); groupByMenu.destroy(); }); @@ -58,7 +58,7 @@ QUnit.module('GroupByMenu', { {fieldname: {sortable: true, string: 'Super Date', type: 'date', isDate: true}} ); groupByMenu.$('button:first').click(); - assert.strictEqual(groupByMenu.$('li').length, 1, 'should have 1 li'); + assert.strictEqual(groupByMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 1, 'should have 1 element'); groupByMenu.destroy(); }); @@ -69,7 +69,7 @@ QUnit.module('GroupByMenu', { groupByMenu.$('button:first').click(); var selector = groupByMenu.$('select.o_group_selector'); assert.ok(!selector.is(":visible"), 'should be invisible'); - groupByMenu.$('.o_add_custom_group a').click(); + groupByMenu.$('.o_add_custom_group').click(); selector = groupByMenu.$('select.o_group_selector'); assert.ok(selector.is(":visible"), 'should be visible'); groupByMenu.destroy(); @@ -85,11 +85,11 @@ QUnit.module('GroupByMenu', { } ); groupByMenu.$('button:first').click(); - groupByMenu.$('li.o_add_custom_group a').click(); + groupByMenu.$('.o_add_custom_group').click(); assert.strictEqual(groupByMenu.$('select').val(), 'fieldName', 'the select value should be "fieldName"'); groupByMenu.$('button.o_apply_group').click(); - assert.strictEqual(groupByMenu.$('li.o_menu_item.selected').length, 1, 'there should be a groupby selected'); + assert.strictEqual(groupByMenu.$('.o_menu_item.selected').length, 1, 'there should be a groupby selected'); groupByMenu.destroy(); }); @@ -107,7 +107,7 @@ QUnit.module('GroupByMenu', { var groupByMenu = createGroupByMenu(this.groupbys, this.fields, { intercepts: { - menu_item_toggled: function(ev) { + menu_item_toggled: function (ev) { assert.strictEqual(ev.data.itemId, 'green'); assert.strictEqual(ev.data.isActive, true); }, @@ -143,7 +143,7 @@ QUnit.module('GroupByMenu', { var groupByMenu = createGroupByMenu(this.groupbys, {fieldname: {sortable: true, string: 'Super Date', type: 'date', isDate: true}} ); - groupByMenu.$el.click(function(event) { + groupByMenu.$el.click(function (event) { // we do not want a click to get out and change the url, for example throw new Error('No click should get out of the groupby menu'); }); diff --git a/addons/web/static/tests/views/search_view_tests.js b/addons/web/static/tests/views/search_view_tests.js index 990686da97a..88c5416398e 100644 --- a/addons/web/static/tests/views/search_view_tests.js +++ b/addons/web/static/tests/views/search_view_tests.js @@ -170,7 +170,7 @@ QUnit.module('Search View', { actionManager.doAction(1); $('span.fa-bars').prev().click(); - $('li.o_menu_item a').click(); + $('.o_menu_item a').click(); assert.strictEqual($('.o_searchview .o_searchview_facet .o_facet_values span').text().trim(), 'candle', 'should have a facet with candle name'); actionManager.destroy(); @@ -187,7 +187,7 @@ QUnit.module('Search View', { actionManager.doAction(1); $('span.fa-bars').prev().click(); - $('li.o_menu_item a').click(); + $('.o_menu_item a').click(); assert.strictEqual($('.o_searchview .o_searchview_facet .o_facet_values span').text().trim(), 'candle', 'should have a facet with candle name'); $('.o_facet_remove:first').click(); @@ -304,7 +304,7 @@ QUnit.module('Search View', { // // no groupby is applied assert.strictEqual($('div.o_facet_values span').length, 0); // // open 'Add custom Groupby' menu - $('.o_group_by_menu .o_add_custom_group a').click(); + $('.o_group_by_menu .o_add_custom_group').click(); // // click on 'Apply' button $('.o_group_by_menu .o_generator_menu button').click(); // // data should be grouped by the field 'Birthday' using the interval 'month' @@ -364,7 +364,7 @@ QUnit.module('Search View', { actionManager.doAction(1); $('span.fa-filter').click(); - $('li.o_add_custom_filter').click(); + $('.o_add_custom_filter').click(); $('.o_apply_filter').click(); assert.strictEqual($('.o_searchview .o_searchview_facet .o_facet_values span').text().trim(), 'ID is \"0\"', 'should have a facet with candle name'); @@ -382,9 +382,9 @@ QUnit.module('Search View', { actionManager.doAction(1); $('span.fa-filter').click(); - $('li.o_add_custom_filter').click(); + $('.o_add_custom_filter').click(); $('.o_apply_filter').click(); - $('li.o_menu_item').click(); + $('.o_menu_item').click(); assert.strictEqual($('.o_searchview .o_searchview_facet .o_facet_values span').length, 0, 'no facet should be in the search view'); actionManager.destroy(); @@ -455,20 +455,20 @@ QUnit.module('Search View', { // open menu 'Filter' $('.o_search_options .fa-filter').click(); // open menu options - $('li.o_menu_item').click(); - $('li.o_menu_item .o_item_option[data-option_id="today"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="this_week"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="this_month"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="this_quarter"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="this_year"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="yesterday"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_week"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_month"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_quarter"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_year"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_7_days"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_30_days"]').click(); - $('li.o_menu_item .o_item_option[data-option_id="last_365_days"]').click(); + $('.o_menu_item').click(); + $('.o_menu_item .o_item_option[data-option_id="today"]').click(); + $('.o_menu_item .o_item_option[data-option_id="this_week"]').click(); + $('.o_menu_item .o_item_option[data-option_id="this_month"]').click(); + $('.o_menu_item .o_item_option[data-option_id="this_quarter"]').click(); + $('.o_menu_item .o_item_option[data-option_id="this_year"]').click(); + $('.o_menu_item .o_item_option[data-option_id="yesterday"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_week"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_month"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_quarter"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_year"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_7_days"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_30_days"]').click(); + $('.o_menu_item .o_item_option[data-option_id="last_365_days"]').click(); actionManager.destroy(); window.Date = RealDate; @@ -498,7 +498,7 @@ QUnit.module('Search View', { actionManager.doAction(6); $('span.fa-filter').click(); - $('.o_filters_menu li.o_menu_item a').click(); + $('.o_filters_menu .o_menu_item a').click(); $('.o_item_option:first').click(); $('span.fa-star').click(); $('.o_favorites_menu .o_save_search a').click(); diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js index 1e57474e4b5..b45c27e4d60 100644 --- a/addons/web/static/tests/views/view_dialogs_tests.js +++ b/addons/web/static/tests/views/view_dialogs_tests.js @@ -347,7 +347,7 @@ QUnit.module('Views', { 'There should be two modals'); var $second_modal = $modals.not($modal); - $second_modal.find('.o_list_view.table.table-condensed.table-striped.o_list_view_ungrouped .o_data_row input[type=checkbox]').click(); + $second_modal.find('.o_list_view.table.table-sm.table-striped.o_list_view_ungrouped .o_data_row input[type=checkbox]').click(); $second_modal.find('.o_select_button').click(); @@ -359,7 +359,7 @@ QUnit.module('Views', { assert.equal($modal.find('.o_data_cell').text(), 'Awsome', 'There should be one item in the list of the modal'); - $modal.find('.btn.btn-sm.btn-primary').click(); + $modal.find('.btn.btn-primary').click(); form.destroy(); }); diff --git a/addons/web/static/tests/widgets/dropdown_menu_tests.js b/addons/web/static/tests/widgets/dropdown_menu_tests.js index 0669b92c87f..b378a94ee58 100644 --- a/addons/web/static/tests/widgets/dropdown_menu_tests.js +++ b/addons/web/static/tests/widgets/dropdown_menu_tests.js @@ -44,9 +44,9 @@ QUnit.module('Web', { assert.expect(2); var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); - assert.strictEqual(dropdownMenu.$('li').length, 4, 'should have 4 li counting the dividers'); - assert.strictEqual(dropdownMenu.$('li:nth-child(2)').text().trim(), 'Some Item', - 'first li should have "Some Item" description'); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4, 'should have 4 elements counting the dividers'); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').eq(1).text().trim(), 'Some Item', + 'first element should have "Some Item" description'); dropdownMenu.destroy(); }); @@ -57,7 +57,7 @@ QUnit.module('Web', { var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items, { intercepts: { - menu_item_toggled: function(ev) { + menu_item_toggled: function (ev) { eventNumber++; assert.strictEqual(ev.data.itemId, 1); if (eventNumber === 1) { @@ -86,7 +86,7 @@ QUnit.module('Web', { assert.expect(0); var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); - dropdownMenu.$el.click(function() { + dropdownMenu.$el.click(function () { // we do not want a click to get out and change the url, for example throw new Error('No click should get out of the dropdown menu'); }); @@ -103,13 +103,13 @@ QUnit.module('Web', { var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items); // open dropdown dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('li').length, 4); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); // open options menu dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('li').length, 7); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); // close options menu dropdownMenu.$('span.fa-caret-down').click(); - assert.strictEqual(dropdownMenu.$('li').length, 4); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); dropdownMenu.destroy(); }); @@ -123,10 +123,10 @@ QUnit.module('Web', { dropdownMenu.$('button:first').click(); // open options menu dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('li').length, 7); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); dropdownMenu.$('button:first').click(); dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('li').length, 4); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); dropdownMenu.destroy(); }); @@ -140,7 +140,7 @@ QUnit.module('Web', { var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items, { intercepts: { - menu_item_toggled: function(ev) { + menu_item_toggled: function (ev) { eventNumber++; if (eventNumber === 1) { assert.strictEqual(ev.data.itemId, 1); @@ -152,7 +152,7 @@ QUnit.module('Web', { assert.strictEqual(ev.data.optionId, false); } }, - item_option_changed: function(ev) { + item_option_changed: function (ev) { if (eventNumber === 1) { assert.strictEqual(ev.data.itemId, 1); assert.strictEqual(ev.data.isActive, true); @@ -165,20 +165,20 @@ QUnit.module('Web', { dropdownMenu.$('button:first').click(); // open options menu dropdownMenu.$('span.fa-caret-right').click(); - assert.strictEqual(dropdownMenu.$('li').length, 7); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 7); // Don't forget there is a hidden li.divider element at first place among children assert.ok(!dropdownMenu.$('.o_menu_item:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3)').hasClass('selected')); - dropdownMenu.$('li.o_item_option:first').click(); + dropdownMenu.$('.o_item_option:first').click(); assert.ok(dropdownMenu.$('.o_menu_item:nth-child(2)').hasClass('selected')); assert.ok(dropdownMenu.$('.o_item_option:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3)').hasClass('selected')); - dropdownMenu.$('li.o_item_option:nth-child(3)').click(); + dropdownMenu.$('.o_item_option:nth-child(3)').click(); assert.ok(dropdownMenu.$('.o_menu_item:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2)').hasClass('selected')); assert.ok(dropdownMenu.$('.o_item_option:nth-child(3)').hasClass('selected')); - dropdownMenu.$('li.o_item_option:nth-child(3)').click(); + dropdownMenu.$('.o_item_option:nth-child(3)').click(); assert.ok(!dropdownMenu.$('.o_menu_item:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(2)').hasClass('selected')); assert.ok(!dropdownMenu.$('.o_item_option:nth-child(3)').hasClass('selected')); @@ -190,15 +190,15 @@ QUnit.module('Web', { var dropdownMenu = createDropdownMenu(this.dropdownHeader, this.items, { intercepts: { - menu_item_deleted: function(ev) { + menu_item_deleted: function (ev) { assert.strictEqual(ev.data.itemId, 2); }, }, }); dropdownMenu.$('button:first').click(); - assert.strictEqual(dropdownMenu.$('li').length, 4); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 4); dropdownMenu.$('span.o_trash_button').click(); - assert.strictEqual(dropdownMenu.$('li').length, 2); + assert.strictEqual(dropdownMenu.$('.dropdown-divider, .dropdown-item, .dropdown-item-text').length, 2); dropdownMenu.destroy(); }); }); |
