diff options
60 files changed, 628 insertions, 642 deletions
diff --git a/addons/account/static/tests/reconciliation_tests.js b/addons/account/static/tests/reconciliation_tests.js index cf149648b1a..7ebffc19e94 100644 --- a/addons/account/static/tests/reconciliation_tests.js +++ b/addons/account/static/tests/reconciliation_tests.js @@ -941,11 +941,11 @@ QUnit.module('account', { // Simulate changing partner with SelectCreateDialog widget = clientAction.widgets[1]; - assert.strictEqual($('[role="dialog"]').length, 0, "shouldn't have any opened modal"); + assert.strictEqual($('.modal').length, 0, "shouldn't have any opened modal"); widget.$('.o_input_dropdown input').trigger('click'); $('.ui-autocomplete .ui-menu-item a:contains(Search More):eq(1)').trigger('mouseenter').trigger('click'); - assert.strictEqual($('[role="dialog"]').length, 1, "should open a SelectCreateDialog"); - $('[role="dialog"] table.o_list_view td:contains(Camptocamp)').click(); + assert.strictEqual($('.modal').length, 1, "should open a SelectCreateDialog"); + $('.modal table.o_list_view td:contains(Camptocamp)').click(); assert.strictEqual(widget.$('.o_input_dropdown input').val(), "Camptocamp", "the partner many2one should display Camptocamp"); widget = clientAction.widgets[2]; @@ -1100,7 +1100,7 @@ QUnit.module('account', { widget.$('.create .create_account_id input').trigger('click'); $('.ui-autocomplete .ui-menu-item a:contains(Search)').trigger('mouseenter').trigger('click'); // select the account who does not appear in the drop drown - $('[role="dialog"] tr.o_data_row:contains(502)').click(); + $('.modal tr.o_data_row:contains(502)').click(); assert.strictEqual(widget.$('.create .create_account_id input').val(), "101200 Account Receivable", "Selected account does not change"); // wait the name_get to render the changes def.resolve(); diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js index 9a09480558b..15e27498f94 100644 --- a/addons/barcodes/static/src/js/barcode_form_view.js +++ b/addons/barcodes/static/src/js/barcode_form_view.js @@ -349,7 +349,7 @@ FormController.include({ } // only catch the event if we're not focused in // another field and it's a number - if (!$(event.target).is('body, [role="dialog"]') || !/[0-9]/.test(character)) { + if (!$(event.target).is('body, .modal') || !/[0-9]/.test(character)) { return; } diff --git a/addons/barcodes/static/tests/barcode_tests.js b/addons/barcodes/static/tests/barcode_tests.js index e6efcbe35a0..142fc0feca3 100644 --- a/addons/barcodes/static/tests/barcode_tests.js +++ b/addons/barcodes/static/tests/barcode_tests.js @@ -468,12 +468,12 @@ QUnit.test('specification of widget barcode_handler with keypress and notifyChan setTimeout(function () { var keycode = $.ui.keyCode.ENTER; - assert.strictEqual($('main.modal-body').length, 1, 'should open a modal with a quantity as input'); - assert.strictEqual($('main.modal-body .o_set_qty_input').val(), '5', 'the quantity by default in the modal shoud be 5'); + assert.strictEqual($('.modal .modal-body').length, 1, 'should open a modal with a quantity as input'); + assert.strictEqual($('.modal .modal-body .o_set_qty_input').val(), '5', 'the quantity by default in the modal shoud be 5'); - $('main.modal-body .o_set_qty_input').val('7'); + $('.modal .modal-body .o_set_qty_input').val('7'); - $('main.modal-body .o_set_qty_input').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); + $('.modal .modal-body .o_set_qty_input').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); assert.strictEqual(form.$('.o_data_row .o_data_cell:nth(1)').text(), '7', "quantity checked should be 7"); @@ -524,7 +524,7 @@ QUnit.test('barcode_scanned only trigger error for active view', function (asser form.$('.o_data_row:first').click(); - // We do not trigger on the body since modal and + // We do not trigger on the body since modal and // form view are both inside it. function modalTriggerKeypressEvent(char) { var keycode; @@ -533,7 +533,7 @@ QUnit.test('barcode_scanned only trigger error for active view', function (asser } else { keycode = char.charCodeAt(0); } - return $('[role="dialog"]').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); + return $('.modal').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); } _.each(['O','-','B','T','N','.','c','a','n','c','e','l','Enter'], modalTriggerKeypressEvent); assert.verifySteps(['warning'], "only one event should be triggered"); diff --git a/addons/base_setup/views/res_config_settings_views.xml b/addons/base_setup/views/res_config_settings_views.xml index 82bfe8b4dca..53badf36843 100644 --- a/addons/base_setup/views/res_config_settings_views.xml +++ b/addons/base_setup/views/res_config_settings_views.xml @@ -120,8 +120,11 @@ </div> <div class="o_setting_right_pane"> <label string="Inter Company Flows" for="module_inter_company_rules"/> - <div class="fa fa-lg fa-building-o text-muted"> - the creation of documents between your companies + <div> + <i class="fa fa-lg fa-building-o"/> + <span class="text-muted"> + the creation of documents between your companies + </span> </div> <div class="content-group" attrs="{'invisible': [('module_inter_company_rules','=',False)]}" id="inter_companies_rules"> <div class="mt16 text-warning"><strong>Save</strong> this page and come back here to set up the feature.</div> diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 15b08aaf544..9afb88e5648 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -161,17 +161,17 @@ QUnit.test('basic functionality, with one sub action', function (assert) { assert.ok(form.$('.oe_content').is(':visible'), "content is visible again"); assert.verifySteps(['load action', 'edit custom', 'edit custom']); - assert.strictEqual($('[role="dialog"]').length, 0, "should have no modal open"); + assert.strictEqual($('.modal').length, 0, "should have no modal open"); form.$('button.oe_dashboard_link_change_layout').click(); - assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a modal"); - assert.strictEqual($('[role="dialog"] li[data-layout="2-1"] i.oe_dashboard_selected_layout').length, 1, + assert.strictEqual($('.modal').length, 1, "should have opened a modal"); + assert.strictEqual($('.modal li[data-layout="2-1"] i.oe_dashboard_selected_layout').length, 1, "should mark currently selected layout"); - $('[role="dialog"] .oe_dashboard_layout_selector li[data-layout="1-1"]').click(); + $('.modal .oe_dashboard_layout_selector li[data-layout="1-1"]').click(); - assert.strictEqual($('[role="dialog"]').length, 0, "should have no modal open"); + assert.strictEqual($('.modal').length, 0, "should have no modal open"); assert.strictEqual(form.$('table.oe_dashboard[data-layout="1-1"]').length, 1, "should have rendered a table with correct layout"); @@ -179,12 +179,12 @@ QUnit.test('basic functionality, with one sub action', function (assert) { assert.strictEqual(form.$('.oe_action').length, 1, "should have one displayed action"); form.$('span.oe_close').click(); - assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a modal"); + assert.strictEqual($('.modal').length, 1, "should have opened a modal"); // confirm the close operation - $('[role="dialog"] button.btn-primary').click(); + $('.modal button.btn-primary').click(); - assert.strictEqual($('[role="dialog"]').length, 0, "should have no modal open"); + assert.strictEqual($('.modal').length, 0, "should have no modal open"); assert.strictEqual(form.$('.oe_action').length, 0, "should have no displayed action"); assert.verifySteps(['load action', 'edit custom', 'edit custom', 'edit custom', 'edit custom']); diff --git a/addons/crm/static/src/js/tour.js b/addons/crm/static/src/js/tour.js index daf550378f5..b7983fe56e0 100644 --- a/addons/crm/static/src/js/tour.js +++ b/addons/crm/static/src/js/tour.js @@ -41,12 +41,12 @@ tour.register('crm_tour', { content: _t("Let's schedule an activity."), position: "bottom" }, { - trigger: 'main.modal-body .o_field_many2one', + trigger: '.modal-body .o_field_many2one', extra_trigger: ".o_opportunity_kanban", content: _t("<p>You will be able to customize your followup activities. Examples:</p><ol><li>introductory email</li><li>call 10 days after</li><li>second call 3 days after, ...</li></ol><p class='mb0'><i>Select a standard activity for now.</i></p>"), position: "bottom", run: function (actions) { - actions.auto('footer.modal-footer button[special=cancel]'); + actions.auto('.modal-footer button[special=cancel]'); }, }, { trigger: ".o_kanban_record", diff --git a/addons/document/static/tests/document_tests.js b/addons/document/static/tests/document_tests.js index 111beeca841..338f3e75581 100644 --- a/addons/document/static/tests/document_tests.js +++ b/addons/document/static/tests/document_tests.js @@ -70,7 +70,7 @@ odoo.define('document.tests', function (require) { assert.strictEqual(form.sidebar.$('.o_sidebar_delete_attachment').length, 2, "there should be two attachments"); form.sidebar.$('.o_sidebar_delete_attachment:eq(0)').click(); - $('footer.modal-footer .btn-primary').click(); + $('.modal-footer .btn-primary').click(); assert.strictEqual(form.sidebar.$('.o_sidebar_delete_attachment').length, 1, "there should be only one attachment"); form.destroy(); }); diff --git a/addons/im_livechat/static/src/xml/im_livechat_backend.xml b/addons/im_livechat/static/src/xml/im_livechat_backend.xml index 60b25bf2746..deb4c6be4de 100644 --- a/addons/im_livechat/static/src/xml/im_livechat_backend.xml +++ b/addons/im_livechat/static/src/xml/im_livechat_backend.xml @@ -17,7 +17,8 @@ <t t-extend="mail.discuss_mobile"> <t t-jquery=".o_mail_mobile_tabs" t-operation="append"> <div class="o_mail_mobile_tab" data-type="livechat"> - <span class="fa fa-comments o_tab_title">Livechat</span> + <span class="fa fa-comments"/> + <span class="o_tab_title">Livechat</span> </div> </t> </t> diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index b5882e3b51e..89b943700dd 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -686,7 +686,7 @@ QUnit.test('chatter: discard changes on message post with post_refresh "always"' var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body p').text(), + assert.strictEqual($modal.find('.modal-body').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost"); @@ -862,7 +862,7 @@ QUnit.test('chatter: discard changes on message post with post_refresh "recipien var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body p').text(), + assert.strictEqual($modal.find('.modal-body').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost"); @@ -915,7 +915,7 @@ QUnit.test('chatter: discard changes on opening full-composer', function (assert var $modal = $('.modal-dialog'); assert.strictEqual($modal.length, 1, "should have a modal opened"); - assert.strictEqual($modal.find('.modal-body p').text(), + assert.strictEqual($modal.find('.modal-body').text(), "The record has been modified, your changes will be discarded. Do you want to proceed?", "should warn the user that any unsaved changes will be lost"); @@ -994,7 +994,7 @@ QUnit.test('chatter: Attachment viewer', function (assert) { assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/1?unique=1"]').length, 1, "Modal popup should open with first image src"); // click on next button - $('[role="dialog"] .arrow.arrow-right.move_next span').click(); + $('.modal .arrow.arrow-right.move_next span').click(); assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/2?unique=1"]').length, 1, "Modal popup should have now second image src"); assert.strictEqual($('.o_modal_fullscreen .o_viewer_toolbar .o_download_btn').length, 1, @@ -1467,8 +1467,8 @@ QUnit.test('followers widget: follow/unfollow, edit subtypes', function (assert) // click to unfollow form.$('.o_followers_follow_button').click(); // click to open the dropdown - assert.ok($('[role="dialog"]').length, 'a confirm modal should be opened'); - $('footer.modal-footer .btn-primary').click(); // click on 'OK' + assert.ok($('.modal').length, 'a confirm modal should be opened'); + $('.modal .modal-footer .btn-primary').click(); // click on 'OK' assert.strictEqual(form.$('.o_followers_count').text(), "0", 'should have no followers'); assert.ok(form.$('.o_followers_follow_button.o_followers_notfollow').length, 'should display the "Follow" button'); @@ -1672,16 +1672,16 @@ QUnit.test('fieldmany2many tags email', function (assert) { done(); }); - assert.strictEqual($('main.modal-body.o_act_window').length, 1, + assert.strictEqual($('.modal-body.o_act_window').length, 1, "there should be one modal opened to edit the empty email"); - assert.strictEqual($('main.modal-body input[name="display_name"]').val(), "silver", + assert.strictEqual($('.modal-body.o_act_window input[name="display_name"]').val(), "silver", "the opened modal should be a form view dialog with the partner_type 14"); - assert.strictEqual($('main.modal-body input[name="email"]').length, 1, + assert.strictEqual($('.modal-body.o_act_window input[name="email"]').length, 1, "there should be an email field in the modal"); // set the email and save the modal (will render the form view) - $('main.modal-body input[name="email"]').val('coucou@petite.perruche').trigger('input'); - $('footer.modal-footer .btn-primary').click(); + $('.modal-body.o_act_window input[name="email"]').val('coucou@petite.perruche').trigger('input'); + $('.modal-footer .btn-primary').click(); }); QUnit.test('fieldmany2many tags email (edition)', function (assert) { @@ -1724,16 +1724,16 @@ QUnit.test('fieldmany2many tags email (edition)', function (assert) { $input.click(); // opens the dropdown $input.autocomplete('widget').find('li:first').click(); // add 'silver' - assert.strictEqual($('main.modal-body.o_act_window').length, 1, + assert.strictEqual($('.modal-body.o_act_window').length, 1, "there should be one modal opened to edit the empty email"); - assert.strictEqual($('main.modal-body input[name="display_name"]').val(), "silver", + assert.strictEqual($('.modal-body.o_act_window input[name="display_name"]').val(), "silver", "the opened modal in edit mode should be a form view dialog with the partner_type 14"); - assert.strictEqual($('main.modal-body input[name="email"]').length, 1, + assert.strictEqual($('.modal-body.o_act_window input[name="email"]').length, 1, "there should be an email field in the modal"); // set the email and save the modal (will rerender the form view) - $('main.modal-body input[name="email"]').val('coucou@petite.perruche').trigger('input'); - $('footer.modal-footer .btn-primary').click(); + $('.modal-body.o_act_window input[name="email"]').val('coucou@petite.perruche').trigger('input'); + $('.modal-footer .btn-primary').click(); assert.strictEqual(form.$('.o_field_many2manytags[name="timmy"] button.o_tag_color_0').length, 2, "should contain the second tag"); diff --git a/addons/pad/static/tests/pad_tests.js b/addons/pad/static/tests/pad_tests.js index a6b885429a7..f2ab3a42dfa 100644 --- a/addons/pad/static/tests/pad_tests.js +++ b/addons/pad/static/tests/pad_tests.js @@ -184,7 +184,7 @@ QUnit.module('pad widget', { }); var def = form.canBeDiscarded(); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, "should have no confirmation modal opened"); assert.strictEqual(def.state(), 'resolved', @@ -221,7 +221,7 @@ QUnit.module('pad widget', { form.$buttons.find('.o_form_button_edit').click(); var def = form.canBeDiscarded(); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, "should have no confirmation modal opened"); assert.strictEqual(def.state(), 'resolved', diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 12c01733bfd..75c0aecdcac 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -334,7 +334,7 @@ <t t-if='partner.id'> <img t-att-src='widget.partner_icon_url(partner.id)' alt="Partner"/> </t> - <input type='file' class='image-uploader'></input> + <input type='file' class='image-uploader'></input> </div> <input class='detail client-name' name='name' t-att-value='partner.name' placeholder='Name'></input> <div class='edit-buttons'> @@ -360,7 +360,7 @@ <select class='detail client-address-country needsclick' name='country_id'> <option value=''>None</option> <t t-foreach='widget.pos.countries' t-as='country'> - <option t-att-value='country.id' t-att-selected="partner.country_id ? ((country.id === partner.country_id[0]) ? true : undefined) : undefined"> + <option t-att-value='country.id' t-att-selected="partner.country_id ? ((country.id === partner.country_id[0]) ? true : undefined) : undefined"> <t t-esc='country.name'/> </option> </t> @@ -389,7 +389,7 @@ <select class='detail needsclick' name='property_product_pricelist'> <t t-foreach='widget.pos.pricelists' t-as='pricelist'> <option t-att-value='pricelist.id' - t-att-selected="partner.property_product_pricelist ? (pricelist.id === partner.property_product_pricelist[0] ? true : undefined) : undefined"> + t-att-selected="partner.property_product_pricelist ? (pricelist.id === partner.property_product_pricelist[0] ? true : undefined) : undefined"> <t t-esc='pricelist.display_name'/> </option> </t> @@ -531,7 +531,7 @@ <t t-esc="widget.format_currency(order.get_total_with_tax())"/> </div> <div class='message'> - Please select a payment method. + Please select a payment method. </div> </div> </t> @@ -559,19 +559,19 @@ <t t-if='line.selected'> <tr class='paymentline selected'> <td class='col-due'> <t t-esc='widget.format_currency_no_symbol(order.get_due(line))' /> </td> - <td class='col-tendered edit'> + <td class='col-tendered edit'> <t t-esc='widget.inputbuffer' /> <!-- <t t-esc='line.get_amount()' /> --> </td> <t t-if='order.get_change(line)'> - <td class='col-change highlight' > + <td class='col-change highlight' > <t t-esc='widget.format_currency_no_symbol(order.get_change(line))' /> </td> </t> <t t-if='!order.get_change(line)'> <td class='col-change' ></td> </t> - + <td class='col-name' > <t t-esc='line.name' /> </td> <td class='delete-button' t-att-data-cid='line.cid' aria-label="Delete" title="Delete"> <i class='fa fa-times-circle' /> </td> </tr> @@ -580,7 +580,7 @@ <tr class='paymentline' t-att-data-cid='line.cid'> <td class='col-due'> <t t-esc='widget.format_currency_no_symbol(order.get_due(line))' /> </td> <td class='col-tendered'> <t t-esc='widget.format_currency_no_symbol(line.get_amount())' /> </td> - <td class='col-change'> + <td class='col-change'> <t t-if='order.get_change(line)'> <t t-esc='widget.format_currency_no_symbol(order.get_change(line))' /> </t> @@ -668,8 +668,8 @@ <div class='payment-buttons'> <div class='button js_set_customer'> - <i class='fa fa-user' role="img" aria-label="Customer" title="Customer"/> - <span class='js_customer_name'> + <i class='fa fa-user' role="img" aria-label="Customer" title="Customer"/> + <span class='js_customer_name'> <t t-if="widget.pos.get_client()"> <t t-esc="widget.pos.get_client().name" /> </t> @@ -687,7 +687,7 @@ </t> <t t-if='widget.pos.config.tip_product_id'> <div class='button js_tip'> - <i class='fa fa-heart' /> Tip + <i class='fa fa-heart' /> Tip </div> </t> <t t-if='widget.pos.config.iface_cashdrawer'> @@ -700,7 +700,7 @@ </div> </div> </t> - + <t t-name="ReceiptScreenWidget"> <div class='receipt-screen screen'> <div class='screen-content'> @@ -795,9 +795,9 @@ <t t-esc='line.quantity' /> </value> <t t-if='line.unit_name !== "Unit(s)"'> - <t t-esc='line.unit_name' /> + <t t-esc='line.unit_name' /> </t> - x + x <value t-att-value-decimals='pos.dp["Product Price"]'> <t t-esc='line.price' /> </value> @@ -841,14 +841,14 @@ <right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='line.get_amount()'/></value></right> </line> </t> - <br/> + <br/> <line size='double-height'> <left><pre> CHANGE</pre></left> <right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='receipt.change' /></value></right> </line> <br/> - + <!-- Extra Payment Info --> <t t-if='receipt.total_discount'> @@ -918,7 +918,7 @@ <t t-esc='line.quantity' /> </value> <t t-if='line.uom !== "Unit(s)"'> - <t t-esc='line.uom' /> + <t t-esc='line.uom' /> </t> </right> <right> @@ -1057,10 +1057,10 @@ <main class="body"><t t-esc=" widget.options.body || '' "/></main> <footer class="footer"> <div class="button confirm"> - Confirm + Confirm </div> <div class="button cancel"> - Cancel + Cancel </div> </footer> </div> @@ -1074,10 +1074,10 @@ <input type='text' t-att-value="widget.options.value || ''"></input> <div class="footer"> <div class="button confirm"> - Ok + Ok </div> <div class="button cancel"> - Cancel + Cancel </div> </div> </div> @@ -1116,14 +1116,14 @@ <t t-name="TextAreaPopupWidget"> <div role="dialog" class="modal-dialog"> <div class="popup popup-textinput"> - <title class="title"><t t-esc=" widget.options.title || '' " /></title> + <header class="title"><t t-esc=" widget.options.title || '' " /></header> <textarea rows="10" cols="40"><t t-esc="widget.options.value" /></textarea> <footer class="footer"> <div class="button confirm"> - Ok + Ok </div> <div class="button cancel"> - Cancel + Cancel </div> </footer> </div> @@ -1143,7 +1143,7 @@ </div> <footer class="footer"> <div class="button cancel"> - Cancel + Cancel </div> </footer> </div> @@ -1195,7 +1195,7 @@ </div> <footer class="footer centered"> <div class="button cancel"> - Cancel + Cancel </div> <div class="button confirm"> Ok @@ -1222,11 +1222,11 @@ <li><b><t t-esc="report.unpaid_skipped_session || 0" /></b> belong to another session: <t t-if="report.unpaid_skipped_sessions"> <ul> - <li>Session ids: <b><t t-esc="JSON.stringify(report.unpaid_skipped_sessions)" /></b></li> + <li>Session ids: <b><t t-esc="JSON.stringify(report.unpaid_skipped_sessions)" /></b></li> </ul> </t> </li> - + </ul> </li> </t> @@ -1244,7 +1244,7 @@ <t t-name="Product"> <article class='product' t-att-data-product-id="product.id" tabindex="0" t-attf-aria-labelledby="article_product_#{product.id}"> <div class="product-img"> - <img t-att-src='image_url' alt="Product image"/> + <img t-att-src='image_url' alt="Product image"/> <t t-if="!product.to_weight"> <span class="price-tag"> <t t-esc="widget.format_currency(product.get_price(pricelist, 1),'Product Price')"/> @@ -1291,7 +1291,7 @@ </t> <t t-if="line.get_discount_str() !== '0'"> <li class="info"> - With a + With a <em> <t t-esc="line.get_discount_str()" />% </em> @@ -1446,7 +1446,7 @@ <t t-name="PosTicket"> <div class="pos-sale-ticket"> - + <div class="pos-center-align"><t t-esc="order.formatted_validation_date"/> <t t-esc="order.name"/></div> <br /> <t t-esc="widget.pos.company.name"/><br /> @@ -1545,7 +1545,7 @@ </div> </t> - <!-- Onscreen Keyboard : + <!-- Onscreen Keyboard : http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/ --> <t t-name="OnscreenKeyboardFull"> <div class="keyboard_frame"> diff --git a/addons/project/static/src/js/tour.js b/addons/project/static/src/js/tour.js index 18087cdbc3b..dc66158921a 100644 --- a/addons/project/static/src/js/tour.js +++ b/addons/project/static/src/js/tour.js @@ -27,7 +27,7 @@ tour.register('project_tour', { content: _t('This will create new project and redirect us to its tasks.'), position: 'right', run: function (actions) { - actions.auto('[role="dialog"]:visible .btn.btn-primary'); + actions.auto('.modal:visible .btn.btn-primary'); }, }, { trigger: ".o_kanban_project_tasks .o_column_quick_create input", diff --git a/addons/project/static/tests/project_tests.js b/addons/project/static/tests/project_tests.js index e8994c41898..e659658a7a2 100644 --- a/addons/project/static/tests/project_tests.js +++ b/addons/project/static/tests/project_tests.js @@ -118,12 +118,12 @@ QUnit.module('project', { assert.strictEqual(kanban.$('img').length, 0, "Initially there is no image."); kanban.$('.o_dropdown_kanban [data-type=set_cover]').eq(0).click(); // single click on image - $('[role="dialog"]').find("img[data-id='1']").click(); - $('footer.modal-footer .btn-primary').click(); + $('.modal').find("img[data-id='1']").click(); + $('.modal-footer .btn-primary').click(); assert.strictEqual(kanban.$('img[data-src*="/web/image/1"]').length, 1, "Image inserted in record"); $('.o_dropdown_kanban [data-type=set_cover]').eq(1).click(); // double click on image - $('[role="dialog"]').find("img[data-id='2']").dblclick(); + $('.modal').find("img[data-id='2']").dblclick(); assert.strictEqual(kanban.$('img[data-src*="/web/image/2"]').length, 1, "Image inserted after double click"); // varify write on both kanban record assert.verifySteps([1,2]); diff --git a/addons/sale_stock/static/src/js/tour.js b/addons/sale_stock/static/src/js/tour.js index 9822d124df0..245a25db2b2 100644 --- a/addons/sale_stock/static/src/js/tour.js +++ b/addons/sale_stock/static/src/js/tour.js @@ -13,15 +13,15 @@ odoo.define("sale_stock.tour", function (require) { }; tour.tours.sale_tour.steps.splice(quotation_product_selected_step_index+1, 0, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", auto: true, }, { trigger: "body:not(:has(.o_dialog_warning))", auto: true, in_modal: false, run: function (actions) { - if ($('footer.modal-footer .btn-primary').length){ - actions.auto('footer.modal-footer .btn-primary'); + if ($('.modal-footer .btn-primary').length){ + actions.auto('.modal-footer .btn-primary'); } }, }); diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js index 6ebd94ef13e..075c7359a55 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/js/core/dialog.js @@ -23,7 +23,7 @@ var Dialog = Widget.extend({ focus_control_button: '_onFocusControlButton', }), events: _.extend({} , Widget.prototype.events, { - 'keydown footer.modal-footer button':'_onFooterButtonKeyDown', + 'keydown .modal-footer button':'_onFooterButtonKeyDown', }), /** * @param {Widget} parent @@ -93,7 +93,7 @@ var Dialog = Widget.extend({ self.$modal.find('.modal-dialog').addClass('modal-sm'); break; } - self.$footer = self.$modal.find("footer"); + self.$footer = self.$modal.find(".modal-footer"); self.set_buttons(self.buttons); self.$modal.on('hidden.bs.modal', _.bind(self.destroy, self)); }); @@ -103,6 +103,9 @@ var Dialog = Widget.extend({ */ renderElement: function () { this._super(); + // Note: ideally, the $el which is created/set here should use the + // 'main' tag, we cannot enforce this as it would require to re-create + // the whole element. if (this.$content) { this.setElement(this.$content); } @@ -169,15 +172,7 @@ var Dialog = Widget.extend({ var self = this; this.appendTo($('<div/>')).then(function () { - var $main = self.$modal.find("main:first"); - if ($main.length === 0) { - $main = self.$modal.find(".modal-body:first"); - } - if (self.$el.tagName !== 'MAIN') { - self.$el.removeClass(".modal-body"); - self.$el = $('<main class="modal-body"/>').append(self.$el); - } - $main.replaceWith(self.$el); + self.$modal.find(".modal-body").replaceWith(self.$el); self.$modal.attr('open', true); self.$modal.removeAttr("aria-hidden"); self.$modal.modal('show'); @@ -212,13 +207,11 @@ var Dialog = Widget.extend({ $('.tooltip').remove(); //remove open tooltip if any to prevent them staying when modal has disappeared if (this.$modal) { this.$modal.modal('hide'); - this.$modal.removeAttr('open'); - this.$modal.attr('aria-hidden', true); this.$modal.remove(); } if (!isFocusSet) { - var modals = $('body > [role="dialog"]').filter(':visible'); + var modals = $('body > .modal').filter(':visible'); if (modals.length) { modals.last().focus(); // Keep class modal-open (deleted by bootstrap hide fnct) on body to allow scrolling inside the modal @@ -300,9 +293,10 @@ Dialog.alert = function (owner, message, options) { return new Dialog(owner, _.extend({ size: 'medium', buttons: buttons, - $content: $('<main role="alert"/>').append($('<p>', { + $content: $('<main/>', { + role: 'alert', text: message, - })), + }), title: _t("Alert"), }, options)).open({shouldFocusButtons:true}); }; @@ -325,9 +319,10 @@ Dialog.confirm = function (owner, message, options) { return new Dialog(owner, _.extend({ size: 'medium', buttons: buttons, - $content: $('<main role="alert">').append($('<p>', { + $content: $('<main/>', { + role: 'alert', text: message, - })), + }), title: _t("Confirmation"), }, options)).open({shouldFocusButtons:true}); }; @@ -358,7 +353,7 @@ Dialog.safeConfirm = function (owner, message, options) { text: message, }); } - $content = $('<main role="alert"/>').append($content, $securityCheck); + $content = $('<main/>', {role: 'alert'}).append($content, $securityCheck); var buttons = [ { diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index cb676871fc5..51816220c9f 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1603,7 +1603,7 @@ var AttachmentImage = AbstractField.extend({ this.$el.empty().append($('<img>/', { src: "/web/image/" + this.value.data.id + "?unique=1", title: this.value.data.display_name, - alt: _("Image") + alt: _t("Image") })); } } diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js index f554d333bc9..170b950a49d 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js @@ -216,7 +216,7 @@ var ColumnQuickCreate = Widget.extend({ } // ignore clicks in modals - if ($(event.target).closest('[role="dialog"]').length) { + if ($(event.target).closest('.modal').length) { return; } diff --git a/addons/web/static/src/js/views/kanban/kanban_record_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_record_quick_create.js index 749938e8b9e..bf7e60b68c3 100644 --- a/addons/web/static/src/js/views/kanban/kanban_record_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_record_quick_create.js @@ -232,7 +232,7 @@ var RecordQuickCreate = Widget.extend({ } // ignore clicks in modals - if ($(ev.target).closest('[role="dialog"]').length) { + if ($(ev.target).closest('.modal').length) { return; } diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index 26b4f68d303..643cd52a282 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -758,7 +758,7 @@ ListRenderer.include({ break; } }, - /** + /** * It will returns the first visible widget that is editable * * @private @@ -768,9 +768,9 @@ ListRenderer.include({ var record = this.state.data[this.currentRow]; var recordWidgets = this.allFieldWidgets[record.id]; var firstWidget = _.find(recordWidgets, function (widget) { - var isFirst = widget.$el.is(':visible') && + var isFirst = widget.$el.is(':visible') && (widget.$el.has('input').length > 0 || - widget.tagName== 'input') && + widget.tagName== 'input') && !widget.$el.hasClass('o_readonly_modifier'); return isFirst; }); @@ -923,9 +923,9 @@ ListRenderer.include({ // ignore clicks in modals, except if the list is in a modal, and the // click is performed in that modal - var $clickModal = $(event.target).closest('[role="dialog"]'); + var $clickModal = $(event.target).closest('.modal'); if ($clickModal.length) { - var $listModal = this.$el.closest('[role="dialog"]'); + var $listModal = this.$el.closest('.modal'); if ($clickModal.prop('id') !== $listModal.prop('id')) { return; } diff --git a/addons/web/static/src/js/widgets/change_password.js b/addons/web/static/src/js/widgets/change_password.js index b2e4e013335..c05fa30408b 100644 --- a/addons/web/static/src/js/widgets/change_password.js +++ b/addons/web/static/src/js/widgets/change_password.js @@ -28,7 +28,7 @@ var ChangePassword = AbstractAction.extend({ var $button = self.$('.oe_form_button'); $button.appendTo(this.getParent().$footer); $button.eq(1).click(function () { - self.$el.parents('[role="dialog"]').modal('hide'); + self.$el.parents('.modal').modal('hide'); }); $button.eq(0).click(function () { self._rpc({ diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js index 4bdc27448a0..4b86b76c36d 100644 --- a/addons/web/static/src/js/widgets/debug_manager.js +++ b/addons/web/static/src/js/widgets/debug_manager.js @@ -848,7 +848,7 @@ if (config.debug) { if (action) { var controller = parent.getCurrentControllerInDialog(); self.debugManager = new DebugManager(self); - var $header = self.$modal.find('header.modal-header:first'); + var $header = self.$modal.find('.modal-header:first'); return self.debugManager.prependTo($header).then(function () { self.debugManager.update('action', action, controller.widget); }); diff --git a/addons/web/static/src/js/widgets/domain_selector_dialog.js b/addons/web/static/src/js/widgets/domain_selector_dialog.js index d0c0030b100..46b54089c5f 100644 --- a/addons/web/static/src/js/widgets/domain_selector_dialog.js +++ b/addons/web/static/src/js/widgets/domain_selector_dialog.js @@ -43,7 +43,7 @@ return Dialog.extend({ var self = this; this.opened().then(function () { // this restores default modal height (bootstrap) and allows field selector to overflow - self.$el.css('overflow', 'visible').closest('[role="dialog"]').css('height', 'auto'); + self.$el.css('overflow', 'visible').closest('.modal-dialog').css('height', 'auto'); }); return $.when( this._super.apply(this, arguments), diff --git a/addons/web/static/src/scss/kanban_view.scss b/addons/web/static/src/scss/kanban_view.scss index 715c381e553..4d00f1be3cf 100644 --- a/addons/web/static/src/scss/kanban_view.scss +++ b/addons/web/static/src/scss/kanban_view.scss @@ -508,4 +508,8 @@ // Records colours @include o-kanban-record-color; + + .oe_kanban_color_help { + @include o-position-absolute(0, 5px, 0, -1px); + } } diff --git a/addons/web/static/src/scss/utils.scss b/addons/web/static/src/scss/utils.scss index cf04a8d32f8..efb8dce7598 100644 --- a/addons/web/static/src/scss/utils.scss +++ b/addons/web/static/src/scss/utils.scss @@ -337,14 +337,6 @@ } } } -.oe_kanban_color_help { - bottom: 0px; - left: -1px; - top: 0px; - width: 6px; - position: absolute; - right: auto; -} @mixin o-kanban-slim-col { position: relative; @include o-flex(0, 0, auto); diff --git a/addons/web/static/src/xml/dialog.xml b/addons/web/static/src/xml/dialog.xml index eb1a67ee98d..e55a17f26ef 100644 --- a/addons/web/static/src/xml/dialog.xml +++ b/addons/web/static/src/xml/dialog.xml @@ -3,7 +3,7 @@ <!-- These templates are accessible in backend and frontend --> -<div role="dialog" t-name="Dialog" t-attf-class="modal#{technical ? ' o_technical_modal' : ''}" tabindex="-1" data-backdrop="static" t-att-id="_.uniqueId('modal_')"> +<div role="dialog" t-name="Dialog" t-attf-class="modal#{technical ? ' o_technical_modal' : ''}" tabindex="-1" data-backdrop="static" t-att-id="_.uniqueId('modal_')" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <header class="modal-header"> diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 3910e6d761f..4a1cf0a40c3 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -2672,12 +2672,12 @@ QUnit.module('ActionManager', { // go back to kanban view $('.o_control_panel .breadcrumb li:first a').click(); - assert.strictEqual($('main.modal-body:first').text(), + 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 - $('footer.modal-footer button.btn-default').click(); + $('.modal .modal-footer button.btn-default').click(); assert.strictEqual(actionManager.$('.o_form_view').length, 1, "should still be in form view"); @@ -2686,7 +2686,7 @@ QUnit.module('ActionManager', { $('.o_control_panel .breadcrumb li:first a').click(); // confirm discard - $('footer.modal-footer button.btn-primary').click(); + $('.modal .modal-footer button.btn-primary').click(); assert.strictEqual(actionManager.$('.o_form_view').length, 0, "should no longer be in form view"); @@ -3049,7 +3049,7 @@ QUnit.module('ActionManager', { assert.strictEqual($('.o_technical_modal .o_form_view').length, 1, "should have rendered a form view in a modal"); - assert.ok($('.o_technical_modal main').hasClass('o_act_window'), + assert.ok($('.o_technical_modal .modal-body').hasClass('o_act_window'), "dialog main element should have classname 'o_act_window'"); assert.ok($('.o_technical_modal .o_form_view').hasClass('o_form_editable'), "form view should be in edit mode"); @@ -3105,11 +3105,11 @@ QUnit.module('ActionManager', { }); actionManager.doAction(5); - assert.strictEqual($('.o_technical_modal main button.infooter').length, 0, + assert.strictEqual($('.o_technical_modal .modal-body button.infooter').length, 0, "the button should not be in the body"); - assert.strictEqual($('.o_technical_modal footer button.infooter').length, 1, + assert.strictEqual($('.o_technical_modal .modal-footer button.infooter').length, 1, "the button should be in the footer"); - assert.strictEqual($('.o_technical_modal footer button').length, 1, + assert.strictEqual($('.o_technical_modal .modal-footer button').length, 1, "the modal footer should only contain one button"); actionManager.destroy(); @@ -3139,7 +3139,7 @@ QUnit.module('ActionManager', { type: 'ir.actions.client', }); - assert.strictEqual($('[role="dialog"] .o_test').length, 1, + assert.strictEqual($('.modal .o_test').length, 1, "should have rendered the client action in a dialog"); assert.verifySteps(['on_attach_callback']); diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index d95d34431b3..98775ebab3c 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1880,7 +1880,7 @@ QUnit.module('basic_fields', { // Actual flow: click on an element of the m2m to get its form view form.$('tbody td:contains(gold)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, 'The modal should have opened'); assert.verifySteps([ "The view's image should have been fetched", @@ -2608,7 +2608,7 @@ QUnit.module('basic_fields', { // switch to form view form.$('.o_field_widget[name=p] .o_data_row').click(); - assert.strictEqual($('[role="dialog"] .o_field_date[name=datetime]').text(), '02/07/2017', + assert.strictEqual($('.modal .o_field_date[name=datetime]').text(), '02/07/2017', 'the datetime (date widget) should be correctly displayed in form view'); form.destroy(); @@ -2652,7 +2652,7 @@ QUnit.module('basic_fields', { // switch to form view form.$('.o_field_widget[name=p] .o_data_row').click(); - assert.strictEqual($('[role="dialog"] .o_field_date[name=datetime]').text(), '02/08/2017', + assert.strictEqual($('.modal .o_field_date[name=datetime]').text(), '02/08/2017', 'the datetime (date widget) should be correctly displayed in form view'); form.destroy(); @@ -4640,13 +4640,13 @@ QUnit.module('basic_fields', { // open the selection form.$(".o_domain_show_selection_button").click(); - assert.strictEqual($('[role="dialog"] .o_list_view .o_data_row').length, 2, + assert.strictEqual($('.modal .o_list_view .o_data_row').length, 2, "should have open a list view with 2 records in a dialog"); // click on a record -> should not open the record // we don't actually check that it doesn't open the record because even // if it tries to, it will crash as we don't define an arch in this test - $('[role="dialog"] .o_list_view .o_data_row:first .o_data_cell').click(); + $('.modal .o_list_view .o_data_row:first .o_data_cell').click(); form.destroy(); }); 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(), "", diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/fields/upgrade_fields_tests.js index 14f20bba8ad..427ec7b54e3 100644 --- a/addons/web/static/tests/fields/upgrade_fields_tests.js +++ b/addons/web/static/tests/fields/upgrade_fields_tests.js @@ -33,7 +33,7 @@ QUnit.module('upgrade_fields', { }); form.$('input:checkbox').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, "the 'Upgrade to Enterprise' dialog should be opened"); form.destroy(); diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 5a07924413e..2bab1f42437 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -213,8 +213,8 @@ QUnit.module('Views', { $sidebar.find('input[type="text"]').trigger('click'); assert.strictEqual($('ul.ui-autocomplete li:not(.o_m2o_dropdown_option)').text(), "partner 4", "should display the last choice in one2many autocomplete"); // TODO: remove :not(.o_m2o_dropdown_option) because can't have "create & edit" choice $sidebar.find('.o_calendar_filter_item .o_remove').first().trigger('click'); - assert.ok($('footer.modal-footer button.btn:contains(Ok)').length, "should display the confirm message"); - $('footer.modal-footer button.btn:contains(Ok)').trigger('click'); + assert.ok($('.modal-footer button.btn:contains(Ok)').length, "should display the confirm message"); + $('.modal-footer button.btn:contains(Ok)').trigger('click'); assert.strictEqual($sidebar.find('.o_calendar_filter:has(h3:contains(attendees)) .o_calendar_filter_item').length, 3, "click on remove then should display 3 filter items for 'attendees'"); calendar.destroy(); }); @@ -295,19 +295,19 @@ QUnit.module('Views', { calendar.$('.fc-event:contains(event 4) .fc-content').trigger('click'); - assert.ok($('main.modal-body').length, "should open the form view in dialog when click on event"); - assert.ok($('footer.modal-footer button.btn:contains(Edit)').length, "formViewDialog should be in readonly mode"); - assert.ok($('footer.modal-footer button.btn:contains(Delete)').length, "formViewDialog should have a delete button"); + assert.ok($('.modal-body').length, "should open the form view in dialog when click on event"); + assert.ok($('.modal-footer button.btn:contains(Edit)').length, "formViewDialog should be in readonly mode"); + assert.ok($('.modal-footer button.btn:contains(Delete)').length, "formViewDialog should have a delete button"); - $('footer.modal-footer button.btn:contains(Edit)').trigger('click'); + $('.modal-footer button.btn:contains(Edit)').trigger('click'); - assert.ok($('main.modal-body').length, "should switch the modal in edit mode"); - assert.notOk($('footer.modal-footer button.btn:contains(Delete)').length, "formViewDialog should not have a delete button in edit mode"); + assert.ok($('.modal-body').length, "should switch the modal in edit mode"); + assert.notOk($('.modal-footer button.btn:contains(Delete)').length, "formViewDialog should not have a delete button in edit mode"); - $('main.modal-body input:first').val('event 4 modified').trigger('input'); - $('footer.modal-footer button.btn:contains(Save)').trigger('click'); + $('.modal-body input:first').val('event 4 modified').trigger('input'); + $('.modal-footer button.btn:contains(Save)').trigger('click'); - assert.notOk($('main.modal-body').length, "save button should close the modal"); + assert.notOk($('.modal-body').length, "save button should close the modal"); assert.ok(calendar.$('.fc-event:contains(event 4 modified)').length, "should display the updated records"); // create a new event, quick create only @@ -319,8 +319,8 @@ QUnit.module('Views', { assert.ok($('.modal-sm').length, "should open the quick create dialog"); - $('main.modal-body input:first').val('new event in quick create').trigger('input'); - $('footer.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); + $('.modal-body input:first').val('new event in quick create').trigger('input'); + $('.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); assert.strictEqual(calendar.$('.fc-event:contains(new event in quick create)').length, 1, "should display the new record after quick create"); assert.strictEqual(calendar.$('td.fc-event-container[colspan]').length, 2, "should the new record have only one day"); @@ -332,7 +332,7 @@ QUnit.module('Views', { assert.ok($('.modal-sm').length, "should open the quick create dialog"); - $('main.modal-body input:first') + $('.modal-body input:first') .val('new event in quick create validated by pressing enter key.') .trigger($.Event('keyup', {keyCode: $.ui.keyCode.ENTER})) .trigger($.Event('keyup', {keyCode: $.ui.keyCode.ENTER})); @@ -349,8 +349,8 @@ QUnit.module('Views', { assert.strictEqual($('.modal-sm').length, 1, "should open the quick create dialog"); - $('main.modal-body input:first').val('coucou').trigger('input'); - $('footer.modal-footer button.btn:contains(Edit)').trigger('click'); + $('.modal-body input:first').val('coucou').trigger('input'); + $('.modal-footer button.btn:contains(Edit)').trigger('click'); assert.strictEqual($('.modal-lg .o_form_view').length, 1, "should open the slow create dialog"); assert.strictEqual($('.modal-lg .modal-title').text(), "Create: Events", @@ -371,13 +371,13 @@ QUnit.module('Views', { testUtils.triggerMouseEvent($cell.next(), "mouseup"); $('.modal-dialog input:first').val('new event in quick create 2').trigger('input'); - $('footer.modal-footer button.btn:contains(Edit)').trigger('click'); + $('.modal-footer button.btn:contains(Edit)').trigger('click'); assert.strictEqual($('.modal-lg input:first').val(), 'new event in quick create 2', "should open the formViewDialog with default values"); $('.modal-lg button.btn:contains(Save)').trigger('click'); - assert.notOk($('[role="dialog"]').length, "should close dialogs"); + assert.notOk($('.modal').length, "should close dialogs"); var $newevent2 = calendar.$('.fc-event:contains(new event in quick create 2)'); assert.ok($newevent2.length, "should display the 2 days new record"); assert.strictEqual($newevent2.closest('.fc-event-container').attr('colspan'), "2", "the new record should have 2 days"); @@ -385,9 +385,9 @@ QUnit.module('Views', { // delete the a record calendar.$('.fc-event:contains(event 4) .fc-content').trigger('click'); - $('footer.modal-footer button.btn:contains(Delete)').trigger('click'); - assert.ok($('footer.modal-footer button.btn:contains(Ok)').length, "should display the confirm message"); - $('footer.modal-footer button.btn:contains(Ok)').trigger('click'); + $('.modal-footer button.btn:contains(Delete)').trigger('click'); + assert.ok($('.modal-footer button.btn:contains(Ok)').length, "should display the confirm message"); + $('.modal-footer button.btn:contains(Ok)').trigger('click'); assert.notOk(calendar.$('.fc-event:contains(event 4) .fc-content').length, "the record should be deleted"); assert.strictEqual(calendar.$('.fc-event-container .fc-event').length, 10, "should display 10 events"); @@ -442,8 +442,8 @@ QUnit.module('Views', { assert.strictEqual($('.modal-sm .modal-title').text(), 'Create: Events', "should open the quick create dialog"); - $('main.modal-body input:first').val('new event in quick create').trigger('input'); - $('footer.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); + $('.modal-body input:first').val('new event in quick create').trigger('input'); + $('.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); // If the event is not default-prevented, a traceback will be raised, which we do not want assert.ok(event.isDefaultPrevented(), "fail deferred event should have been default-prevented"); @@ -1328,7 +1328,7 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(4) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - $('main.modal-body input:first').val('coucou').trigger('input'); + $('.modal-body input:first').val('coucou').trigger('input'); testUtils.intercept(calendar, 'do_action', function (event) { assert.deepEqual(event.data.action, @@ -1385,7 +1385,7 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(4) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - $('main.modal-body input:first').val('coucou').trigger('input'); + $('.modal-body input:first').val('coucou').trigger('input'); testUtils.intercept(calendar, 'do_action', function (event) { assert.deepEqual(event.data.action, @@ -1463,7 +1463,7 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(4) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - $('main.modal-body input:first').val('coucou').trigger('input'); + $('.modal-body input:first').val('coucou').trigger('input'); testUtils.intercept(calendar, 'do_action', function (event) { assert.deepEqual(event.data.action, @@ -1600,8 +1600,8 @@ QUnit.module('Views', { testUtils.triggerPositionalMouseEvent(left, top + 200, "mousemove"); testUtils.triggerPositionalMouseEvent(left, top + 200, "mouseup"); - $('main.modal-body input:first').val('coucou').trigger('input'); - $('footer.modal-footer button.btn:contains(Create)').trigger('click'); + $('.modal-body input:first').val('coucou').trigger('input'); + $('.modal-footer button.btn:contains(Create)').trigger('click'); assert.strictEqual(calendar.$('.o_calendar_filter_item').length, 6, "should add the missing filter (active)"); assert.strictEqual(calendar.$('.fc-event').length, 4, "should display the created item"); @@ -1617,8 +1617,8 @@ QUnit.module('Views', { testUtils.triggerPositionalMouseEvent(left, top + 200, "mousemove"); testUtils.triggerPositionalMouseEvent(left, top + 200, "mouseup"); - $('main.modal-body input:first').val('coucou 2').trigger('input'); - $('footer.modal-footer button.btn:contains(Create)').trigger('click'); + $('.modal-body input:first').val('coucou 2').trigger('input'); + $('.modal-footer button.btn:contains(Create)').trigger('click'); assert.strictEqual(calendar.$('.o_calendar_filter_item').length, 6, "should have the same filters"); assert.strictEqual(calendar.$('.fc-event').length, 4, "should not display the created item"); @@ -1697,10 +1697,10 @@ QUnit.module('Views', { testUtils.triggerPositionalMouseEvent(left, top + 200, "mousemove"); testUtils.triggerPositionalMouseEvent(left, top + 200, "mouseup"); - $('main.modal-body input:first').val('coucou').trigger('input'); + $('.modal-body input:first').val('coucou').trigger('input'); - $('footer.modal-footer button.btn:contains(Edit)').trigger('click'); - $('footer.modal-footer button.btn:contains(Save)').trigger('click'); + $('.modal-footer button.btn:contains(Edit)').trigger('click'); + $('.modal-footer button.btn:contains(Save)').trigger('click'); assert.strictEqual(calendar.$('.o_calendar_filter_item').length, 6, "should add the missing filter (active)"); assert.strictEqual(calendar.$('.fc-event').length, 4, "should display the created item"); @@ -1906,8 +1906,8 @@ QUnit.module('Views', { "should open the quick create dialog"); // Creating the event - $('main.modal-body input:first').val('new event in quick create').trigger('input'); - $('footer.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); + $('.modal-body input:first').val('new event in quick create').trigger('input'); + $('.modal-footer button.btn:contains(Create)').trigger('click').trigger('click'); assert.strictEqual(calendar.$('.fc-event:contains(new event in quick create)').length, 1, "should display the new record after quick create dialog"); @@ -1989,14 +1989,14 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(2) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - var $input = $('[role="dialog"] input:first'); + var $input = $('.modal input:first'); $input.val('new event in quick create').trigger('input'); // Simulate ENTER pressed on Create button (after a TAB) $input.trigger($.Event('keyup', { which: $.ui.keyCode.ENTER, keyCode: $.ui.keyCode.ENTER, })); - $('footer.modal-footer button:first').click(); + $('.modal-footer button:first').click(); def.resolve(); assert.strictEqual(createCount, 1, "should create only one event"); @@ -2221,7 +2221,7 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(2) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - var $input = $('main.modal-body input:first'); + var $input = $('.modal-body input:first'); $input.val("It's just a fleshwound").trigger('input'); $('.modal button.btn:contains(Create)').trigger('click'); @@ -2268,7 +2268,7 @@ QUnit.module('Views', { var $cell = calendar.$('.fc-day-grid .fc-row:eq(2) .fc-day:eq(2)'); testUtils.triggerMouseEvent($cell, "mousedown"); testUtils.triggerMouseEvent($cell, "mouseup"); - var $input = $('main.modal-body input:first'); + var $input = $('.modal-body input:first'); $input.val("It's just a fleshwound").trigger('input'); $('.modal button.btn:contains(Create)').trigger('click'); diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 035c815ae95..d547a278a11 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -2176,13 +2176,13 @@ QUnit.module('Views', { "should display the name of the many2many on the original form"); form.$('td:contains(gold)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, 'The partner_type modal should have opened'); - assert.strictEqual($('[role="dialog"]').find('td:contains(first record)').length, 1, + assert.strictEqual($('.modal').find('td:contains(first record)').length, 1, "should display the name of the many2many on the modal form"); - $('[role="dialog"]').find('td:contains(first record)').click(); - assert.strictEqual($('[role="dialog"]').length, 2, + $('.modal').find('td:contains(first record)').click(); + assert.strictEqual($('.modal').length, 2, 'There should be 2 modals (partner on top of partner_type) opened'); form.destroy(); @@ -2212,7 +2212,7 @@ QUnit.module('Views', { // click on discard form.$buttons.find('.o_form_button_cancel').click(); - assert.ok(!$('[role="dialog"]:visible').length, 'no confirm modal should be displayed'); + assert.ok(!$('.modal:visible').length, 'no confirm modal should be displayed'); assert.strictEqual(form.$('.o_field_widget').text(), 'yop', 'field in readonly should display yop'); assert.strictEqual(nbWrite, 0, 'no write RPC should have been done'); @@ -2245,14 +2245,14 @@ QUnit.module('Views', { // click on discard and cancel the confirm request form.$buttons.find('.o_form_button_cancel').click(); - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-default').click(); // click on cancel + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-default').click(); // click on cancel assert.strictEqual(form.$('input').val(), 'new value', 'input should still contain new value'); // click on discard and confirm form.$buttons.find('.o_form_button_cancel').click(); - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // click on confirm assert.strictEqual(form.$('.o_field_widget').text(), 'yop', 'field in readonly should display yop'); assert.strictEqual(nbWrite, 0, 'no write RPC should have been done'); @@ -2332,7 +2332,7 @@ QUnit.module('Views', { // click on discard and confirm form.$buttons.find('.o_form_button_cancel').click(); - $('footer.modal-footer .btn-primary').click(); // click on confirm + $('.modal-footer .btn-primary').click(); // click on confirm assert.notOk(form.$el.prop('outerHTML').match('xphone'), "the string xphone should not be present after discarding"); @@ -2362,7 +2362,7 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_cancel').click(); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, 'there should not be a confirm modal'); form.destroy(); @@ -2396,17 +2396,17 @@ QUnit.module('Views', { // discard the changes and check it has properly been discarded form.$buttons.find('.o_form_button_cancel').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, 'there should be a confirm modal'); assert.strictEqual(form.$('input').val(), 'DEF', 'input should be DEF'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + $('.modal-footer .btn-primary').click(); // click on confirm assert.strictEqual(form.$('input').val(), 'ABC', 'input should now be ABC'); // redirty and discard the field foo (to make sure initial changes haven't been lost) form.$('input').val('GHI').trigger('input'); form.$buttons.find('.o_form_button_cancel').click(); assert.strictEqual(form.$('input').val(), 'GHI', 'input should be GHI'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + $('.modal-footer .btn-primary').click(); // click on confirm assert.strictEqual(form.$('input').val(), 'ABC', 'input should now be ABC'); form.destroy(); @@ -2440,7 +2440,7 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_cancel').click(); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, 'there should not be a confirm modal'); form.destroy(); @@ -2481,15 +2481,15 @@ 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($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-default').click(); // click on cancel + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-default').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'); // click on the pager to switch to the next record and confirm form.pager.$('.o_pager_next').click(); // click on next - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // click on confirm assert.strictEqual(form.$('input').val(), 'blip', 'input should contain blip'); assert.strictEqual(form.pager.$('.o_pager_value').text(), "2", 'pager value should be 2'); @@ -2528,7 +2528,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.strictEqual($('[role="dialog"]:visible').length, 0, 'no confirm modal should be displayed'); + assert.strictEqual($('.modal:visible').length, 0, 'no confirm modal should be displayed'); assert.strictEqual(form.pager.$('.o_pager_value').text(), "2", 'pager value should be 2'); assert.strictEqual(form.$('.o_priority .fa-star-o').length, 2, @@ -2540,7 +2540,7 @@ QUnit.module('Views', { 'priority widget should have been updated'); form.pager.$('.o_pager_next').click(); // click on next - assert.strictEqual($('[role="dialog"]:visible').length, 0, 'no confirm modal should be displayed'); + assert.strictEqual($('.modal:visible').length, 0, 'no confirm modal should be displayed'); assert.strictEqual(form.pager.$('.o_pager_value').text(), "1", 'pager value should be 1'); // switch to edit mode @@ -2551,8 +2551,8 @@ QUnit.module('Views', { form.$('input').val('wrong value').trigger('input'); form.$buttons.find('.o_form_button_cancel').click(); - assert.strictEqual($('[role="dialog"]').length, 1, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // click on confirm form.pager.$('.o_pager_next').click(); // click on next assert.strictEqual(form.pager.$('.o_pager_value').text(), "2", 'pager value should be 2'); form.destroy(); @@ -2781,16 +2781,16 @@ QUnit.module('Views', { assert.strictEqual(form.pager.$('.o_pager_limit').text(), "3", 'pager limit should be 3'); assert.strictEqual(form.$('span:contains(yop)').length, 1, 'should have a field with foo value for record 1'); - assert.ok(!$('[role="dialog"]:visible').length, 'no confirm modal should be displayed'); + assert.ok(!$('.modal:visible').length, 'no confirm modal should be displayed'); // open sidebar form.sidebar.$('button.o_dropdown_toggler_btn').click(); form.sidebar.$('a:contains(Delete)').click(); - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); + assert.ok($('.modal').length, 'a confirm modal should be displayed'); // confirm the delete - $('footer.modal-footer button.btn-primary').click(); + $('.modal-footer button.btn-primary').click(); assert.strictEqual(form.pager.$('.o_pager_value').text(), "1", 'pager value should be 1'); assert.strictEqual(form.pager.$('.o_pager_limit').text(), "2", 'pager limit should be 2'); @@ -2829,9 +2829,9 @@ QUnit.module('Views', { testUtils.intercept(form, 'history_back', function () { assert.step('history_back'); }); - assert.strictEqual($('[role="dialog"]').length, 1, 'a confirm modal should be displayed'); - $('footer.modal-footer button.btn-primary').click(); - assert.strictEqual($('[role="dialog"]').length, 0, 'no confirm modal should be displayed'); + assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed'); + $('.modal-footer button.btn-primary').click(); + assert.strictEqual($('.modal').length, 0, 'no confirm modal should be displayed'); assert.verifySteps(['read', 'unlink', 'history_back']); form.destroy(); @@ -3399,7 +3399,7 @@ QUnit.module('Views', { // open a subrecord and trigger an onchange readInModal = true; form.$('.o_data_row .o_data_cell:first').click(); - $('[role="dialog"] .o_field_widget[name=name]').val("new name").trigger('input'); + $('.modal .o_field_widget[name=name]').val("new name").trigger('input'); form.destroy(); }); @@ -3627,7 +3627,7 @@ QUnit.module('Views', { // discard changes form.$buttons.find('.o_form_button_cancel').click(); - $('footer.modal-footer .btn-primary').click(); + $('.modal-footer .btn-primary').click(); assert.strictEqual(form.$('span[name="foo"]').text(), "blip", "field foo should still be displayed to initial value"); @@ -3672,13 +3672,13 @@ QUnit.module('Views', { assert.strictEqual(form.$('.o_field_widget[name="foo"]').val(), "1234", "field foo should still contain new value"); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, "Confirm dialog should not be displayed"); // complete the write def.resolve(); - assert.strictEqual($('[role="dialog"]').length, 0, + assert.strictEqual($('.modal').length, 0, "Confirm dialog should not be displayed"); assert.strictEqual(form.$('.o_field_widget[name="foo"]').text(), "1234", "value should have been saved and rerendered in readonly"); @@ -3849,9 +3849,9 @@ QUnit.module('Views', { "onchange should have been correctly applied on field in o2m list"); form.$('.o_data_row').click(); // edit the o2m in the dialog - assert.strictEqual($('[role="dialog"] .modal-title').text().trim(), 'Open: one2many field', + assert.strictEqual($('.modal .modal-title').text().trim(), 'Open: one2many field', "the field string is displayed in the modal title"); - assert.strictEqual($('[role="dialog"] .o_field_widget').val(), 'foo changed', + assert.strictEqual($('.modal .o_field_widget').val(), 'foo changed', "the onchange value hasn't been discarded when opening the o2m"); form.destroy(); @@ -3943,20 +3943,20 @@ QUnit.module('Views', { "the initial value should be the default one"); form.$('.o_data_row td:first').click(); // edit the o2m in a dialog - $('[role="dialog"] input:nth(1)').val(77).trigger('input'); - assert.strictEqual($('[role="dialog"] input:first').val(), '[blip] 77', + $('.modal input:nth(1)').val(77).trigger('input'); + assert.strictEqual($('.modal input:first').val(), '[blip] 77', "onchange should have been correctly applied"); - $('footer.modal-footer .btn-primary').click(); // save the dialog + $('.modal-footer .btn-primary').click(); // save the dialog assert.strictEqual(form.$('.o_data_row td:first').text(), '[blip] 77', "onchange should have been correctly applied"); // create a new o2m record form.$('.o_field_x2many_list_row_add a').click(); - assert.strictEqual($('[role="dialog"] .modal-title').text().trim(), 'Create custom label', + assert.strictEqual($('.modal .modal-title').text().trim(), 'Create custom label', "the custom field label is applied in the modal title"); - assert.strictEqual($('[role="dialog"] input:first').val(), '[blip] 14', + assert.strictEqual($('.modal input:first').val(), '[blip] 14', "onchange should have been correctly applied after default get"); - $('footer.modal-footer .btn-primary').click(); // save the dialog + $('.modal-footer .btn-primary').click(); // save the dialog assert.strictEqual(form.$('.o_data_row:nth(1) td:first').text(), '[blip] 14', "onchange should have been correctly applied after default get"); @@ -4385,10 +4385,10 @@ QUnit.module('Views', { // add a o2m subrecord form.$('.o_field_x2many_list_row_add a').click(); - $('main.modal-body .o_field_one2many .o_field_x2many_list_row_add a').click(); - $('main.modal-body input').val('xtv').trigger('input'); - $('footer.modal-footer button:first').click(); // save & close - assert.strictEqual($('[role="dialog"]').length, 0, + $('.modal-body .o_field_one2many .o_field_x2many_list_row_add a').click(); + $('.modal-body input').val('xtv').trigger('input'); + $('.modal-footer button:first').click(); // save & close + assert.strictEqual($('.modal').length, 0, "dialog should be closed"); var row = form.$('.o_field_one2many .o_list_view .o_data_row'); @@ -4684,7 +4684,7 @@ QUnit.module('Views', { assert.strictEqual(row.children()[1].textContent, '1 record', "the cell should contains the number of record: 1"); row.click(); - var modal_row = $('main.modal-body .o_form_sheet .o_field_one2many .o_list_view .o_data_row'); + var modal_row = $('.modal-body .o_form_sheet .o_field_one2many .o_list_view .o_data_row'); assert.strictEqual(modal_row.children().length, 2, "the row should contains the 2 fields defined in the form view"); assert.strictEqual($(modal_row).text(), "gold2", @@ -5031,29 +5031,29 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_edit').click(); // Open first dialog form.$('.o_external_button').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, "One FormViewDialog should be opened"); - var $firstModal = $('[role="dialog"]'); - assert.strictEqual($('[role="dialog"] .modal-title').first().text().trim(), 'Open: Product', + var $firstModal = $('.modal'); + assert.strictEqual($('.modal .modal-title').first().text().trim(), 'Open: Product', "dialog title should display the python field string as label"); assert.strictEqual($firstModal.find('input').val(), 'xphone', "display_name should be correctly displayed"); // Open second dialog $firstModal.find('.o_field_x2many_list_row_add a').click(); - assert.strictEqual($('[role="dialog"]').length, 2, + assert.strictEqual($('.modal').length, 2, "two FormViewDialogs should be opened"); - var $secondModal = $('[role="dialog"]:nth(1)'); + var $secondModal = $('.modal:nth(1)'); // Add new value $secondModal.find('input').val('xtv').trigger('input'); - $secondModal.find('footer.modal-footer button:first').click(); // Save & close - assert.strictEqual($('[role="dialog"]').length, 1, + $secondModal.find('.modal-footer button:first').click(); // Save & close + assert.strictEqual($('.modal').length, 1, "last opened dialog should be closed"); // Check that data in first dialog is correctly updated assert.strictEqual($firstModal.find('tr.o_data_row td').text(), 'xtv', "should have added a line with xtv as new record"); - $firstModal.find('footer.modal-footer button:first').click(); // Save & close + $firstModal.find('.modal-footer button:first').click(); // Save & close form.destroy(); }); @@ -5255,12 +5255,12 @@ QUnit.module('Views', { "record 1 should be first"); form.$buttons.find('.o_form_button_edit').click(); form.$('.o_field_x2many_list_row_add a').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, "FormViewDialog should be opened"); - $('[role="dialog"] input[name="foo"]').val('xop').trigger("input"); - $('footer.modal-footer button:eq(1)').click(); // Save & new - $('[role="dialog"] input[name="foo"]').val('zop').trigger("input"); - $('footer.modal-footer button:first').click(); // Save & close + $('.modal input[name="foo"]').val('xop').trigger("input"); + $('.modal-footer button:eq(1)').click(); // Save & new + $('.modal input[name="foo"]').val('zop').trigger("input"); + $('.modal-footer button:first').click(); // Save & close // client-side sort assert.ok(form.$('.o_field_one2many tbody tr:eq(0) td:contains(zop)').length, @@ -5282,8 +5282,8 @@ QUnit.module('Views', { // client-side sort on edit form.$buttons.find('.o_form_button_edit').click(); form.$('.o_field_one2many tbody tr:eq(1) td:contains(yop)').click(); - $('[role="dialog"] input[name="foo"]').val('zzz').trigger("input"); - $('footer.modal-footer button:first').click(); // Save + $('.modal input[name="foo"]').val('zzz').trigger("input"); + $('.modal-footer button:first').click(); // Save assert.ok(form.$('.o_field_one2many tbody tr:eq(0) td:contains(zzz)').length, "record zzz should be first"); assert.ok(form.$('.o_field_one2many tbody tr:eq(1) td:contains(zop)').length, @@ -5569,7 +5569,7 @@ QUnit.module('Views', { }); form.$('.o_data_row:first').click(); - assert.strictEqual($('[role="dialog"] .modal-title').first().text().trim(), 'Open: custom label', + assert.strictEqual($('.modal .modal-title').first().text().trim(), 'Open: custom label', "modal should use the python field string as title"); form.destroy(); @@ -5655,10 +5655,10 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_edit').click(); form.$('[name="product_id"] .o_external_button').click(); - assert.strictEqual($('main.modal-body .o_field_translate').length, 1, + assert.strictEqual($('.modal-body .o_field_translate').length, 1, "there should be a translate button in the modal"); - $('main.modal-body .o_field_translate').click(); + $('.modal-body .o_field_translate').click(); assert.strictEqual(nbTranslateCalls, 1, "should call_button translate once"); @@ -5825,7 +5825,7 @@ QUnit.module('Views', { form.$('.o_statusbar_buttons button').click(); assert.ok(form.$('.o_statusbar_buttons button').prop('disabled'), 'button should be disabled'); - $('footer.modal-footer button.btn-default').click(); + $('.modal-footer button.btn-default').click(); assert.ok(!form.$('.o_statusbar_buttons button').prop('disabled'), 'button should no longer be disabled'); @@ -5834,7 +5834,7 @@ QUnit.module('Views', { // click on button, and click on ok in confirm dialog form.$('.o_statusbar_buttons button').click(); assert.verifySteps(['default_get']); - $('footer.modal-footer button.btn-primary').click(); + $('.modal-footer button.btn-primary').click(); assert.verifySteps(['default_get', 'create', 'read', 'execute_action']); @@ -5890,17 +5890,17 @@ QUnit.module('Views', { form.$('.o_external_button').click(); - assert.notOk($('[role="dialog"] .oe_button_box button').attr('disabled'), + assert.notOk($('.modal .oe_button_box button').attr('disabled'), "stat buttons should be enabled"); - $('[role="dialog"] .oe_button_box button').click(); + $('.modal .oe_button_box button').click(); - assert.ok($('[role="dialog"] .oe_button_box button').attr('disabled'), + assert.ok($('.modal .oe_button_box button').attr('disabled'), "stat buttons should be disabled"); def.resolve(); - assert.notOk($('[role="dialog"] .oe_button_box button').attr('disabled'), + assert.notOk($('.modal .oe_button_box button').attr('disabled'), "stat buttons should be enabled"); form.destroy(); @@ -6079,16 +6079,16 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_edit').click(); form.$('.o_field_x2many_list_row_add a').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, "One FormViewDialog should be opened"); // set a value on the m2o var $dropdown = form.$('.o_field_many2one input').autocomplete('widget'); - $('[role="dialog"] .o_field_many2one input').click(); + $('.modal .o_field_many2one input').click(); $dropdown.find('li:first()').click(); - $('footer.modal-footer button:eq(1)').click(); // Save & new - $('[role="dialog"] .o_field_many2one input').click(); - $('footer.modal-footer button:first').click(); // Save & close + $('.modal-footer button:eq(1)').click(); // Save & new + $('.modal .o_field_many2one input').click(); + $('.modal-footer button:first').click(); // Save & close form.destroy(); }); @@ -6178,20 +6178,20 @@ QUnit.module('Views', { }); form.$('.o_field_x2many_list_row_add a').click(); - assert.strictEqual($('[role="dialog"] input.o_field_widget[name=foo]').length, 1, + assert.strictEqual($('.modal input.o_field_widget[name=foo]').length, 1, 'foo should be editable'); checkOnchange = true; - $('[role="dialog"] .o_field_widget[name=foo]').val('foo value').trigger('input'); - $('[role="dialog"] .o_field_widget[name=display_name]').val('readonly').trigger('input'); - assert.strictEqual($('[role="dialog"] span.o_field_widget[name=foo]').length, 1, + $('.modal .o_field_widget[name=foo]').val('foo value').trigger('input'); + $('.modal .o_field_widget[name=display_name]').val('readonly').trigger('input'); + assert.strictEqual($('.modal span.o_field_widget[name=foo]').length, 1, 'foo should be readonly'); - $('footer.modal-footer .btn-primary').click(); // close the modal + $('.modal-footer .btn-primary').click(); // close the modal checkOnchange = false; form.$('.o_data_row').click(); // re-open previous record - assert.strictEqual($('[role="dialog"] .o_field_widget[name=foo]').text(), 'foo value', + assert.strictEqual($('.modal .o_field_widget[name=foo]').text(), 'foo value', "the edited value should have been kept"); - $('footer.modal-footer .btn-primary').click(); // close the modal + $('.modal-footer .btn-primary').click(); // close the modal form.$buttons.find('.o_form_button_save').click(); // save the record @@ -6264,8 +6264,8 @@ QUnit.module('Views', { form.$buttons.find('.o_form_button_save').click(); // save duplicated record form.sidebar.$('a:contains(Delete)').click(); // delete duplicated record - assert.strictEqual($('[role="dialog"]').length, 1, "should have opened a confirm dialog"); - $('footer.modal-footer .btn-primary').click(); // confirm + assert.strictEqual($('.modal').length, 1, "should have opened a confirm dialog"); + $('.modal-footer .btn-primary').click(); // confirm assert.strictEqual(form.$('.o_field_widget').text(), 'first record', "should have come back to previous record"); @@ -6346,12 +6346,12 @@ QUnit.module('Views', { }); form.$('.o_external_button').click(); // open the many2one record in a modal - $('[role="dialog"] .o_external_button').click(); // in the modal, open the many2one record in another modal + $('.modal .o_external_button').click(); // in the modal, open the many2one record in another modal - $('[role="dialog"]:nth(1) .o_field_widget[name=display_name]').val('new name').trigger('input'); - $('[role="dialog"]:nth(1) footer .btn-primary').first().click(); // save changes + $('.modal:nth(1) .o_field_widget[name=display_name]').val('new name').trigger('input'); + $('.modal:nth(1) footer .btn-primary').first().click(); // save changes - assert.strictEqual($('[role="dialog"] .o_field_widget[name=trululu] input').val(), 'new name', + assert.strictEqual($('.modal .o_field_widget[name=trululu] input').val(), 'new name', "record should have been reloaded"); assert.verifySteps([ "read", // main record @@ -6454,11 +6454,11 @@ QUnit.module('Views', { viewOptions: {mode: 'edit'}, }); form.$('.o_external_button').click(); - assert.strictEqual($('main.modal-body .o_form_view .o_list_view .o_data_cell').text(), "yopblip", + assert.strictEqual($('.modal-body .o_form_view .o_list_view .o_data_cell').text(), "yopblip", "table has some initial order"); - $('main.modal-body .o_form_view .o_list_view th').click(); - assert.strictEqual($('main.modal-body .o_form_view .o_list_view .o_data_cell').text(), "blipyop", + $('.modal-body .o_form_view .o_list_view th').click(); + assert.strictEqual($('.modal-body .o_form_view .o_list_view .o_data_cell').text(), "blipyop", "table is now sorted"); form.destroy(); }); @@ -6894,7 +6894,7 @@ QUnit.module('Views', { core.bus.on('clear_cache', form, assert.step.bind(assert, 'clear_cache')); form.sidebar.$('a:contains(Delete)').click(); - $('footer.modal-footer .btn-primary').click(); // confirm + $('.modal-footer .btn-primary').click(); // confirm assert.verifySteps(['unlink', 'clear_cache']); diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index 6f6d9a5b386..1f7e2065638 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -183,12 +183,12 @@ QUnit.module('Views', { "last column should contain 3 records"); envIDs = [4]; kanban.$('.o_kanban_group:last .o_column_archive_records').click(); // Click on 'Archive All' - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-default').click(); // Click on 'Cancel' + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-default').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($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // Click on 'Ok' + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // Click on 'Ok' assert.strictEqual(kanban.$('.o_kanban_group:last .o_kanban_record').length, 0, "last column should not contain any records"); kanban.destroy(); }); @@ -1205,16 +1205,16 @@ QUnit.module('Views', { which: $.ui.keyCode.ENTER, })); - assert.strictEqual($('[role="dialog"] .o_form_view.o_form_editable').length, 1, + assert.strictEqual($('.modal .o_form_view.o_form_editable').length, 1, "a form view dialog should have been opened (in edit)"); - assert.strictEqual($('[role="dialog"] .o_field_many2one input').val(), 'hello', + assert.strictEqual($('.modal .o_field_many2one input').val(), 'hello', "the correct product_id should already be set"); // specify a name and save - $('[role="dialog"] input[name=foo]').val('test').trigger('input'); - $('footer.modal-footer .btn-primary').click(); + $('.modal input[name=foo]').val('test').trigger('input'); + $('.modal-footer .btn-primary').click(); - assert.strictEqual($('[role="dialog"]').length, 0, "the modal should be closed"); + assert.strictEqual($('.modal').length, 0, "the modal should be closed"); assert.strictEqual(kanban.$('.o_kanban_group:first .o_kanban_record').length, 3, "there should be 3 records in first column"); var $firstRecord = kanban.$('.o_kanban_group:first .o_kanban_record:first'); @@ -1794,13 +1794,13 @@ 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($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-default').click(); // click on cancel + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-default').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 - assert.ok($('[role="dialog"]').length, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // click on confirm + assert.ok($('.modal').length, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // click on confirm assert.strictEqual(kanban.$('.o_kanban_group:last').data('id'), 3, 'last column should now be [3, "hello"]'); assert.strictEqual(kanban.$('.o_kanban_group').length, 2, "should still have two columns"); @@ -1871,7 +1871,7 @@ QUnit.module('Views', { assert.strictEqual(kanban.$('.o_kanban_group').length, 3, "should have two columns"); kanban.$('.o_kanban_group:last .o_column_delete').click(); - $('footer.modal-footer .btn-primary').click(); + $('.modal-footer .btn-primary').click(); assert.strictEqual(kanban.$('.o_kanban_group').length, 2, "should have twos columns"); @@ -1913,33 +1913,33 @@ QUnit.module('Views', { // edit the title of column [5, 'xmo'] and close without saving kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit' - assert.ok($('[role="dialog"] .o_form_editable').length, 'a form view should be open in a modal'); - assert.strictEqual($('[role="dialog"] .o_form_editable input').val(), 'xmo', + assert.ok($('.modal .o_form_editable').length, 'a form view should be open in a modal'); + assert.strictEqual($('.modal .o_form_editable input').val(), 'xmo', 'the name should be "xmo"'); - $('[role="dialog"] .o_form_editable input').val('ged').trigger('input'); // change the value + $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value nbRPCs = 0; - $('header.modal-header .close').click(); // click on the cross to close the modal - assert.ok(!$('[role="dialog"]').length, 'the modal should be closed'); + $('.modal-header .close').click(); // click on the cross to close the modal + 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"'); assert.strictEqual(nbRPCs, 0, 'no RPC should have been done'); // edit the title of column [5, 'xmo'] and discard kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit' - $('[role="dialog"] .o_form_editable input').val('ged').trigger('input'); // change the value + $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value nbRPCs = 0; - $('footer.modal-footer .btn-default').click(); // click on discard - assert.ok(!$('[role="dialog"]').length, 'the modal should be closed'); + $('.modal-footer .btn-default').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"'); assert.strictEqual(nbRPCs, 0, 'no RPC should have been done'); // edit the title of column [5, 'xmo'] and save kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit' - $('[role="dialog"] .o_form_editable input').val('ged').trigger('input'); // change the value + $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value nbRPCs = 0; - $('footer.modal-footer .btn-primary').click(); // click on save - assert.ok(!$('[role="dialog"]').length, 'the modal should be closed'); + $('.modal-footer .btn-primary').click(); // click on save + assert.ok(!$('.modal').length, 'the modal should be closed'); assert.strictEqual(kanban.$('.o_kanban_group[data-id=5] .o_column_title').text(), 'ged', 'title of the column should be "ged"'); assert.strictEqual(nbRPCs, 4, 'should have done 1 write, 1 read_group and 2 search_read'); @@ -2059,16 +2059,16 @@ QUnit.module('Views', { // click to see the examples kanban.$('.o_column_quick_create .o_kanban_examples').click(); - assert.strictEqual($('[role="dialog"] .o_kanban_examples_dialog').length, 1, + assert.strictEqual($('.modal .o_kanban_examples_dialog').length, 1, "should have open the examples dialog"); - assert.strictEqual($('[role="dialog"] .o_kanban_examples_dialog_nav li').length, 2, + assert.strictEqual($('.modal .o_kanban_examples_dialog_nav li').length, 2, "should have two examples (in the menu)"); - assert.strictEqual($('[role="dialog"] .o_kanban_examples_dialog_nav a').text(), + assert.strictEqual($('.modal .o_kanban_examples_dialog_nav a').text(), ' A first example A second example ', "example names should be correct"); - assert.strictEqual($('[role="dialog"] .o_kanban_examples_dialog_content .tab-pane').length, 2, + assert.strictEqual($('.modal .o_kanban_examples_dialog_content .tab-pane').length, 2, "should have two examples"); - var $firstPane = $('[role="dialog"] .o_kanban_examples_dialog_content .tab-pane:first'); + var $firstPane = $('.modal .o_kanban_examples_dialog_content .tab-pane:first'); assert.strictEqual($firstPane.find('.o_kanban_examples_group').length, 3, "there should be 3 stages in the first example"); assert.strictEqual($firstPane.find('h6').text(), 'Column 1Column 2Column 3', @@ -2076,7 +2076,7 @@ QUnit.module('Views', { assert.strictEqual($firstPane.find('.o_kanban_examples_description').text().trim(), "Some description", "the correct description should be displayed"); - var $secondPane = $('[role="dialog"] .o_kanban_examples_dialog_content .tab-pane:nth(1)'); + var $secondPane = $('.modal .o_kanban_examples_dialog_content .tab-pane:nth(1)'); assert.strictEqual($secondPane.find('.o_kanban_examples_group').length, 2, "there should be 2 stages in the second example"); assert.strictEqual($secondPane.find('h6').text(), 'Col 1Col 2', diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 3aa5f6e7c70..52b7eaed31b 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -430,7 +430,7 @@ QUnit.module('Views', { var $td = form.$('.o_data_cell').first(); var $td2 = form.$('.o_data_cell').eq(1); assert.ok($td.hasClass("o_readonly_modifier"), "first field must be readonly"); - assert.ok($td2.hasClass("o_boolean_toggle_cell"), "second field must be not activable but updatable on click (boolean toggle in this case)"); + assert.ok($td2.hasClass("o_boolean_toggle_cell"), "second field must be not activable but updatable on click (boolean toggle in this case)"); $td.click(); //select row first var $slider = $td2.find('.slider').first(); try { @@ -880,7 +880,7 @@ QUnit.module('Views', { list.sidebar.$('a:contains(Delete)').click(); assert.ok($('body').hasClass('modal-open'), 'body should have modal-open clsss'); - $('body [role="dialog"] button span:contains(Ok)').click(); + $('body .modal button span:contains(Ok)').click(); assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 3, "should have 3 records"); list.destroy(); @@ -916,13 +916,13 @@ QUnit.module('Views', { assert.verifySteps(['/web/dataset/search_read']); list.sidebar.$('a:contains(Archive)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-default').click(); // Click on 'Cancel' + assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed'); + $('.modal-footer .btn-default').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(); - assert.strictEqual($('[role="dialog"]').length, 1, 'a confirm modal should be displayed'); - $('footer.modal-footer .btn-primary').click(); // Click on 'Ok' + assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed'); + $('.modal-footer .btn-primary').click(); // Click on 'Ok' assert.strictEqual(list.$('tbody td.o_list_record_selector').length, 3, "should have 3 records"); assert.verifySteps(['/web/dataset/search_read', '/web/dataset/call_kw/foo/write', '/web/dataset/search_read']); list.destroy(); @@ -2759,10 +2759,10 @@ QUnit.module('Views', { list.$('.o_data_cell:first').click(); list.$('input[name="foo"]').val("hello").trigger('input'); list.$buttons.find('.o_list_button_discard').click(); - assert.strictEqual($('[role="dialog"]:visible').length, 1, + assert.strictEqual($('.modal:visible').length, 1, "a modal to ask for discard should be visible"); - $('[role="dialog"]:visible .btn-primary').click(); + $('.modal:visible .btn-primary').click(); assert.strictEqual(list.$('.o_data_cell:first').text(), "yop", "first cell should still contain 'yop'"); @@ -3555,7 +3555,7 @@ QUnit.module('Views', { // delete a record list.$('.o_data_row:first .o_list_record_selector input').click(); list.sidebar.$('a:contains(Delete)').click(); - $('footer.modal-footer .btn-primary').click(); // confirm + $('.modal-footer .btn-primary').click(); // confirm assert.verifySteps([ 'create', diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js index 14ec4402061..1e57474e4b5 100644 --- a/addons/web/static/tests/views/view_dialogs_tests.js +++ b/addons/web/static/tests/views/view_dialogs_tests.js @@ -90,9 +90,9 @@ QUnit.module('Views', { res_id: 1, }).open(); - assert.notOk($('main.modal-body button').length, + assert.notOk($('.modal-body button').length, "should not have any button in body"); - assert.strictEqual($('footer.modal-footer button').length, 1, + assert.strictEqual($('.modal-footer button').length, 1, "should have only one button in footer"); parent.destroy(); }); @@ -118,7 +118,7 @@ QUnit.module('Views', { res_id: 1, }).open(); - assert.strictEqual($('[role="dialog"] button.btn-primary').length, 1, + assert.strictEqual($('.modal button.btn-primary').length, 1, "should have 1 buttons in modal"); $('.o_field_x2many_list_row_add a').click(); @@ -127,7 +127,7 @@ QUnit.module('Views', { keyCode: $.ui.keyCode.ESCAPE, })); - assert.strictEqual($('[role="dialog"] button.btn-primary').length, 1, + assert.strictEqual($('.modal button.btn-primary').length, 1, "should still have 1 buttons in modal"); parent.destroy(); }); @@ -321,7 +321,7 @@ QUnit.module('Views', { return $.when(false); } if (route === '/web/dataset/call_kw/instrument/create') { - assert.deepEqual(args.args, [{badassery: [[6, false, [1]]], name: false}], + assert.deepEqual(args.args, [{badassery: [[6, false, [1]]], name: false}], 'The method create should have been called with the right arguments'); return $.when(false); } diff --git a/addons/web/static/tests/widgets/data_export_tests.js b/addons/web/static/tests/widgets/data_export_tests.js index 4948db07474..4569a5a6290 100644 --- a/addons/web/static/tests/widgets/data_export_tests.js +++ b/addons/web/static/tests/widgets/data_export_tests.js @@ -107,15 +107,15 @@ QUnit.module('widgets', { list.$('thead th.o_list_record_selector input').click(); list.sidebar.$('a:contains(Export)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, "a modal dialog should be open"); + assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); assert.strictEqual($('span.o_tree_column:contains(Activities)').length, 1, "the Activities field should be in the list of exportable fields"); // select the field Description, click on add, then export and close - $('[role="dialog"] span:contains(Description)').click(); - $('[role="dialog"] .o_add_field').click(); - $('[role="dialog"] span:contains(Export To File)').click(); - $('[role="dialog"] span:contains(Close)').click(); + $('.modal span:contains(Description)').click(); + $('.modal .o_add_field').click(); + $('.modal span:contains(Export To File)').click(); + $('.modal span:contains(Close)').click(); list.destroy(); framework.blockUI = blockUI; @@ -185,26 +185,26 @@ QUnit.module('widgets', { // Open the export modal list.$('thead th.o_list_record_selector input').click(); list.sidebar.$('a:contains(Export)').click(); - assert.strictEqual($('[role="dialog"]').length, 1, + assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); // Select 'Activities' in fields to export - assert.strictEqual($('[role="dialog"] select.o_fields_list option').length, 0, + assert.strictEqual($('.modal select.o_fields_list option').length, 0, "the fields list should be empty"); - $('[role="dialog"] .o_export_tree_item:contains(Activities)').click(); - $('[role="dialog"] button:contains(Add)').click(); - assert.strictEqual($('[role="dialog"] select.o_fields_list option').length, 1, + $('.modal .o_export_tree_item:contains(Activities)').click(); + $('.modal button:contains(Add)').click(); + assert.strictEqual($('.modal select.o_fields_list option').length, 1, "there should be one item in the fields list"); // Save fields list - $('[role="dialog"] a:contains(Save fields list)').click(); - $('[role="dialog"] .o_save_list > input').val('fields list').trigger('input'); - $('[role="dialog"] .o_save_list > button').click(); + $('.modal a:contains(Save fields list)').click(); + $('.modal .o_save_list > input').val('fields list').trigger('input'); + $('.modal .o_save_list > button').click(); assert.verifySteps(['build_search_data', 'create'], "create should have been called"); // Close the modal and destroy list - $('[role="dialog"] button span:contains(Close)').click(); + $('.modal button span:contains(Close)').click(); list.destroy(); // restore create function diff --git a/addons/web_diagram/static/tests/diagram_tests.js b/addons/web_diagram/static/tests/diagram_tests.js index 41c0ed4d32c..2927d6fe95f 100644 --- a/addons/web_diagram/static/tests/diagram_tests.js +++ b/addons/web_diagram/static/tests/diagram_tests.js @@ -152,9 +152,9 @@ QUnit.module('Views', { "diagram should only have the default nodes at start"); diagram.$buttons.find('.o_diagram_new_button').click(); - $('main.modal-body input:first').val('a new node').trigger('input'); - $('main.modal-body input:last').val(1).trigger('input'); - $('footer.modal-footer button.btn-primary').click(); // save + $('.modal-body input:first').val('a new node').trigger('input'); + $('.modal-body input:last').val(1).trigger('input'); + $('.modal-footer button.btn-primary').click(); // save assert.strictEqual(diagram.$('.o_diagram ellipse').length, 3, "diagram should contain 3 'ellipse' nodes now (nodes 2, 3 and the new one)"); @@ -184,8 +184,8 @@ QUnit.module('Views', { "diagram first node should have default name at first"); CuteNode.double_click_callback({id: 1}); - $('main.modal-body input:first').val('An edited node').trigger('input'); - $('footer.modal-footer button.btn-primary').click(); // save + $('.modal-body input:first').val('An edited node').trigger('input'); + $('.modal-footer button.btn-primary').click(); // save assert.strictEqual(diagram.$('text').first().text(), 'An edited node', "diagram first node should now have new name"); @@ -212,7 +212,7 @@ QUnit.module('Views', { "diagram should contain 2 'ellipse' nodes (nodes 2 and 3)"); CuteNode.destruction_callback({id: 2}); - $('footer.modal-footer button.btn-primary').click(); // Confirm + $('.modal-footer button.btn-primary').click(); // Confirm assert.strictEqual(diagram.$('.o_diagram ellipse').length, 1, "diagram should contain 1 'ellipse' nodes (node 2)"); @@ -245,8 +245,8 @@ QUnit.module('Views', { get_start: function () {return {id: 1};}, get_end: function () {return {id: 3};}, }); - $('main.modal-body input:first').val('a transition from 1 to 3').trigger('input'); - $('footer.modal-footer button.btn-primary').click(); // Confirm + $('.modal-body input:first').val('a transition from 1 to 3').trigger('input'); + $('.modal-footer button.btn-primary').click(); // Confirm assert.strictEqual(diagram.$('.o_diagram path').length, 5, "diagram should contain 4 'path' nodes (#raphael-marker-block, transitions 1, 2, 3, and the new one)"); @@ -278,8 +278,8 @@ QUnit.module('Views', { "diagram should only have the default edges at start"); CuteEdge.double_click_callback({id: 1}); - $('main.modal-body input:first').val('An edited edge').trigger('input'); - $('footer.modal-footer button.btn-primary').click(); // save + $('.modal-body input:first').val('An edited edge').trigger('input'); + $('.modal-footer button.btn-primary').click(); // save assert.strictEqual(diagram.$('text:contains(a transition from 1 to 2)').length, 0, "diagram edge should not have default name anymore"); @@ -310,7 +310,7 @@ QUnit.module('Views', { "diagram edge should have default name at start"); CuteEdge.destruction_callback({id: 3}); - $('footer.modal-footer button.btn-primary').click(); // Confirm + $('.modal-footer button.btn-primary').click(); // Confirm assert.strictEqual(diagram.$('.o_diagram path').length, 3, "diagram should contain 3 'path' nodes (#raphael-marker-block, and transitions 1 and 2)"); diff --git a/addons/web_editor/static/lib/summernote/src/js/Renderer.js b/addons/web_editor/static/lib/summernote/src/js/Renderer.js index c6142333d30..7fa1afe3adc 100644 --- a/addons/web_editor/static/lib/summernote/src/js/Renderer.js +++ b/addons/web_editor/static/lib/summernote/src/js/Renderer.js @@ -817,7 +817,7 @@ define([ $dialog.addClass('note-air-layout'); $dialog.attr('id', 'note-dialog-' + id); $dialog.find('button.close, a.modal-close').click(function () { - $(this).closest('[role="dialog"]').modal('hide'); + $(this).closest('.modal').modal('hide'); }); $dialog.appendTo($container); }; @@ -905,7 +905,7 @@ define([ var $dialogContainer = options.dialogsInBody ? $(document.body) : $editor; var $dialog = $(tplDialogs(langInfo, options)).prependTo($dialogContainer); $dialog.find('button.close, a.modal-close').click(function () { - $(this).closest('[role="dialog"]').modal('hide'); + $(this).closest('.modal').modal('hide'); }); //09. Editor/Holder switch diff --git a/addons/web_editor/static/src/js/backend/fields.js b/addons/web_editor/static/src/js/backend/fields.js index 00c84c5fe92..a636b7e5be3 100644 --- a/addons/web_editor/static/src/js/backend/fields.js +++ b/addons/web_editor/static/src/js/backend/fields.js @@ -400,7 +400,7 @@ var FieldTextHtml = AbstractField.extend({ return src; }, old_initialize_content: function () { - this.$el.closest('main.modal-body').css('max-height', 'none'); + this.$el.closest('.modal-body').css('max-height', 'none'); this.$iframe = this.$el.find('iframe'); this.document = null; this.$body = $(); diff --git a/addons/web_editor/static/src/js/tours/rte.js b/addons/web_editor/static/src/js/tours/rte.js index 6d686353cfb..82c31da5259 100644 --- a/addons/web_editor/static/src/js/tours/rte.js +++ b/addons/web_editor/static/src/js/tours/rte.js @@ -157,7 +157,7 @@ tour.register('rte', { trigger: '#editor-media-icon.active span.fa:first', }, { content: "save pictogram", - trigger: 'footer.modal-footer .btn-primary', + trigger: '.modal-footer > .btn-primary', extra_trigger: '#editor-media-icon.active span.o_selected', }, { content: "select a size for the pictogram", @@ -180,7 +180,7 @@ tour.register('rte', { extra_trigger: 'a#link-preview:containsRegex(/^<span [^>]+><\\/span>$/) > span.fa.fa-3x.pull-right', }, { content: "save link", - trigger: 'footer.modal-footer .btn-primary', + trigger: '.modal-footer > .btn-primary', extra_trigger: 'a#link-preview.btn.btn-success span.fa.fa-3x.pull-right', }, { content: "click on other picture", @@ -200,7 +200,7 @@ tour.register('rte', { extra_trigger: 'a#link-preview:containsRegex(/^<img [^>]+>$/) img', }, { content: "save link", - trigger: 'footer.modal-footer .btn-primary', + trigger: '.modal-footer > .btn-primary', extra_trigger: 'a#link-preview.btn.btn-success[href="mailto:test@test.test"]:containsRegex(/^<img [^>]+>$/) img', }, { content: "select for triple enter then double backspace", diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index e6c15aeb4ff..e2dc7ea73a7 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -1171,7 +1171,7 @@ var MediaDialog = Dialog.extend({ var self = this; var defs = [this._super.apply(this, arguments)]; this.$modal.addClass('note-image-dialog'); - this.$modal.find('[role="dialog"]').addClass('o_select_media_dialog'); + this.$modal.find('.modal-dialog').addClass('o_select_media_dialog'); if (this.imageDialog) { defs.push(this.imageDialog.appendTo(this.$("#editor-media-image"))); diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index c9206d06ec2..895844f050e 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -160,7 +160,7 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { update: function (tour_name) { if (this.paused) return; - this.$modal_displayed = $('[role="dialog"]:visible').last(); + this.$modal_displayed = $('.modal:visible').last(); tour_name = this.running_tour || tour_name; if (tour_name) { @@ -325,14 +325,7 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { _set_running_tour_timeout: function (tour_name, step) { this._stop_running_tour_timeout(); this.running_tour_timeout = setTimeout((function() { - var message; - if (step.extra_trigger) { - message = _.str.sprintf('Tour %s failed at step "%s" with trigger "%s" and extra trigger "%s"', - tour_name, step.content, step.trigger, step.extra_trigger); - } else { - message = _.str.sprintf('Tour %s failed at step "%s" with trigger "%s"', tour_name, step.content, step.trigger); - } - this._consume_tour(tour_name, message); + this._consume_tour(tour_name, _.str.sprintf("Tour %s failed at step %s", tour_name, step.trigger)); }).bind(this), (step.timeout || RUNNING_TOUR_TIMEOUT) + this.running_step_delay); }, _stop_running_tour_timeout: function () { @@ -365,7 +358,6 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { MENU_MORE: { edition: "community", trigger: "body > header > nav", - content: _t('Click on the <i>More icon</i> to show hidden apps.'), position: "bottom", auto: true, run: function (actions) { diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index 7221ee40e6c..602556c03cc 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -740,7 +740,7 @@ registry.gallery = Animation.extend({ $(this).siblings().filter('.modal-backdrop').remove(); // bootstrap leaves a modal-backdrop $(this).remove(); }); - $modal.find('[role="dialog"] .modal-content, main.modal-body.o_slideshow').css('height', '100%'); + $modal.find('.modal-content, .modal-body.o_slideshow').css('height', '100%'); $modal.appendTo(document.body); this.carousel = new registry.gallery_slider($modal.find('.carousel').carousel()); diff --git a/addons/website/static/src/js/menu/mobile_view.js b/addons/website/static/src/js/menu/mobile_view.js index 0969efda7a1..acfd28042c9 100644 --- a/addons/website/static/src/js/menu/mobile_view.js +++ b/addons/website/static/src/js/menu/mobile_view.js @@ -17,7 +17,7 @@ var MobilePreviewDialog = Dialog.extend({ start: function () { var self = this; this.$modal.addClass('oe_mobile_preview'); - this.$modal.on('click', 'header.modal-header', function () { + this.$modal.on('click', '.modal-header', function () { self.$el.toggleClass('o_invert_orientation'); }); this.$iframe = $('<iframe/>', { diff --git a/addons/website/static/src/js/tours/rte.js b/addons/website/static/src/js/tours/rte.js index 7b9964c5e20..7ce549a0346 100644 --- a/addons/website/static/src/js/tours/rte.js +++ b/addons/website/static/src/js/tours/rte.js @@ -16,8 +16,8 @@ tour.register('rte_translator', { run: 'text "fr_BE"', }, { content: "load french", - trigger: 'footer.modal-footer button:first', - extra_trigger: '[role="dialog"] select[name="lang"]:propValueContains(fr_BE)', + trigger: '.modal-footer button:first', + extra_trigger: '.modal select[name="lang"]:propValueContains(fr_BE)', }, { content : "click language dropdown", trigger : '.js_language_selector .dropdown-toggle', @@ -72,7 +72,7 @@ tour.register('rte_translator', { trigger: 'html:not(:has(#wrap p span)) .o_menu_systray a[data-action="translate"]', }, { content: "close modal", - trigger: 'footer.modal-footer .btn-default', + trigger: '.modal-footer .btn-default', }, { content: "check if translation is activate", trigger: '[data-oe-translation-id]', @@ -101,8 +101,8 @@ tour.register('rte_translator', { run: 'text test french placeholder', }, { content: "close modal", - trigger: 'footer.modal-footer .btn-primary', - extra_trigger: '[role="dialog"] input:propValue(test french placeholder)', + trigger: '.modal-footer .btn-primary', + extra_trigger: '.modal input:propValue(test french placeholder)', }, { content: "save translation", trigger: 'button[data-action=save]', diff --git a/addons/website_blog/static/src/js/website.tour.blog.js b/addons/website_blog/static/src/js/website.tour.blog.js index 3c464987559..f42f21142a1 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -30,12 +30,12 @@ odoo.define("website_blog.tour", function (require) { content: _t("Click here to change your post cover."), position: "right", }, { - trigger: ".o_existing_attachment_cell:nth(1) img", - extra_trigger: '.modal-dialog:has(.o_existing_attachment_cell:nth(1))', + trigger: ".o_select_media_dialog .o_existing_attachment_cell:nth(1) img", + extra_trigger: '.modal:has(.o_existing_attachment_cell:nth(1))', content: _t("Choose an image from the library."), position: "top", }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".o_select_media_dialog .modal-footer > .btn-primary", extra_trigger: ".o_existing_attachment_cell.o_selected", content: _t("Click on <b>Save</b> to set the picture as cover."), position: "top", @@ -59,7 +59,7 @@ odoo.define("website_blog.tour", function (require) { position: "bottom", }, { trigger: "button[data-dismiss=modal]", - extra_trigger: '[role="dialog"]:has(#mobile-viewport)', + extra_trigger: '.modal:has(#mobile-viewport)', content: _t("Once you have reviewed the content on mobile, close the preview."), position: "right", }, { diff --git a/addons/website_event/static/src/js/website.tour.event.js b/addons/website_event/static/src/js/website.tour.event.js index b5cd2738a7d..abaea26c4b8 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -19,7 +19,7 @@ odoo.define("website_event.tour", function (require) { content: _t("Create a name for your new event and click <em>\"Continue\"</em>. e.g: Technical Training"), position: "right", }, { - trigger: 'footer.modal-footer button.btn-primary.btn-continue', + trigger: '.modal-footer button.btn-primary.btn-continue', extra_trigger: '#editor_new_event input[type=text][value!=""]', content: _t("Click <em>Continue</em> to create the event."), position: "right", diff --git a/addons/website_event/static/src/js/website_event.js b/addons/website_event/static/src/js/website_event.js index 348d3d0f16e..53a304c707e 100644 --- a/addons/website_event/static/src/js/website_event.js +++ b/addons/website_event/static/src/js/website_event.js @@ -60,7 +60,7 @@ var EventRegistrationForm = Widget.extend({ return ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) { var $modal = $(modal); $modal.modal({backdrop: 'static', keyboard: false}); - $modal.find('main.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19 + $modal.find('.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19 $modal.insertAfter($form).modal(); $modal.on('click', '.js_goto_event', function () { $modal.modal('hide'); diff --git a/addons/website_event_questions/views/event_templates.xml b/addons/website_event_questions/views/event_templates.xml index c98e5b465b5..490c9b20473 100644 --- a/addons/website_event_questions/views/event_templates.xml +++ b/addons/website_event_questions/views/event_templates.xml @@ -30,7 +30,7 @@ </xpath> <!-- Generic questions --> - <xpath expr='//div[@role="dialog"]//main/div/t[last()]' position="after"> + <xpath expr="//*[hasclass('modal-body')]/div/t[last()]" position="after"> <t t-if="event.general_question_ids"> <h4 class="page-header mt8"><strong>Questions</strong></h4> <div> diff --git a/addons/website_forum/static/src/js/website_tour_forum.js b/addons/website_forum/static/src/js/website_tour_forum.js index c6b39cd543e..bd041f58714 100644 --- a/addons/website_forum/static/src/js/website_tour_forum.js +++ b/addons/website_forum/static/src/js/website_tour_forum.js @@ -20,7 +20,7 @@ odoo.define("website_forum.tour_forum", function (require) { position: "right", }, { trigger: "button.btn-primary", - extra_trigger: '#editor_new_forum input[type=text]:not(:propValue(""))', + extra_trigger: '.modal #editor_new_forum input[type=text]:not(:propValue(""))', content: _t("Click <em>Continue</em> to create the forum."), position: "right", }, { @@ -51,7 +51,7 @@ odoo.define("website_forum.tour_forum", function (require) { content: _t("Click to post your question."), position: "bottom", }, { - trigger: "header.modal-header button.close", + trigger: ".modal-header button.close", auto: true, }, { trigger: ".note-editable p", @@ -64,7 +64,7 @@ odoo.define("website_forum.tour_forum", function (require) { content: _t("Click to post your answer."), position: "bottom", }, { - trigger: "header.modal-header button.close", + trigger: ".modal-header button.close", auto: true, }, { trigger: "a[data-karma=\"20\"]:first", diff --git a/addons/website_quote/views/website_quote_templates.xml b/addons/website_quote/views/website_quote_templates.xml index 7c6614a80a5..f82920e0174 100644 --- a/addons/website_quote/views/website_quote_templates.xml +++ b/addons/website_quote/views/website_quote_templates.xml @@ -177,7 +177,7 @@ </xpath> </template> - <!-- duplicata of the template payment.payment_confirmation_status. + <!-- duplicata of the template payment.payment_confirmation_status. The duplication avoid to break an existing installation in stable version--> <template id="payment_confirmation_status"> <div t-if="payment_tx_id and payment_tx_id.state == 'done'" class="alert alert-success alert-dismissable" role="status"> @@ -217,10 +217,10 @@ <div class="bs-sidebar"> <div class="text-center" t-if="quotation.state in ('draft', 'sent', 'waiting_date')" style="padding: 10px"> <a role="button" t-if="order_valid and not quotation.signature and quotation.has_to_be_signed()" class="btn btn-primary btn-block" data-toggle="modal" data-target="#modalaccept"> - <span class="fa fa-check"> Accept Order</span> + <i class="fa fa-check"/> Accept Order </a> <a role="button" t-elif="order_valid and quotation.has_to_be_paid()" class="btn btn-primary btn-block" data-toggle="modal" data-target="#modalaccept"> - <span class="fa fa-check"> <t t-if="not quotation.signature">Accept & </t>Pay</span> + <i class="fa fa-check"/> <t t-if="not quotation.signature">Accept & </t>Pay </a> <a role="button" t-if="not order_valid" href="#discussion" class="btn btn-info btn-block o_normalwhitespace"> <strong>This offer expired!</strong><br/> @@ -701,6 +701,6 @@ <t t-else=""> <a t-attf-href="/my/orders/#{quotation.id}?#{keep_query()}"><t t-esc="quotation.name"/></a> </t> - </xpath> + </xpath> </template> </odoo> diff --git a/addons/website_sale/static/src/js/website_sale_tour_shop.js b/addons/website_sale/static/src/js/website_sale_tour_shop.js index f0708ea58cd..c8778e9c0bb 100644 --- a/addons/website_sale/static/src/js/website_sale_tour_shop.js +++ b/addons/website_sale/static/src/js/website_sale_tour_shop.js @@ -20,11 +20,11 @@ odoo.define("website_sale.tour_shop", function (require) { content: _t("Select <b>New Product</b> to create it and manage its properties to boost your sales."), position: "bottom", }, { - trigger: "#editor_new_product input[type=text]", + trigger: ".modal-dialog #editor_new_product input[type=text]", content: _t("Enter a name for your new product"), position: "right", }, { - trigger: "footer.modal-footer button.btn-primary.btn-continue", + trigger: ".modal-footer button.btn-primary.btn-continue", content: _t("Click on <em>Continue</em> to create the product."), position: "right", }, { @@ -38,11 +38,11 @@ odoo.define("website_sale.tour_shop", function (require) { content: _t("Click here to set an image describing your product."), position: "top", }, { - trigger: ".o_upload_image_button", + trigger: ".o_select_media_dialog .o_upload_image_button", content: _t("Upload an image from your local library."), position: "bottom", run: function (actions) { - actions.auto("footer.modal-footer .btn-default"); + actions.auto(".modal-footer .btn-default"); }, }, { trigger: "#snippet_structure .oe_snippet:eq(8) .oe_snippet_thumbnail", diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 27423919a7d..af631ff0dd0 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -1300,7 +1300,7 @@ <div class="panel panel-default"> <div class="panel-headisng"></div> <div class="panel-body"> - <a class='pull-right no-decoration' href='/shop/checkout'><span class='fa fa-edit'> Edit</span></a> + <a class='pull-right no-decoration' href='/shop/checkout'><i class="fa fa-edit"/> Edit</a> <t t-set="same_shipping" t-value="bool(order.partner_shipping_id==order.partner_id or only_services)" /> <div><b>Billing<t t-if="same_shipping and not only_services"> & Shipping</t>: </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div> <div t-if="not same_shipping and not only_services" groups="sale.group_delivery_invoice_address"><b>Shipping: </b><span t-esc='order.partner_shipping_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div> diff --git a/addons/website_sale_comparison/static/src/xml/comparison.xml b/addons/website_sale_comparison/static/src/xml/comparison.xml index 9e48ded7cb8..fe9ebf8c15e 100644 --- a/addons/website_sale_comparison/static/src/xml/comparison.xml +++ b/addons/website_sale_comparison/static/src/xml/comparison.xml @@ -17,7 +17,7 @@ </div> </div> <div class="o_comparelist_button" style='display:none'> - <a role="button" class="btn btn-primary btn-block" href="#"><span class="fa fa-exchange mr4">Compare</span></a> + <a role="button" class="btn btn-primary btn-block" href="#"><i class="fa fa-exchange mr4"/>Compare</a> </div> </span> </span> diff --git a/addons/website_sale_options/static/src/js/website_sale.test.js b/addons/website_sale_options/static/src/js/website_sale.test.js index 78c6ea53c8f..d1e8f74ce22 100644 --- a/addons/website_sale_options/static/src/js/website_sale.test.js +++ b/addons/website_sale_options/static/src/js/website_sale.test.js @@ -180,7 +180,7 @@ tour.register('shop_customize', { { content: "click in modal on 'Proceed to checkout' button", extra_trigger: 'body:has(.js_product:contains(Warranty) a:contains(Add to Cart):hidden)', - trigger: 'footer.modal-footer a:contains("Proceed to Checkout")', + trigger: '.modal-footer a:contains("Proceed to Checkout")', }, { content: "check quantity", diff --git a/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml b/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml index d11ea0e4595..8d76af6cd1f 100644 --- a/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml +++ b/addons/website_sale_wishlist/views/website_sale_wishlist_template.xml @@ -31,9 +31,8 @@ <t t-set='wishcount' t-value="len(request.env['product.wishlist'].current())"/> <li id="my_wish" t-att-style="not wishcount and 'display:none;'"> <a href="/shop/wishlist"> - <span class="fa fa-heart"> - Wishlist <sup t-attf-class="my_wish_quantity o_animate_blink label label-primary"><t t-esc='wishcount'/></sup> - </span> + <i class="fa fa-heart"/> + Wishlist <sup t-attf-class="my_wish_quantity o_animate_blink label label-primary"><t t-esc='wishcount'/></sup> </a> </li> </t> diff --git a/addons/website_slides/static/src/js/slides_upload.js b/addons/website_slides/static/src/js/slides_upload.js index 29d5e230ec8..b3953f12571 100644 --- a/addons/website_slides/static/src/js/slides_upload.js +++ b/addons/website_slides/static/src/js/slides_upload.js @@ -355,12 +355,12 @@ var SlideDialog = Widget.extend({ values.website_published = true; } this.$('.oe_slides_upload_loading').show(); - this.$('footer.modal-footer, main.modal-body').hide(); + this.$('.modal-footer, .modal-body').hide(); ajax.jsonRpc("/slides/add_slide", 'call', values).then(function (data) { if (data.error) { self.display_alert(data.error); self.$('.oe_slides_upload_loading').hide(); - self.$('footer.modal-footer, main.modal-body').show(); + self.$('.modal-footer, .modal-body').show(); } else { window.location = data.url; diff --git a/addons/website_slides/views/website_slides.xml b/addons/website_slides/views/website_slides.xml index 151a52f8bde..4903c4f3e88 100644 --- a/addons/website_slides/views/website_slides.xml +++ b/addons/website_slides/views/website_slides.xml @@ -124,7 +124,7 @@ <div class="col-md-8 col-sm-12 col-xs-12"> <ul class="nav nav-tabs nav-tabs-border" role="tablist"> <li t-attf-class="#{not slide_type and 'active' ''}"> - <a t-attf-href="/slides/#{slug(channel)}#{category and '/category/' + slug(category) or ''}"> <span class="fa fa-home"> Home</span></a> + <a t-attf-href="/slides/#{slug(channel)}#{category and '/category/' + slug(category) or ''}"> <i class="fa fa-home"/> Home</a> </li> <li t-if="header_object.nbr_presentations" t-attf-class="#{slide_type == 'presentation' and 'active' ''}"> <a t-attf-href="/slides/#{slug(channel)}#{category and '/category/' + slug(category) or ''}/presentation"> @@ -272,7 +272,7 @@ <t t-esc="category['name']"/> </span> <a t-attf-href="/slides/#{slug(channel)}/category/#{category['id']}" class="pull-right" t-if="category['total'] - 4 > 0 and category['id']"> - <span class="fa fa-arrow-right"> See all</span> + <i class="fa fa-arrow-right"/> See all </a> </div> </div> @@ -698,7 +698,7 @@ data-loading-text="Sending..." t-attf-data-slide-id="#{slide.id}" style="border-top-right-radius: 4px;border-bottom-right-radius: 4px;"> - <span class="fa fa-envelope-o">Send Email</span> + <i class="fa fa-envelope-o"/> Send Email </button> </span> </div> diff --git a/addons/website_theme_install/views/views.xml b/addons/website_theme_install/views/views.xml index 243e00f01a4..e78b76a53fb 100644 --- a/addons/website_theme_install/views/views.xml +++ b/addons/website_theme_install/views/views.xml @@ -91,7 +91,7 @@ action = { <!-- Add link to theme install in default customize modal --> <template id="customize_modal" inherit_id="website.theme_customize" priority="1"> - <xpath expr='//*[@role="dialog"]//header' position="inside"> + <xpath expr="//*[hasclass('modal-header')]" position="inside"> <a href="/web#action=website_theme_install.theme_install_kanban_action">See themes here</a> </xpath> </template> diff --git a/odoo/addons/test_main_flows/static/src/js/tour.js b/odoo/addons/test_main_flows/static/src/js/tour.js index 833a6233d49..db978890e8b 100644 --- a/odoo/addons/test_main_flows/static/src/js/tour.js +++ b/odoo/addons/test_main_flows/static/src/js/tour.js @@ -122,7 +122,7 @@ tour.register('main_flow_tour', { position: 'right', }, { trigger: ".o_field_widget[name=name] input", - extra_trigger: "[role=\"dialog\"]", + extra_trigger: ".modal-dialog", content: _t('Select a seller'), position: 'top', run: "text the_flow.vendor", @@ -135,12 +135,12 @@ tour.register('main_flow_tour', { position: 'right', run: "text 1", }, { - trigger: "footer.modal-footer .btn-primary:first", + trigger: ".modal-footer .btn-primary:first", extra_trigger: ".o_field_widget[name=name] > .o_external_button", // Wait name_create content: _t('Save & Close'), position: 'bottom', }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", content: _t('Save'), position: 'bottom', }, @@ -176,7 +176,7 @@ tour.register('main_flow_tour', { position: 'right', }, { trigger: ".o_field_widget[name=name] input", - extra_trigger: "[role=\"dialog\"]", + extra_trigger: ".modal-dialog", content: _t('Select a seller'), position: 'top', run: "text the_flow.vendor", @@ -190,11 +190,11 @@ tour.register('main_flow_tour', { position: 'right', run: "text 1", }, { - trigger: "footer.modal-footer .btn-primary:first", + trigger: ".modal-footer .btn-primary:first", content: _t('Save & Close'), position: 'bottom', }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", // Wait Save & Close and check value extra_trigger: ".o_field_widget[name=seller_ids] .o_data_row td:nth-child(2):contains('the_flow.vendor')", content: _t('Save'), @@ -326,8 +326,8 @@ tour.register('main_flow_tour', { run: function (actions) { actions.auto(); // if the one2many isn't editable, we have to close the dialog - if ($("footer.modal-footer .btn-primary").length) { - actions.auto("footer.modal-footer .btn-primary"); + if ($(".modal-footer .btn-primary").length) { + actions.auto(".modal-footer .btn-primary"); } }, }, { @@ -338,7 +338,7 @@ tour.register('main_flow_tour', { trigger: ".o_field_widget[name=product_id] input", // the one2many may be editable or not according to the modules installed, so // we have to handle both cases - extra_trigger: '.o_field_widget[name=order_line] .o_data_row:nth(1).o_selected_row, [role="dialog"]', + extra_trigger: '.o_field_widget[name=order_line] .o_data_row:nth(1).o_selected_row, .modal-dialog', content: _t("Select a product"), position: "right", run: "text the_flow.service", @@ -349,8 +349,8 @@ tour.register('main_flow_tour', { run: function (actions) { actions.auto(); // if the one2many isn't editable, we have to close the dialog - if ($("footer.modal-footer .btn-primary").length) { - actions.auto("footer.modal-footer .btn-primary"); + if ($(".modal-footer .btn-primary").length) { + actions.auto(".modal-footer .btn-primary"); } }, }, { @@ -368,11 +368,11 @@ tour.register('main_flow_tour', { position: "right", run: "text test@the_flow.com", },{ - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", content: _t("Save your changes"), position: "bottom", }, { - trigger: "footer.modal-footer .btn-primary span:contains('Send')", + trigger: ".modal-footer .btn-primary span:contains('Send')", content: _t("Try to send it to email"), position: "bottom", }, { @@ -440,8 +440,8 @@ tour.register('main_flow_tour', { content: _t("Click on schedulers"), position: "bottom" }, { - trigger: "footer.modal-footer .btn-primary", - extra_trigger: "[role=\"dialog\"]", + trigger: ".modal-footer .btn-primary", + extra_trigger: ".modal-dialog", content: _t("Run Schedulers"), position: "bottom", }, { @@ -471,8 +471,8 @@ tour.register('main_flow_tour', { content: _t("Validate"), position: "bottom", }, { - trigger: "footer.modal-footer .btn-primary", - extra_trigger: "[role=\"dialog\"]", + trigger: ".modal-footer .btn-primary", + extra_trigger: ".modal-dialog", content: _t("Apply"), position: "bottom", }, { @@ -497,12 +497,12 @@ tour.register('main_flow_tour', { position: "bottom", }, { trigger: "select.o_field_widget[name=journal_id]", - extra_trigger: "[role=\"dialog\"]", + extra_trigger: ".modal-dialog", content: _t("Select Journal"), position: "bottom", run: 'text(Bank (USD))', }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", extra_trigger: ".o_field_widget[name=payment_method_id]", // FIXME: Wait onchange content: _t("Validate"), position: "bottom", @@ -538,7 +538,7 @@ tour.register('main_flow_tour', { content: _t("Produce"), position: "bottom", }, { - trigger: "footer.modal-footer .btn-primary:first", + trigger: ".modal-footer .btn-primary:first", content: _t('Record Production'), position: 'bottom', }, { @@ -617,7 +617,7 @@ tour.register('main_flow_tour', { content: _t("Validate"), position: "bottom", }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", content: _t("Create and View Invoices"), position: "bottom", }, { @@ -630,12 +630,12 @@ tour.register('main_flow_tour', { position: "bottom", }, { trigger: "select.o_field_widget[name=journal_id]", - extra_trigger: "[role=\"dialog\"]", + extra_trigger: ".modal-dialog", content: _t("Select Journal"), position: "bottom", run: 'text(Bank (USD))', }, { - trigger: "footer.modal-footer .btn-primary", + trigger: ".modal-footer .btn-primary", content: _t("Validate"), position: "bottom", }, { diff --git a/odoo/addons/test_new_api/static/tests/x2many.js b/odoo/addons/test_new_api/static/tests/x2many.js index 4a088576050..d256d026325 100644 --- a/odoo/addons/test_new_api/static/tests/x2many.js +++ b/odoo/addons/test_new_api/static/tests/x2many.js @@ -31,7 +31,7 @@ odoo.define('web.test.x2many', function (require) { }, { content: "insert a name into the modal form", trigger: 'input.o_field_widget.o_required_modifier:first', - extra_trigger: '[role="dialog"]:visible', + extra_trigger: '.modal:visible', run: function (action_helper) { action_helper.text('user_test_' + (inc = new Date().getTime())); } @@ -44,7 +44,7 @@ odoo.define('web.test.x2many', function (require) { } }, { content: "save the modal content and create the new moderator", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'input.o_field_widget.o_required_modifier:propValueContains(@test)', }, { content: "check if the modal is saved", @@ -82,12 +82,12 @@ odoo.define('web.test.x2many', function (require) { trigger: '.tab-pane:eq(0) .o_field_x2many_list_row_add a' }, { content: "insert body a", - trigger: 'main.modal-body textarea:first', + trigger: '.modal-body textarea:first', run: 'text a', }, { content: "save new message a", - trigger: 'footer.modal-footer button:contains(Save):first', - extra_trigger: 'main.modal-body textarea:first:propValue(a)', + trigger: '.modal-footer button:contains(Save):first', + extra_trigger: '.modal-body textarea:first:propValue(a)', }, { // add message b content: "create new message b", trigger: '.tab-pane:eq(0) .o_field_x2many_list_row_add a', @@ -98,7 +98,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text b', }, { content: "save new message b", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(b)', }, { // change content to trigger on change content: "insert content", @@ -123,7 +123,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text bbb', }, { content: "save changes", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(bbb)', }, { // add message c content: "create new message c", @@ -135,7 +135,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text c', }, { content: "save new message c", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(c)', }, { // add participants content: "change tab to Participants", @@ -186,7 +186,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text d', }, { content: "save new message d", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(d)', }, { // add message e content: "create new message e", @@ -198,7 +198,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text e', }, { content: "save new message e", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(e)', }, { // change message a content: "edit message a", @@ -210,7 +210,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text aaa', }, { content: "save changes", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(aaa)', }, { // change message e content: "edit message e", @@ -235,7 +235,7 @@ odoo.define('web.test.x2many', function (require) { run: function () {}, // don't change texarea content }, { content: "save changes", - trigger: 'footer.modal-footer button:contains(Save):contains(Close)' + trigger: '.modal-footer button:contains(Save):contains(Close)' }, { content: "test one2many triggered the onchange on save for the line", trigger: '.o_content:has(.tab-pane:eq(0) .o_field_widget tbody tr td.o_readonly_modifier:contains([test_trigger] Demo User))', @@ -283,7 +283,7 @@ odoo.define('web.test.x2many', function (require) { }, { content: "select another user", trigger: '.o_field_many2one .o_input_dropdown > input', - extra_trigger: 'body:has([role="dialog"]) .tab-pane:eq(0) .o_field_widget tbody tr:has(td:containsExact(d))', + extra_trigger: 'body:has(.modal) .tab-pane:eq(0) .o_field_widget tbody tr:has(td:containsExact(d))', run: 'text Demo', }, { content: "select demo user", @@ -299,7 +299,7 @@ odoo.define('web.test.x2many', function (require) { run: 'text ddd', }, { content: "save new message ddd", - trigger: 'footer.modal-footer button:contains(Save):first', + trigger: '.modal-footer button:contains(Save):first', extra_trigger: 'textarea[name="body"]:first:propValue(ddd)', }, { // trigger onchange content: "blur the one2many", @@ -321,7 +321,7 @@ odoo.define('web.test.x2many', function (require) { run: 'click', }, { content: "confirm cancel change", - trigger: 'footer.modal-footer button:contains(Ok)', + trigger: '.modal-footer button:contains(Ok)', }, ///////////////////////////////////////////////////////////////////////////////////////////// @@ -516,6 +516,6 @@ odoo.define('web.test.x2many', function (require) { run: 'click', }, { content: "confirm cancel change", - trigger: 'footer.modal-footer button:contains(Ok)', + trigger: '.modal-footer button:contains(Ok)', }]); }); |
