summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/view_dialogs_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/views/view_dialogs_tests.js')
-rw-r--r--addons/web/static/tests/views/view_dialogs_tests.js44
1 files changed, 23 insertions, 21 deletions
diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js
index 372edbc0f24..8898e520618 100644
--- a/addons/web/static/tests/views/view_dialogs_tests.js
+++ b/addons/web/static/tests/views/view_dialogs_tests.js
@@ -60,7 +60,7 @@ QUnit.module('Views', {
function createParent(params) {
var widget = new Widget();
- testUtils.addMockEnvironment(widget, params);
+ testUtils.mock.addMockEnvironment(widget, params);
return widget;
}
@@ -80,7 +80,7 @@ QUnit.module('Views', {
},
});
- testUtils.intercept(parent, 'env_updated', function () {
+ testUtils.mock.intercept(parent, 'env_updated', function () {
throw new Error("The environment should not be propagated to the action manager");
});
@@ -121,7 +121,7 @@ QUnit.module('Views', {
assert.strictEqual($('.modal button.btn-primary').length, 1,
"should have 1 buttons in modal");
- $('.o_field_x2many_list_row_add a').click();
+ testUtils.dom.click($('.o_field_x2many_list_row_add a'));
$('input.o_input').trigger($.Event('keydown', {
which: $.ui.keyCode.ESCAPE,
keyCode: $.ui.keyCode.ESCAPE,
@@ -199,8 +199,8 @@ QUnit.module('Views', {
},
}).open();
- dialog.$('.o_searchview_facet:contains(groupby_bar) .o_facet_remove').click();
- dialog.$('.o_searchview_facet .o_facet_remove').click();
+ testUtils.dom.click(dialog.$('.o_searchview_facet:contains(groupby_bar) .o_facet_remove'));
+ testUtils.dom.click(dialog.$('.o_searchview_facet .o_facet_remove'));
parent.destroy();
});
@@ -264,7 +264,7 @@ QUnit.module('Views', {
}).open();
// click on the first row to see if the list is editable
- dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first').click();
+ testUtils.dom.click(dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first'));
assert.equal(dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first input').length, 0,
"list view should not be editable in a SelectCreateDialog");
@@ -329,17 +329,17 @@ QUnit.module('Views', {
},
});
- form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_field_x2many_list_row_add a').click();
- form.$('.o_field_widget .o_field_many2one[name=instrument] input').click();
- $('ul.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content li.o_m2o_dropdown_option').first().click();
+ testUtils.form.clickEdit(form);
+ testUtils.dom.click(form.$('.o_field_x2many_list_row_add a'));
+ testUtils.dom.click(form.$('.o_field_widget .o_field_many2one[name=instrument] input'));
+ testUtils.dom.click($('ul.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content li.o_m2o_dropdown_option').first());
var $modal = $('.modal-lg');
assert.equal($modal.length, 1,
'There should be one modal');
- $modal.find('.o_field_x2many_list_row_add a').click();
+ testUtils.dom.click($modal.find('.o_field_x2many_list_row_add a'));
var $modals = $('.modal-lg');
@@ -347,9 +347,9 @@ QUnit.module('Views', {
'There should be two modals');
var $second_modal = $modals.not($modal);
- $second_modal.find('.o_list_view.table.table-sm.table-striped.o_list_view_ungrouped .o_data_row input[type=checkbox]').click();
+ testUtils.dom.click($second_modal.find('.o_list_view.table.table-sm.table-striped.o_list_view_ungrouped .o_data_row input[type=checkbox]'));
- $second_modal.find('.o_select_button').click();
+ testUtils.dom.click($second_modal.find('.o_select_button'));
$modal = $('.modal-lg');
@@ -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-primary').click();
+ testUtils.dom.click($modal.find('.btn.btn-primary'));
form.destroy();
});
@@ -422,7 +422,7 @@ QUnit.module('Views', {
QUnit.test('SelectCreateDialog: save current search', function (assert) {
assert.expect(4);
- testUtils.patch(ListController, {
+ testUtils.mock.patch(ListController, {
getContext: function () {
return {
shouldBeInFilterContext: true,
@@ -459,21 +459,23 @@ QUnit.module('Views', {
res_model: 'partner',
}).open();
- assert.strictEqual(dialog.$('.o_data_row').length, 3,
+ assert.containsN(dialog, '.o_data_row', 3,
"should contain 3 records");
// filter on bar
- dialog.$('.o_filters_menu a:contains(Bar)').click();
+ testUtils.dom.click(dialog.$('.o_dropdown_toggler_btn:contains(Filters)'));
+ testUtils.dom.click(dialog.$('.o_filters_menu a:contains(Bar)'));
- assert.strictEqual(dialog.$('.o_data_row').length, 2,
+ assert.containsN(dialog, '.o_data_row', 2,
"should contain 2 records");
// save filter
- dialog.$('.o_save_search a').click(); // toggle 'Save current search'
+ testUtils.dom.click(dialog.$('.o_dropdown_toggler_btn:contains(Favorites)'));
+ testUtils.dom.click(dialog.$('.o_save_search'));
dialog.$('.o_save_name input[type=text]').val('some name'); // name the filter
- dialog.$('.o_save_name button').click(); // click on 'Save'
+ testUtils.dom.click(dialog.$('.o_save_name button'));
- testUtils.unpatch(ListController);
+ testUtils.mock.unpatch(ListController);
parent.destroy();
});
});