summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-07-05 13:17:59 +0200
committerQuentin Smetz (qsm) <qsm@odoo.com>2018-07-09 11:59:30 +0200
commit2c966909e2c0b5e45912a6ff85577f0b19a5f4c9 (patch)
tree71d294f0a0577c13561bf079aa58fd2395653f11 /addons/web/static/tests/fields/relational_fields_tests.js
parent49a905321a5b94df6d87355c57c4c1a02d349502 (diff)
[FIX] *: fix some side-effects of https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
- JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the <title/> tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js426
1 files changed, 213 insertions, 213 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 8cafb80e69a..b4b6e4cd6d2 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -208,7 +208,7 @@ QUnit.module('relational_fields', {
form.$('.o_external_button').click(); // click on the external button (should do an RPC)
- assert.strictEqual($('[role="dialog"] .modal-title').text().trim(), 'Open: custom label',
+ assert.strictEqual($('.modal .modal-title').text().trim(), 'Open: custom label',
"dialog title should display the custom string label");
// TODO: test that we can edit the record in the dialog, and that the value is correctly
@@ -248,7 +248,7 @@ QUnit.module('relational_fields', {
// click on the external button (should do an RPC)
form.$('.o_external_button').click();
// save and close modal
- $('footer.modal-footer .btn-primary:first').click();
+ $('.modal .modal-footer .btn-primary:first').click();
// save form
form.$buttons.find('.o_form_button_save').click();
// click next on pager
@@ -317,10 +317,10 @@ QUnit.module('relational_fields', {
// click on the external button (should do an RPC)
form.$('.o_external_button').click();
- $('[role="dialog"] input[name="foo"]').val('brandon').trigger('input');
+ $('.modal input[name="foo"]').val('brandon').trigger('input');
// save and close modal
- $('footer.modal-footer .btn-primary:first').click();
+ $('.modal .modal-footer .btn-primary:first').click();
// save form
form.$buttons.find('.o_form_button_save').click();
// click next on pager
@@ -374,7 +374,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('button.o_external_button:visible').length, 1,
"should still have an open record button");
form.$('input.o_input').trigger('focusout');
- assert.strictEqual($('[role="dialog"] button:contains(Create and edit)').length, 0,
+ assert.strictEqual($('.modal button:contains(Create and edit)').length, 0,
"there should not be a quick create modal");
form.destroy();
@@ -473,10 +473,10 @@ QUnit.module('relational_fields', {
// open the many2one in form view and change something
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_external_button').click();
- $('main.modal-body input[name="other_field"]').val('wood').trigger('input');
+ $('.modal-body input[name="other_field"]').val('wood').trigger('input');
// save the modal and make sure an onchange is triggered
- $('footer.modal-footer .btn-primary').first().click();
+ $('.modal .modal-footer .btn-primary').first().click();
assert.verifySteps(['read', 'get_formview_id', 'load_views', 'read', 'write', 'onchange', 'read']);
// save the main record, and check that no extra rpcs are done (record
@@ -574,20 +574,20 @@ QUnit.module('relational_fields', {
form.$('.o_field_many2one input').click();
// click on 'Search More' (mouseenter required by ui-autocomplete)
$dropdown.find('.o_m2o_dropdown_option:contains(Search)').mouseenter().click();
- assert.ok($('[role="dialog"] .o_list_view').length, "should have opened a list view in a modal");
- assert.ok(!$('[role="dialog"] .o_list_view .o_list_record_selector').length,
+ assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
+ assert.ok(!$('.modal .o_list_view .o_list_record_selector').length,
"there should be no record selector in the list view");
- assert.ok(!$('footer.modal-footer .o_select_button').length,
+ assert.ok(!$('.modal .modal-footer .o_select_button').length,
"there should be no 'Select' button in the footer");
- assert.ok($('[role="dialog"] tbody tr').length > 10, "list should contain more than 10 records");
+ assert.ok($('.modal tbody tr').length > 10, "list should contain more than 10 records");
// filter the list using the searchview
- $('[role="dialog"] .o_searchview_input').trigger({type: 'keypress', which: 80}); // P
- $('[role="dialog"] .o_searchview_input').trigger({type: 'keydown', which: 13}); // enter
- assert.strictEqual($('[role="dialog"] tbody tr').length, 10,
+ $('.modal .o_searchview_input').trigger({type: 'keypress', which: 80}); // P
+ $('.modal .o_searchview_input').trigger({type: 'keydown', which: 13}); // enter
+ assert.strictEqual($('.modal tbody tr').length, 10,
"list should be restricted to records containing a P (10 records)");
// choose a record
- $('[role="dialog"] tbody tr:contains(Partner 20)').click(); // choose record 'Partner 20'
- assert.ok(!$('[role="dialog"]').length, "should have closed the modal");
+ $('.modal tbody tr:contains(Partner 20)').click(); // choose record 'Partner 20'
+ assert.ok(!$('.modal').length, "should have closed the modal");
assert.ok(!$dropdown.is(':visible'), 'should have closed the dropdown');
assert.strictEqual(form.$('.o_field_many2one input').val(), 'Partner 20',
'value of the m2o should have been correctly updated');
@@ -1811,7 +1811,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_cell').click();
form.$('.o_external_button').click();
- var $modal = $('[role="dialog"]');
+ var $modal = $('.modal');
assert.equal($modal.length, 1,
'There should be 1 modal opened');
@@ -1823,7 +1823,7 @@ QUnit.module('relational_fields', {
{position: 'top'});
// Saving the modal and then the original model
- $modal.find('footer.modal-footer .btn-primary').click();
+ $modal.find('.modal-footer .btn-primary').click();
form.$buttons.find('.o_form_button_save').click();
assert.verifySteps(['onchange sequence', 'partner_type write']);
@@ -2021,7 +2021,7 @@ QUnit.module('relational_fields', {
form.$('.o_field_many2one input').focus();
form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
- $('footer.modal-footer .btn-primary').first().click();
+ $('.modal .modal-footer .btn-primary').first().click();
form.destroy();
});
@@ -2049,14 +2049,14 @@ QUnit.module('relational_fields', {
// cancel the many2one creation with Cancel button
form.$('.o_field_many2one input').focus().val('new product').trigger('keyup').trigger('blur');
- assert.strictEqual($('[role="dialog"]').length, 1, "there should be one opened modal");
- $('footer.modal-footer .btn:contains(Cancel)').click();
+ assert.strictEqual($('.modal').length, 1, "there should be one opened modal");
+ $('.modal .modal-footer .btn:contains(Cancel)').click();
assert.strictEqual(form.$('.o_field_many2one input').val(), "",
'the many2one should not set a value as its creation has been cancelled (with Cancel button)');
// cancel the many2one creation with Close button
form.$('.o_field_many2one input').focus().val('new product').trigger('keyup').trigger('blur');
- $('header.modal-header button').click();
+ $('.modal .modal-header button').click();
assert.strictEqual(form.$('.o_field_many2one input').val(), "",
'the many2one should not set a value as its creation has been cancelled (with Close button)');
@@ -2065,16 +2065,16 @@ QUnit.module('relational_fields', {
form.$('.o_field_many2one input').autocomplete('widget').find('a').first().click();
assert.strictEqual(form.$('input').val(), "xphone", "should have selected xphone");
form.$('.o_field_many2one input').focus().val('new product').trigger('keyup').trigger('blur');
- assert.strictEqual($('[role="dialog"]').length, 1, "there should be one opened modal");
- $('footer.modal-footer .btn:contains(Cancel)').click();
+ assert.strictEqual($('.modal').length, 1, "there should be one opened modal");
+ $('.modal .modal-footer .btn:contains(Cancel)').click();
assert.strictEqual(form.$('.o_field_many2one input').val(), "xphone",
'should have restored the many2one with its previous selected value (xphone)');
// confirm the many2one creation
form.$('.o_field_many2one input').focus();
form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('blur');
- $('footer.modal-footer .btn-primary').click();
- assert.strictEqual($('[role="dialog"] .o_form_view').length, 1,
+ $('.modal .modal-footer .btn-primary').click();
+ assert.strictEqual($('.modal .o_form_view').length, 1,
'a new modal should be opened and contain a form view');
form.destroy();
@@ -2097,7 +2097,7 @@ QUnit.module('relational_fields', {
form.$('.o_field_many2one input').focus();
form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
- assert.strictEqual($('[role="dialog"]').length, 0, "should not display the create modal");
+ assert.strictEqual($('.modal').length, 0, "should not display the create modal");
form.destroy();
});
@@ -2140,14 +2140,14 @@ QUnit.module('relational_fields', {
"there should be an external button displayed");
form.$('.o_field_many2one .o_external_button').click();
- assert.strictEqual($('[role="dialog"] .o_form_view.o_form_readonly').length, 1,
+ assert.strictEqual($('.modal .o_form_view.o_form_readonly').length, 1,
"there should be a readonly form view opened");
- $('[role="dialog"] .o_form_button_cancel').click();
+ $('.modal .o_form_button_cancel').click();
form.$('.o_field_many2one input').val('new product').trigger('keyup').trigger('focusout');
- assert.strictEqual($('[role="dialog"]').length, 0, "should not display the create modal");
+ assert.strictEqual($('.modal').length, 0, "should not display the create modal");
form.destroy();
});
@@ -2264,10 +2264,10 @@ QUnit.module('relational_fields', {
}));
concurrency.delay(0).then(function() {
$input.blur();
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"should have one modal in body");
// Check that discarding clears $input
- $('[role="dialog"] .o_form_button_cancel').click();
+ $('.modal .o_form_button_cancel').click();
assert.strictEqual($input.val(), '',
"the field should be empty");
form.destroy();
@@ -2323,7 +2323,7 @@ QUnit.module('relational_fields', {
which: $.ui.keyCode.ENTER,
keyCode: $.ui.keyCode.ENTER,
}));
- assert.strictEqual($('[role="dialog"]').length, 0, "should not have any modal in DOM");
+ assert.strictEqual($('.modal').length, 0, "should not have any modal in DOM");
assert.verifySteps(['name_search', 'onchange', 'write', 'read']);
list.destroy();
relationalFields.FieldMany2One.prototype.AUTOCOMPLETE_DELAY = M2O_DELAY;
@@ -2379,7 +2379,7 @@ QUnit.module('relational_fields', {
keyCode: $.ui.keyCode.ENTER,
}));
def.resolve();
- assert.strictEqual($('[role="dialog"]').length, 0, "should not have any modal in DOM");
+ assert.strictEqual($('.modal').length, 0, "should not have any modal in DOM");
assert.verifySteps(['name_search', 'onchange', 'write', 'read']);
list.destroy();
relationalFields.FieldMany2One.prototype.AUTOCOMPLETE_DELAY = M2O_DELAY;
@@ -2530,15 +2530,15 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_data_row td:contains(first record)').click();
form.$('.o_external_button').click();
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"should have one modal in body");
// Changing the 'trululu' value
- $('[role="dialog"] input[name="display_name"]').val('test').trigger('input');
- $('[role="dialog"] button.btn-primary').click();
+ $('.modal input[name="display_name"]').val('test').trigger('input');
+ $('.modal button.btn-primary').click();
// Test whether the value has changed
- assert.strictEqual($('[role="dialog"]').length, 0,
+ assert.strictEqual($('.modal').length, 0,
"the modal should be closed");
assert.equal(form.$('.o_data_cell:contains(test)').text(), 'test',
"the partner name should have been updated to 'test'");
@@ -3621,7 +3621,7 @@ QUnit.module('relational_fields', {
assert.equal(form.$('.o_field_one2many td[class="o_data_cell"]').text(), "blurp#21#22#23#24#25#26#27#28#29",
"should display the records in order with the changes");
- $('footer.modal-footer button:first').click();
+ $('.modal .modal-footer button:first').click();
assert.equal(form.$('.o_field_one2many td[class="o_data_cell"]').text(), "#20#21#22#23#24#25#26#27#28#29",
"should cancel changes and display the records in order");
@@ -3653,7 +3653,7 @@ QUnit.module('relational_fields', {
assert.equal(form.$('.o_field_one2many td[class="o_data_cell"]').text(), "#20#39#40#41#42#43#44#45#46#47",
"should display the records in order after resequence");
- $('footer.modal-footer button:first').click();
+ $('.modal .modal-footer button:first').click();
assert.equal(form.$('.o_field_one2many td[class="o_data_cell"]').text(), "#20#21#22#23#24#25#26#27#28#29",
"should cancel changes and display the records in order");
@@ -4001,62 +4001,62 @@ QUnit.module('relational_fields', {
// in its relation
form.$('.o_data_row').click();
- assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a dialog");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 0,
+ assert.strictEqual($('.modal').length, 1, "should have opened a dialog");
+ assert.strictEqual($('.modal .o_data_row').length, 0,
"there should be no record in the one2many in the dialog");
// add a many2many subrecord
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
+ $('.modal .o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"]').length, 2,
+ assert.strictEqual($('.modal').length, 2,
"should have opened a second dialog");
// select a many2many subrecord
- $('[role="dialog"]:nth(1) .o_list_view .o_data_cell:first').click();
+ $('.modal:nth(1) .o_list_view .o_data_cell:first').click();
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"second dialog should be closed");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 1,
+ assert.strictEqual($('.modal .o_data_row').length, 1,
"there should be one record in the one2many in the dialog");
- assert.notOk($('[role="dialog"] .o_x2m_control_panel .o_cp_pager div').is(':visible'),
+ assert.notOk($('.modal .o_x2m_control_panel .o_cp_pager div').is(':visible'),
'm2m pager should be hidden');
// click on 'Save & Close'
- $('footer.modal-footer .btn-primary:first').click();
+ $('.modal-footer .btn-primary:first').click();
- assert.strictEqual($('[role="dialog"]').length, 0, "dialog should be closed");
+ assert.strictEqual($('.modal').length, 0, "dialog should be closed");
// reopen o2m record, and another m2m subrecord in its relation, but
// discard the changes
form.$('.o_data_row').click();
- assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a dialog");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 1,
+ assert.strictEqual($('.modal').length, 1, "should have opened a dialog");
+ assert.strictEqual($('.modal .o_data_row').length, 1,
"there should be one record in the one2many in the dialog");
// add another m2m subrecord
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
+ $('.modal .o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"]').length, 2,
+ assert.strictEqual($('.modal').length, 2,
"should have opened a second dialog");
- $('[role="dialog"]:nth(1) .o_list_view .o_data_cell:first').click();
+ $('.modal:nth(1) .o_list_view .o_data_cell:first').click();
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"second dialog should be closed");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 2,
+ assert.strictEqual($('.modal .o_data_row').length, 2,
"there should be two records in the one2many in the dialog");
// click on 'Discard'
- $('footer.modal-footer .btn-default').click();
+ $('.modal-footer .btn-default').click();
- assert.strictEqual($('[role="dialog"]').length, 0, "dialog should be closed");
+ assert.strictEqual($('.modal').length, 0, "dialog should be closed");
// reopen o2m record to check that second changes have properly been discarded
form.$('.o_data_row').click();
- assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a dialog");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 1,
+ assert.strictEqual($('.modal').length, 1, "should have opened a dialog");
+ assert.strictEqual($('.modal .o_data_row').length, 1,
"there should be one record in the one2many in the dialog");
form.destroy();
@@ -4409,8 +4409,8 @@ QUnit.module('relational_fields', {
checkRead = true;
form.$buttons.find('.o_form_button_edit').click();
form.$('.o-kanban-button-new').click();
- $('[role="dialog"] input').val('new record').trigger('input');
- $('footer.modal-footer .btn-primary:first').click(); // save and close
+ $('.modal input').val('new record').trigger('input');
+ $('.modal .modal-footer .btn-primary:first').click(); // save and close
// checks
assert.strictEqual(readIDs, undefined, "should not have read any record");
assert.strictEqual(form.$('span:contains(new record)').length, 0,
@@ -4446,8 +4446,8 @@ QUnit.module('relational_fields', {
readIDs = undefined;
// add and delete a record in page 1
form.$('.o-kanban-button-new').click();
- $('[role="dialog"] input').val('new record page 1').trigger('input');
- $('footer.modal-footer .btn-primary:first').click(); // save and close
+ $('.modal input').val('new record page 1').trigger('input');
+ $('.modal .modal-footer .btn-primary:first').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:first span:contains(relational record 11)').length,
1, 'first record should be the one with id 11 (next checks rely on that)');
form.$('.delete_icon:first').click();
@@ -4461,8 +4461,8 @@ QUnit.module('relational_fields', {
readIDs = undefined;
form.$('.delete_icon:first').click();
form.$('.o-kanban-button-new').click();
- $('[role="dialog"] input').val('new record page 2').trigger('input');
- $('footer.modal-footer .btn-primary:first').click(); // save and close
+ $('.modal input').val('new record page 2').trigger('input');
+ $('.modal .modal-footer .btn-primary:first').click(); // save and close
assert.strictEqual(readIDs, undefined, "should not have read any record");
// checks
assert.strictEqual(form.$('.o_kanban_record:not(".o_kanban_ghost")').length, 5,
@@ -4506,13 +4506,13 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_field_x2many_list_row_add a').click();
$('input[name="turtle_int"]').val('5').trigger('input');
- $('footer.modal-footer button.btn-primary').first().click();
+ $('.modal-footer button.btn-primary').first().click();
assert.strictEqual(form.$('tbody tr:eq(1) td.o_data_cell').text(), '5',
'should display 5 in the foo field');
form.$('tbody tr:eq(1) td.o_data_cell').click();
$('input[name="turtle_int"]').val('3').trigger('input');
- $('footer.modal-footer button.btn-primary').first().click();
+ $('.modal-footer button.btn-primary').first().click();
assert.strictEqual(form.$('tbody tr:eq(1) td.o_data_cell').text(), '3',
'should now display 3 in the foo field');
form.destroy();
@@ -4609,7 +4609,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_cancel').click();
assert.strictEqual(form.$('.o_field_one2many tbody td').first().text(), 'new value',
"changes shouldn't have been discarded yet, waiting for user confirmation");
- $('footer.modal-footer .btn-primary').click();
+ $('.modal .modal-footer .btn-primary').click();
assert.strictEqual(form.$('.o_field_one2many tbody td').first().text(), 'relational record 1',
"display name of first record in o2m list should be 'relational record 1'");
@@ -4808,15 +4808,15 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.oe_kanban_global_click').click();
- $('[role="dialog"] .o_form_view input').val('new name').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save
+ $('.modal .o_form_view input').val('new name').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record span:first').text(), 'new name',
'value of subrecord should have been updated');
// create a new subrecord
form.$('.o-kanban-button-new').click();
- $('[role="dialog"] .o_form_view input').val('new subrecord 1').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save and close
+ $('.modal .o_form_view input').val('new subrecord 1').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 2,
'should contain 2 records');
assert.strictEqual(form.$('.o_kanban_record:nth(1) span').text(), 'new subrecord 1',
@@ -4824,10 +4824,10 @@ QUnit.module('relational_fields', {
// create two new subrecords
form.$('.o-kanban-button-new').click();
- $('[role="dialog"] .o_form_view input').val('new subrecord 2').trigger('input');
- $('footer.modal-footer .btn-primary:nth(1)').click(); // save and new
- $('[role="dialog"] .o_form_view input').val('new subrecord 3').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save and close
+ $('.modal .o_form_view input').val('new subrecord 2').trigger('input');
+ $('.modal .modal-footer .btn-primary:nth(1)').click(); // save and new
+ $('.modal .o_form_view input').val('new subrecord 3').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 4,
'should contain 4 records');
@@ -4993,8 +4993,8 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.o_list_view tbody tr:first() td:eq(1)').click();
- $('[role="dialog"] .o_form_view input').val('new name').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save
+ $('.modal .o_form_view input').val('new name').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
assert.strictEqual(nbWrite, 0, "should not have write anything in DB");
@@ -5040,9 +5040,9 @@ QUnit.module('relational_fields', {
'"Add an item" link should not be available in readonly');
form.$('.o_list_view tbody td:first()').click();
- assert.ok($('[role="dialog"] .o_form_readonly').length,
+ assert.ok($('.modal .o_form_readonly').length,
'in readonly, clicking on a subrecord should open it in readonly in a dialog');
- $('[role="dialog"] .o_form_button_cancel').click(); // close the dialog
+ $('.modal .o_form_button_cancel').click(); // close the dialog
form.$buttons.find('.o_form_button_edit').click();
@@ -5051,7 +5051,7 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.o_list_view tbody td:first()').click();
- assert.strictEqual($('[role="dialog"]').length, 0,
+ assert.strictEqual($('.modal').length, 0,
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
@@ -5149,7 +5149,7 @@ QUnit.module('relational_fields', {
// cancel the edition
form.$buttons.find('.o_form_button_cancel').click();
- $('footer.modal-footer button.btn-primary').first().click();
+ $('.modal-footer button.btn-primary').first().click();
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data rows");
@@ -5305,7 +5305,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_cancel').click();
// confirm the discard operation
- $('footer.modal-footer .btn-primary').click(); // click on confirm
+ $('.modal .modal-footer .btn-primary').click(); // click on confirm
assert.strictEqual(form.$('.o_cp_pager').text().trim(), '1-3 / 4',
"pager should still be visible");
@@ -5380,7 +5380,7 @@ QUnit.module('relational_fields', {
"pager should still display the correct total");
// click on cancel
- $('footer.modal-footer .btn-default').click(); // click on cancel
+ $('.modal .modal-footer .btn-default').click(); // click on cancel
assert.strictEqual(form.$('.o_cp_pager').text().trim(), '1-3 / 4',
"pager should again display the correct total");
@@ -5420,7 +5420,7 @@ QUnit.module('relational_fields', {
// discard
form.$buttons.find('.o_form_button_cancel').click();
- $('footer.modal-footer .btn-primary').click();
+ $('.modal .modal-footer .btn-primary').click();
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data row");
@@ -5467,17 +5467,17 @@ QUnit.module('relational_fields', {
// click elsewhere,
form.$('label.o_form_label').click();
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
'a confirmation model should be opened');
// click on cancel, the line should still be selected
- $('footer.modal-footer button.btn-default').click();
+ $('.modal .modal-footer button.btn-default').click();
assert.strictEqual(form.$('tr.o_data_row.o_selected_row').length, 1,
"should still have 1 selected data row");
// click elsewhere, and click on ok (on the confirmation dialog)
form.$('label.o_form_label').click();
- $('footer.modal-footer button.btn-primary').click();
+ $('.modal .modal-footer button.btn-primary').click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows (invalid line has been discarded");
@@ -5678,17 +5678,17 @@ QUnit.module('relational_fields', {
});
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
+ $('.modal .o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_data_row.o_selected_row').length, 1,
+ assert.strictEqual($('.modal .o_data_row.o_selected_row').length, 1,
"there should be a row in edition in the dialog");
// trigger keydown ESCAPE in the edited row
- $('[role="dialog"] .o_data_cell input').trigger({type: 'keydown', which: $.ui.keyCode.ESCAPE});
+ $('.modal .o_data_cell input').trigger({type: 'keydown', which: $.ui.keyCode.ESCAPE});
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"dialog should still be open");
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 0,
+ assert.strictEqual($('.modal .o_data_row').length, 0,
"the row should have been removed");
form.destroy();
@@ -6293,8 +6293,8 @@ QUnit.module('relational_fields', {
// click to create a subrecord
form.$('tbody td.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] input').val('new record').trigger('input');
- $('footer.modal-footer button:eq(0)').click(); // save and close
+ $('.modal input').val('new record').trigger('input');
+ $('.modal .modal-footer button:eq(0)').click(); // save and close
assert.ok(!form.$('.o_x2m_control_panel .o_cp_pager div').is(':visible'),
'o2m pager should be hidden');
@@ -6349,14 +6349,14 @@ QUnit.module('relational_fields', {
form.$('tbody td.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
- var $dropdown = $('[role="dialog"] .o_field_many2one input').autocomplete('widget');
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
- $('footer.modal-footer button:eq(0)').click(); // save and close
+ $('.modal .modal-footer button:eq(0)').click(); // save and close
assert.strictEqual(form.$('tbody td:contains(xpad)').length, 1,
"should display 'xpad' on a td");
@@ -6408,16 +6408,16 @@ QUnit.module('relational_fields', {
form.$('tbody td.o_field_x2many_list_row_add a').click();
// write in the many2one field, value = 37 (xphone)
- $('[role="dialog"] .o_field_many2one input').click();
- var $dropdown = $('[role="dialog"] .o_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(0) a').mouseenter();
$dropdown.find('li:eq(0) a').click();
// write in the integer field
- $('main.modal-body input.o_field_widget').val('123').trigger('input');
+ $('.modal .modal-body input.o_field_widget').val('123').trigger('input');
// save and close
- $('footer.modal-footer button:eq(0)').click();
+ $('.modal .modal-footer button:eq(0)').click();
assert.strictEqual(form.$('tbody td:contains(xphone)').length, 1,
"should display 'xphone' in a td");
@@ -6425,28 +6425,28 @@ QUnit.module('relational_fields', {
// reopen the record in form view
form.$('tbody td:contains(xphone)').click();
- assert.strictEqual($('main.modal-body input').val(), "xphone",
+ assert.strictEqual($('.modal .modal-body input').val(), "xphone",
"should display 'xphone' in an input");
- $('main.modal-body input.o_field_widget').val('456').trigger('input');
+ $('.modal .modal-body input.o_field_widget').val('456').trigger('input');
// discard
- $('footer.modal-footer span:contains(Discard)').click();
+ $('.modal .modal-footer span:contains(Discard)').click();
// reopen the record in form view
form.$('tbody td:contains(xphone)').click();
- assert.strictEqual($('main.modal-body input.o_field_widget').val(), "123",
+ assert.strictEqual($('.modal .modal-body input.o_field_widget').val(), "123",
"should display 123 (previous change has been discarded)");
// write in the many2one field, value = 41 (xpad)
- $('[role="dialog"] .o_field_many2one input').click();
- $dropdown = $('[role="dialog"] .o_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
// save and close
- $('footer.modal-footer button:eq(0)').click();
+ $('.modal .modal-footer button:eq(0)').click();
assert.strictEqual(form.$('tbody td:contains(xpad)').length, 1,
"should display 'xpad' in a td");
@@ -6496,7 +6496,7 @@ QUnit.module('relational_fields', {
form.$('tr.o_data_row:eq(0) td:contains(xphone)').click();
// write in the many2one field
- $('[role="dialog"] .o_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
form.destroy();
});
@@ -6764,29 +6764,29 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 2,
+ assert.strictEqual($('.modal .o_data_row').length, 2,
"sould have 2 records in the select view (the last one is not displayed because it is already selected)");
- $('[role="dialog"] .o_data_row:first .o_list_record_selector input').click();
- $('[role="dialog"] .o_select_button').click();
+ $('.modal .o_data_row:first .o_list_record_selector input').click();
+ $('.modal .o_select_button').click();
$('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 1,
+ assert.strictEqual($('.modal .o_data_row').length, 1,
"sould have 1 record in the select view");
- $('footer.modal-footer button:eq(1)').click();
- $('[role="dialog"] input.o_field_widget[name="turtle_foo"]').val('tototo').trigger('input');
- $('[role="dialog"] input.o_field_widget[name="turtle_int"]').val(50).trigger('input');
- var $many2one = $('[role="dialog"] [name="product_id"] input').click();
+ $('.modal-footer button:eq(1)').click();
+ $('.modal input.o_field_widget[name="turtle_foo"]').val('tototo').trigger('input');
+ $('.modal input.o_field_widget[name="turtle_int"]').val(50).trigger('input');
+ var $many2one = $('.modal [name="product_id"] input').click();
var $dropdown = $many2one.autocomplete('widget');
$dropdown.find('li:first a').mouseenter();
$dropdown.find('li:first a').click();
- $('footer.modal-footer button:contains(&):first').click();
+ $('.modal-footer button:contains(&):first').click();
- assert.strictEqual($('[role="dialog"]').length, 0, "sould close the modals");
+ assert.strictEqual($('.modal').length, 0, "sould close the modals");
assert.strictEqual(form.$('.o_data_row').length, 3,
"sould have 3 records in one2many list");
@@ -6844,34 +6844,34 @@ QUnit.module('relational_fields', {
});
form.$('.o_data_row:first').click();
- assert.strictEqual($('[role="dialog"] .modal-title').first().text().trim(), 'Open: one2many turtle field',
+ assert.strictEqual($('.modal .modal-title').first().text().trim(), 'Open: one2many turtle field',
"modal should use the python field string as title");
- $('[role="dialog"] .o_form_button_cancel').click();
+ $('.modal .o_form_button_cancel').click();
form.$buttons.find('.o_form_button_edit').click();
// edit the first one2many record
form.$('.o_data_row:first').click();
- var $many2one = $('[role="dialog"] [name="product_id"] input').click();
+ var $many2one = $('.modal [name="product_id"] input').click();
var $dropdown = $many2one.autocomplete('widget');
$dropdown.find('li:first a').mouseenter();
$dropdown.find('li:first a').click();
- $('footer.modal-footer button:first').click();
+ $('.modal-footer button:first').click();
$('.o_form_button_save').click(); // don't save anything because the one2many does not change
// add a one2many record
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_data_row:first .o_list_record_selector input').click();
- $('[role="dialog"] .o_select_button').click();
+ $('.modal .o_data_row:first .o_list_record_selector input').click();
+ $('.modal .o_select_button').click();
// edit the second one2many record
form.$('.o_data_row:eq(1)').click();
- $many2one = $('[role="dialog"] [name="product_id"] input').click();
+ $many2one = $('.modal [name="product_id"] input').click();
$dropdown = $many2one.autocomplete('widget');
$dropdown.find('li:first a').mouseenter();
$dropdown.find('li:first a').click();
- $('footer.modal-footer button:first').click();
+ $('.modal-footer button:first').click();
$('.o_form_button_save').click();
@@ -7063,10 +7063,10 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('tbody td.o_field_x2many_list_row_add a').click();
- $('footer.modal-footer button.btn-primary').first().click();
+ $('.modal-footer button.btn-primary').first().click();
- assert.strictEqual($('[role="dialog"]').length, 1, "should still have an open modal");
- assert.strictEqual($('[role="dialog"] tbody label.o_field_invalid').length, 1,
+ assert.strictEqual($('.modal').length, 1, "should still have an open modal");
+ assert.strictEqual($('.modal tbody label.o_field_invalid').length, 1,
"should have displayed invalid fields");
form.destroy();
});
@@ -7262,9 +7262,9 @@ QUnit.module('relational_fields', {
});
form.$('.o_field_one2many .o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"]').length, 1, "form view dialog should be opened");
- $('main.modal-body input[name="model_name"]').val('partner').trigger('input');
- $('footer.modal-footer button:first').click();
+ assert.strictEqual($('.modal').length, 1, "form view dialog should be opened");
+ $('.modal-body input[name="model_name"]').val('partner').trigger('input');
+ $('.modal-footer button:first').click();
assert.strictEqual(form.$('.o_field_one2many tbody tr:first').text(), "coucouhas changed[]",
"the onchange should create one new record and remove the existing");
@@ -7363,9 +7363,9 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('[role="dialog"] .o_field_widget').text(), "xphone",
+ assert.strictEqual($('.modal .o_field_widget').text(), "xphone",
'should display the form view dialog with the many2one value');
- $('footer.modal-footer button').click(); // close the modal
+ $('.modal-footer button').click(); // close the modal
form.$buttons.find('.o_form_button_edit').click();
@@ -7619,7 +7619,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('[role="dialog"] .o_field_widget[name="partner_ids"] .o_list_view').length, 1,
+ assert.strictEqual($('.modal .o_field_widget[name="partner_ids"] .o_list_view').length, 1,
'should display many2many list view in the modal');
form.destroy();
@@ -7651,7 +7651,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('[role="dialog"] .o_field_widget[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -7700,14 +7700,14 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click(); // edit first record
- var $input = $('[role="dialog"] .o_field_many2manytags input');
+ var $input = $('.modal .o_field_many2manytags input');
$input.click(); // opens the dropdown
$input.autocomplete('widget').find('li').click(); // add 'first record'
// add a many2many tag and save
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_field_widget[name=name]').val('test').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save
+ $('.modal .o_field_x2many_list_row_add a').click();
+ $('.modal .o_field_widget[name=name]').val('test').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save
form.$buttons.find('.o_form_button_save').click();
@@ -7761,13 +7761,13 @@ QUnit.module('relational_fields', {
form.$('.o_external_button').click();
// click on add, to add a new partner in the m2m
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
+ $('.modal .o_field_x2many_list_row_add a').click();
// select the partner_type 'gold' (this closes the 2nd modal)
- $('[role="dialog"] td:contains(gold)').click();
+ $('.modal td:contains(gold)').click();
// confirm the changes in the modal
- $('footer.modal-footer .btn-primary').click();
+ $('.modal .modal-footer .btn-primary').click();
form.$buttons.find('.o_form_button_save').click();
form.destroy();
@@ -7836,7 +7836,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('[role="dialog"] .o_field_widget[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -8331,7 +8331,7 @@ QUnit.module('relational_fields', {
// try to add a second line and check that it is correctly waiting
// for the onchange to return
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"]').length, 0, "no modal should be displayed");
+ assert.strictEqual($('.modal').length, 0, "no modal should be displayed");
assert.strictEqual($('.o_field_invalid').length, 0,
"no field should be marked as invalid");
assert.strictEqual(form.$('.o_data_row').length, 1,
@@ -8635,11 +8635,11 @@ QUnit.module('relational_fields', {
form.$('.o_data_row td:first').click(); // open the record
- assert.strictEqual($('[role="dialog"] .o_field_many2manytags[name="timmy"]').length, 1,
+ assert.strictEqual($('.modal .o_field_many2manytags[name="timmy"]').length, 1,
"timmy should be displayed in the form view");
- assert.strictEqual($('[role="dialog"] .o_field_many2manytags[name="timmy"] .badge').length, 1,
+ assert.strictEqual($('.modal .o_field_many2manytags[name="timmy"] .badge').length, 1,
"m2mtags should contain one tag");
- assert.strictEqual($('[role="dialog"] .o_field_many2manytags[name="timmy"] .o_badge_text').text(),
+ assert.strictEqual($('.modal .o_field_many2manytags[name="timmy"] .o_badge_text').text(),
'gold', "tag name should have been correctly loaded");
form.destroy();
@@ -8715,10 +8715,10 @@ QUnit.module('relational_fields', {
});
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_data_cell input').val('new record').trigger('input');
+ $('.modal .o_field_x2many_list_row_add a').click();
+ $('.modal .o_data_cell input').val('new record').trigger('input');
checkOnchange = true;
- $('footer.modal-footer .btn-primary').click(); // save (should trigger the onchange)
+ $('.modal .modal-footer .btn-primary').click(); // save (should trigger the onchange)
form.destroy();
});
@@ -9039,7 +9039,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row.o_selected_row').length, 1,
"line should not have been removed and should still be in edition");
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"a confirmation dialog should be opened");
assert.ok(form.$('.o_field_widget[name=int_field]').hasClass('o_field_invalid'),
"should indicate that int_field is invalid");
@@ -9237,9 +9237,9 @@ QUnit.module('relational_fields', {
// open the new subrecord to check the value of the nested o2m, and to
// ensure that it will be saved
form.$('.o_data_cell:first').click();
- assert.strictEqual($('[role="dialog"] .o_data_cell').text(), 'test nested',
+ assert.strictEqual($('.modal .o_data_cell').text(), 'test nested',
"should have added the new row to the nested one2many");
- $('footer.modal-footer .btn-primary').click();
+ $('.modal .modal-footer .btn-primary').click();
form.$buttons.find('.o_form_button_save').click();
@@ -9770,26 +9770,26 @@ QUnit.module('relational_fields', {
// add a new record
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_field_widget').val('new record').trigger('input');
- $('footer.modal-footer .btn-primary:first').click(); // Save & Close
+ $('.modal .o_field_widget').val('new record').trigger('input');
+ $('.modal .modal-footer .btn-primary:first').click(); // Save & Close
assert.strictEqual(form.$('.o_data_row .o_data_cell').text(), 'new record',
"should display the new record");
// reopen freshly added record and edit it
form.$('.o_data_row .o_data_cell').click();
- $('[role="dialog"] .o_field_widget').val('new record edited').trigger('input');
+ $('.modal .o_field_widget').val('new record edited').trigger('input');
// save it, and choose to directly create another record
- $('footer.modal-footer .btn-primary:nth(1)').click(); // Save & New
+ $('.modal .modal-footer .btn-primary:nth(1)').click(); // Save & New
- assert.strictEqual($('[role="dialog"]').length, 1,
+ assert.strictEqual($('.modal').length, 1,
"the model should still be open");
- assert.strictEqual($('[role="dialog"] .o_field_widget').text(), '',
+ assert.strictEqual($('.modal .o_field_widget').text(), '',
"should have cleared the input");
- $('[role="dialog"] .o_field_widget').val('another new record').trigger('input');
- $('footer.modal-footer .btn-primary:first').click(); // Save & Close
+ $('.modal .o_field_widget').val('another new record').trigger('input');
+ $('.modal .modal-footer .btn-primary:first').click(); // Save & Close
assert.strictEqual(form.$('.o_data_row .o_data_cell').text(),
'new record editedanother new record', "should display the two records");
@@ -10043,19 +10043,19 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.oe_kanban_global_click:first()').click();
- $('[role="dialog"] .o_form_view input').val('new name').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save
+ $('.modal .o_form_view input').val('new name').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record:first() span').text(), 'new name',
'value of subrecord should have been updated');
// add subrecords
// -> single select
form.$('.o_field_many2many .o-kanban-button-new').click();
- assert.ok($('[role="dialog"] .o_list_view').length, "should have opened a list view in a modal");
- assert.strictEqual($('[role="dialog"] .o_list_view tbody .o_list_record_selector').length, 3,
+ assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
+ assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 3,
"list view should contain 3 records");
- $('[role="dialog"] .o_list_view tbody tr:contains(red)').click(); // select red
- assert.ok(!$('[role="dialog"] .o_list_view').length, "should have closed the modal");
+ $('.modal .o_list_view tbody tr:contains(red)').click(); // select red
+ assert.ok(!$('.modal .o_list_view').length, "should have closed the modal");
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 3,
'kanban should now contain 3 records');
assert.ok(form.$('.o_kanban_record:contains(red)').length,
@@ -10063,23 +10063,23 @@ QUnit.module('relational_fields', {
// -> multiple select
form.$('.o_field_many2many .o-kanban-button-new').click();
- assert.ok($('[role="dialog"] .o_select_button').prop('disabled'), "select button should be disabled");
- assert.strictEqual($('[role="dialog"] .o_list_view tbody .o_list_record_selector').length, 2,
+ assert.ok($('.modal .o_select_button').prop('disabled'), "select button should be disabled");
+ assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 2,
"list view should contain 2 records");
- $('[role="dialog"] .o_list_view thead .o_list_record_selector input').click(); // select all
- $('[role="dialog"] .o_select_button').click(); // validate selection
- assert.ok(!$('[role="dialog"] .o_select_button').prop('disabled'), "select button should be enabled");
- assert.ok(!$('[role="dialog"] .o_list_view').length, "should have closed the modal");
+ $('.modal .o_list_view thead .o_list_record_selector input').click(); // select all
+ $('.modal .o_select_button').click(); // validate selection
+ assert.ok(!$('.modal .o_select_button').prop('disabled'), "select button should be enabled");
+ assert.ok(!$('.modal .o_list_view').length, "should have closed the modal");
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 5,
'kanban should now contain 5 records');
// -> created record
form.$('.o_field_many2many .o-kanban-button-new').click();
- $('footer.modal-footer .btn-primary:nth(1)').click(); // click on 'Create'
- assert.ok($('[role="dialog"] .o_form_view.o_form_editable').length,
+ $('.modal .modal-footer .btn-primary:nth(1)').click(); // click on 'Create'
+ assert.ok($('.modal .o_form_view.o_form_editable').length,
"should have opened a form view in edit mode, in a modal");
- $('[role="dialog"] .o_form_view input').val('A new type').trigger('input');
- $('[role="dialog"]:nth(1) footer .btn-primary:first()').click(); // click on 'Save & Close'
- assert.ok(!$('[role="dialog"]').length, "should have closed both modals");
+ $('.modal .o_form_view input').val('A new type').trigger('input');
+ $('.modal:nth(1) footer .btn-primary:first()').click(); // click on 'Save & Close'
+ assert.ok(!$('.modal').length, "should have closed both modals");
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 6,
'kanban should now contain 6 records');
assert.ok(form.$('.o_kanban_record:contains(A new type)').length,
@@ -10174,7 +10174,7 @@ QUnit.module('relational_fields', {
'delete icon should be visible in edit');
form.$('.o-kanban-button-new').click(); // click on 'Add'
- assert.strictEqual($('footer.modal-footer .btn-primary').length, 1, // only button 'Select'
+ assert.strictEqual($('.modal .modal-footer .btn-primary').length, 1, // only button 'Select'
'"Create" button should not be available in the modal');
form.destroy();
@@ -10237,19 +10237,19 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.o_list_view tbody tr:first()').click();
- $('[role="dialog"] .o_form_view input').val('new name').trigger('input');
- $('footer.modal-footer .btn-primary').click(); // save
+ $('.modal .o_form_view input').val('new name').trigger('input');
+ $('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
// add new subrecords
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_list_view').length, 1,
+ assert.strictEqual($('.modal .o_list_view').length, 1,
"a modal should be open");
- assert.strictEqual($('[role="dialog"] .o_list_view .o_data_row').length, 1,
+ assert.strictEqual($('.modal .o_list_view .o_data_row').length, 1,
"the list should contain one row");
- $('[role="dialog"] .o_list_view .o_data_row').click(); // select a record
- assert.strictEqual($('[role="dialog"] .o_list_view').length, 0,
+ $('.modal .o_list_view .o_data_row').click(); // select a record
+ assert.strictEqual($('.modal .o_list_view').length, 0,
"the modal should be closed");
assert.strictEqual(form.$('.o_list_view td.o_list_number').length, 3,
'should contain 3 subrecords');
@@ -10340,7 +10340,7 @@ QUnit.module('relational_fields', {
// edit existing subrecord
form.$('.o_list_view tbody td:first()').click();
- assert.ok(!$('[role="dialog"]').length,
+ assert.ok(!$('.modal').length,
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
@@ -10358,12 +10358,12 @@ QUnit.module('relational_fields', {
// add new subrecords
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_list_view').length, 1,
+ assert.strictEqual($('.modal .o_list_view').length, 1,
"a modal should be open");
- assert.strictEqual($('[role="dialog"] .o_list_view .o_data_row').length, 1,
+ assert.strictEqual($('.modal .o_list_view .o_data_row').length, 1,
"the list should contain one row");
- $('[role="dialog"] .o_list_view .o_data_row').click(); // select a record
- assert.strictEqual($('[role="dialog"] .o_list_view').length, 0,
+ $('.modal .o_list_view .o_data_row').click(); // select a record
+ assert.strictEqual($('.modal .o_list_view').length, 0,
"the modal should be closed");
assert.strictEqual(form.$('.o_list_view td.o_list_number').length, 3,
'should contain 3 subrecords');
@@ -10630,7 +10630,7 @@ QUnit.module('relational_fields', {
});
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_data_row:first').click(); // add a first record to the relation
+ $('.modal .o_data_row:first').click(); // add a first record to the relation
assert.strictEqual(form.$('.o_data_row').length, 1,
"the record should have been added to the relation");
@@ -10638,7 +10638,7 @@ QUnit.module('relational_fields', {
"inner m2m should have been fetched and correctly displayed");
form.$('.o_field_x2many_list_row_add a').click();
- $('[role="dialog"] .o_data_row:first').click(); // add a second record to the relation
+ $('.modal .o_data_row:first').click(); // add a second record to the relation
assert.strictEqual(form.$('.o_data_row').length, 2,
"the second record should have been added to the relation");
@@ -10691,13 +10691,13 @@ QUnit.module('relational_fields', {
});
form.$('.o_field_x2many_list_row_add a').click();
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 1,
+ assert.strictEqual($('.modal .o_data_row').length, 1,
"should contain only one row (gold)");
- $('[role="dialog"] .o_searchview_input').trigger({type: 'keypress', which: 115}); // s
- $('[role="dialog"] .o_searchview_input').trigger({type: 'keydown', which: 13}); // enter
+ $('.modal .o_searchview_input').trigger({type: 'keypress', which: 115}); // s
+ $('.modal .o_searchview_input').trigger({type: 'keydown', which: 13}); // enter
- assert.strictEqual($('[role="dialog"] .o_data_row').length, 0, "should contain no row");
+ assert.strictEqual($('.modal .o_data_row').length, 0, "should contain no row");
form.destroy();
});
@@ -10731,8 +10731,8 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('td.o_data_cell:first').click();
- $('main.modal-body input[type="checkbox"]').click();
- $('footer.modal-footer .btn-primary').first().click();
+ $('.modal-body input[type="checkbox"]').click();
+ $('.modal .modal-footer .btn-primary').first().click();
// there is nothing left to save -> should not do a 'write' RPC
form.$buttons.find('.o_form_button_save').click();
@@ -11718,14 +11718,14 @@ QUnit.module('relational_fields', {
form.$('.o_field_many2one input').click();
$dropdown.find('.o_m2o_dropdown_option:contains(Search)').mouseenter().click(); // Open Search More
- $('[role="dialog"] .o_search_options .fa-bars').click();
- $('[role="dialog"] .o_search_options .o_group_by_menu a:contains(Bar)').click(); // group by 'Bar'
+ $('.modal .o_search_options .fa-bars').click();
+ $('.modal .o_search_options .o_group_by_menu a:contains(Bar)').click(); // group by 'Bar'
- $('[role="dialog"] .o_group_header:first').click();
- assert.strictEqual($('[role="dialog"] tbody:nth(1) .o_data_row').length, 7,
+ $('.modal .o_group_header:first').click();
+ assert.strictEqual($('.modal tbody:nth(1) .o_data_row').length, 7,
"should display 7 records in the first page");
- $('[role="dialog"] .o_group_header:first .o_pager_next').click();
- assert.strictEqual($('[role="dialog"] tbody:nth(1) .o_data_row').length, 1,
+ $('.modal .o_group_header:first .o_pager_next').click();
+ assert.strictEqual($('.modal tbody:nth(1) .o_data_row').length, 1,
"should display 1 record in the second page");
form.destroy();
@@ -12282,8 +12282,8 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_field_x2many_list_row_add a').click();
- var $dropdown = $('[role="dialog"] .o_field_many2one input').autocomplete('widget');
- $('[role="dialog"] input').val('new record').trigger('keydown');
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
+ $('.modal input').val('new record').trigger('keydown');
concurrency.delay(0).then(function () {
$dropdown.find('li:first()').click(); // quick create 'new record'
assert.verifySteps(['name_create']);
@@ -12463,9 +12463,9 @@ QUnit.module('relational_fields', {
form.$('.o_external_button').click(); // click on the external button (should do an RPC)
- assert.strictEqual($('[role="dialog"] .modal-title').text().trim(), 'Open: custom label',
+ assert.strictEqual($('.modal .modal-title').text().trim(), 'Open: custom label',
"dialog title should display the custom string label");
- $('[role="dialog"] .o_form_button_cancel').click();
+ $('.modal .o_form_button_cancel').click();
form.$('.o_field_widget select').val('partner_type').trigger('change');
assert.strictEqual(form.$('.o_field_widget input').val(), "",