diff --git a/app/code/Magento/Backend/view/adminhtml/web/js/store-switcher.js b/app/code/Magento/Backend/view/adminhtml/web/js/store-switcher.js index 1dc684afda9e5..e9bded2bb79c9 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/js/store-switcher.js +++ b/app/code/Magento/Backend/view/adminhtml/web/js/store-switcher.js @@ -79,7 +79,7 @@ define([ } }); - $('#store-change-button').click(); + $('#store-change-button').trigger('click'); } } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js index 0bb0a53ce0a6b..836c7a8c58471 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js @@ -11,7 +11,7 @@ define([ 'use strict'; return function (config, element) { - $(element).click(function (event) { + $(element).on('click', function (event) { var cart = customerData.get('cart'), customer = customerData.get('customer'); diff --git a/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js b/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js index 76b060015c5ff..e1115763c0896 100644 --- a/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js +++ b/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js @@ -25,7 +25,7 @@ define([ })); } - $('#customer-edit-delete-button').click(function () { + $('#customer-edit-delete-button').on('click', function () { var msg = $.mage.__('Are you sure you want to do this?'), url = $('#customer-edit-delete-button').data('url'); diff --git a/app/code/Magento/GiftMessage/view/frontend/web/js/gift-options.js b/app/code/Magento/GiftMessage/view/frontend/web/js/gift-options.js index e3d185db0cc5c..083065e0221ce 100644 --- a/app/code/Magento/GiftMessage/view/frontend/web/js/gift-options.js +++ b/app/code/Magento/GiftMessage/view/frontend/web/js/gift-options.js @@ -49,7 +49,7 @@ define([ .find('.giftmessage-area:not(:visible)').each(function (x, element) { if ($(element).val().length > 0) { $(element).trigger('change'); - container.find('a').click(); + container.find('a').trigger('click'); } }); } else { @@ -61,7 +61,7 @@ define([ }).end() .find('.giftmessage-area').val('').change().end() .find('.select').val('').change().end() - .find('.checkbox:checked').prop('checked', false).click().prop('checked', false).end() + .find('.checkbox:checked').prop('checked', false).trigger('click').prop('checked', false).end() .find('.price-box').addClass(this.options.noDisplay).end(); } }, diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js index e20e5a3235a6c..fe5ecb31ea6b9 100644 --- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js +++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image.js @@ -304,7 +304,7 @@ define([ * Action to close the context menu in media gallery. */ closeContextMenu: function () { - $(this.gridSelector).click(); + $(this.gridSelector).trigger('click'); }, /** diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/actions.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/actions.js index 21bfd9c0a4e0c..d0196b9d2e59b 100644 --- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/actions.js +++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/actions.js @@ -72,7 +72,7 @@ define([ * Initialize image action events */ initEvents: function () { - $(this.imageModel().addSelectedBtnSelector).click(function () { + $(this.imageModel().addSelectedBtnSelector).on('click', function () { image.insertImage( this.imageModel().getSelected(), { @@ -81,7 +81,7 @@ define([ } ); }.bind(this)); - $(this.imageModel().deleteSelectedBtnSelector).click(function () { + $(this.imageModel().deleteSelectedBtnSelector).on('click', function () { this.deleteImageAction(this.imageModel().selected()); }.bind(this)); diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/image/image-edit.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/image/image-edit.js index e1404a16d7125..806c78f20c425 100644 --- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/image/image-edit.js +++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/image/image-edit.js @@ -219,7 +219,7 @@ define([ if (key === 'enterKey') { event.preventDefault(); - modalElement.find('.page-action-buttons button.save').click(); + modalElement.find('.page-action-buttons button.save').trigger('click'); } return true; diff --git a/app/code/Magento/Msrp/view/base/web/js/msrp.js b/app/code/Magento/Msrp/view/base/web/js/msrp.js index 8d4c3be687cdf..07bb5fa10d49f 100644 --- a/app/code/Magento/Msrp/view/base/web/js/msrp.js +++ b/app/code/Magento/Msrp/view/base/web/js/msrp.js @@ -172,7 +172,7 @@ define([ ev.preventDefault(); if (this.options.addToCartButton) { - $(this.options.addToCartButton).click(); + $(this.options.addToCartButton).trigger('click'); this.closePopup(this.$popup); } }, @@ -199,7 +199,7 @@ define([ this.options.inputQty && !isNaN(this.tierOptions.qty) ) { $(this.options.inputQty).val(this.tierOptions.qty); - $(this.options.addToCartButton).click(); + $(this.options.addToCartButton).trigger('click'); this.closePopup(this.$popup); } }, @@ -280,7 +280,7 @@ define([ } if (this.options.addToCartButton) { - $(this.options.addToCartButton).click(); + $(this.options.addToCartButton).trigger('click'); return false; } diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js index 798a02f681f36..707d056211e52 100644 --- a/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js +++ b/app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js @@ -602,7 +602,7 @@ define([ } if (this.isFullscreen && this.fotoramaItem.data('fotorama').activeFrame.i === number) { - this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].click(); + this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].trigger('click'); } }, @@ -748,14 +748,14 @@ define([ if (window.Froogaloop) { clearInterval(waitForFroogaloop); fotorama.requestFullScreen(); - this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].click(); + this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].trigger('click'); this.Base = false; } }, this), 50); } else { //if not a vimeo - play it immediately with a little lag in case for fotorama fullscreen setTimeout($.proxy(function () { fotorama.requestFullScreen(); - this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].click(); + this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].trigger('click'); this.Base = false; }, this), 50); } diff --git a/app/code/Magento/Review/view/frontend/web/js/process-reviews.js b/app/code/Magento/Review/view/frontend/web/js/process-reviews.js index 8af59e7bccd6a..486e4b85498a4 100644 --- a/app/code/Magento/Review/view/frontend/web/js/process-reviews.js +++ b/app/code/Magento/Review/view/frontend/web/js/process-reviews.js @@ -22,7 +22,7 @@ define([ }).done(function (data) { $('#product-review-container').html(data).trigger('contentUpdated'); $('[data-role="product-review"] .pages a').each(function (index, element) { - $(element).click(function (event) { //eslint-disable-line max-nested-callbacks + $(element).on('click', function (event) { //eslint-disable-line max-nested-callbacks processReviews($(element).attr('href'), true); event.preventDefault(); }); @@ -49,7 +49,7 @@ define([ } $(function () { - $('.product-info-main .reviews-actions a').click(function (event) { + $('.product-info-main .reviews-actions a').on('click', function (event) { var anchor, addReviewBlock; event.preventDefault(); diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/view/post-wrapper.js b/app/code/Magento/Sales/view/adminhtml/web/order/view/post-wrapper.js index a62047a836710..a1155dd436d49 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/view/post-wrapper.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/view/post-wrapper.js @@ -25,7 +25,7 @@ define([ })); } - $('#order-view-cancel-button').click(function () { + $('#order-view-cancel-button').on('click', function () { var msg = $.mage.__('Are you sure you want to cancel this order?'), url = $('#order-view-cancel-button').data('url'); @@ -45,13 +45,13 @@ define([ return false; }); - $('#order-view-hold-button').click(function () { + $('#order-view-hold-button').on('click', function () { var url = $('#order-view-hold-button').data('url'); getForm(url).appendTo('body').trigger('submit'); }); - $('#order-view-unhold-button').click(function () { + $('#order-view-unhold-button').on('click', function () { var url = $('#order-view-unhold-button').data('url'); getForm(url).appendTo('body').trigger('submit'); diff --git a/app/code/Magento/Security/view/adminhtml/web/js/confirm-redirect.js b/app/code/Magento/Security/view/adminhtml/web/js/confirm-redirect.js index 989785d251ff3..60c750bacb314 100644 --- a/app/code/Magento/Security/view/adminhtml/web/js/confirm-redirect.js +++ b/app/code/Magento/Security/view/adminhtml/web/js/confirm-redirect.js @@ -9,7 +9,7 @@ define( 'use strict'; return function (config, element) { - $(element).click(config, function () { + $(element).on('click', config, function () { confirmSetLocation(config.message, config.url); }); }; diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/form/element/swatch-visual.js b/app/code/Magento/Swatches/view/adminhtml/web/js/form/element/swatch-visual.js index 2fbce5aefbdeb..8841d56b64d9e 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/form/element/swatch-visual.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/form/element/swatch-visual.js @@ -250,7 +250,7 @@ define([ */ $(container).on('click', '.btn_choose_file_upload', function () { swatchComponents.inputFile.attr('data-called-by', $(this).data('class')); - swatchComponents.inputFile.click(); + swatchComponents.inputFile.trigger('click'); }); /** diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js index c27d2e60b2899..b7d50aa360168 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js @@ -384,7 +384,7 @@ define([ */ $(document).on('click', '.btn_choose_file_upload', function () { swatchComponents.inputFile.attr('data-called-by', $(this).attr('id')); - swatchComponents.inputFile.click(); + swatchComponents.inputFile.trigger('click'); }); /** diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/image-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/image-uploader.js index 1031f7ed6e365..a907e34d2abc4 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/image-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/image-uploader.js @@ -133,7 +133,7 @@ define([ * @param {Event} e */ triggerImageUpload: function (imageUploader, e) { - $(e.target).closest('.file-uploader').find('input[type="file"]').click(); + $(e.target).closest('.file-uploader').find('input[type="file"]').trigger('click'); }, /** diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js index b5345e0b8db4c..e860131432a1f 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js @@ -41,7 +41,7 @@ define([ expect(result).toEqual(wdContainer[0]); done(); }); - link.click(); + link.trigger('click'); }); }); }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Multishipping/frontend/js/multi-shipping.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Multishipping/frontend/js/multi-shipping.test.js index a8ae8ab65e378..170b24558cfd9 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Multishipping/frontend/js/multi-shipping.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Multishipping/frontend/js/multi-shipping.test.js @@ -100,7 +100,7 @@ define([ it('Check add new address event', function () { Obj = new MultiShipping({}); Obj.element = jasmine.createSpyObj('element', ['submit']); - addNewAddressBtn.click(); + addNewAddressBtn.trigger('click'); expect(Obj.element.submit).toHaveBeenCalled(); expect(addressflag.val()).toBe('1'); @@ -109,7 +109,7 @@ define([ it('Check can continue event', function () { Obj = new MultiShipping({}); Obj.element = jasmine.createSpyObj('element', ['submit']); - canContinueBtn.click(); + canContinueBtn.trigger('click'); expect(Obj.element.submit).not.toHaveBeenCalled(); expect(canContinueFlag.val()).toBe('1'); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js index 7a0d3ac3fef91..7ead7a265def3 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js @@ -38,7 +38,7 @@ define([ it('Check cancel action', function () { var cancel = spyOn(widget.options.actions, 'cancel'); - jQuery('.modals-overlay').click(); + jQuery('.modals-overlay').trigger('click'); expect(widget.options.outerClickHandler).toBeDefined(); expect(cancel).toHaveBeenCalled(); }); diff --git a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js index 4b08fd678b116..977efe27801ba 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js @@ -145,7 +145,7 @@ define([ spyOn(instance.data('mage-multiselect2'), '_createSelectedOption').and.returnValue(true); - checkbox.click(); + checkbox.trigger('click'); expect(instance.data('mage-multiselect2')._createSelectedOption).toHaveBeenCalledWith({ value: '1', diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/rules/jquery/jquery-no-click-event-shorthand.js b/dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/rules/jquery/jquery-no-click-event-shorthand.js index 4f1c6f1a07e8d..284aa18f7cd10 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/rules/jquery/jquery-no-click-event-shorthand.js +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/rules/jquery/jquery-no-click-event-shorthand.js @@ -11,7 +11,7 @@ module.exports = { create: function(context) { return { CallExpression: function(node) { - let names = ['blur', 'focus', 'focusin', 'focusout', 'resize', 'scroll', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'change', 'select', 'submit', 'keydown', 'keypress', 'keyup', 'contextmenu'], + let names = ['blur', 'focus', 'focusin', 'focusout', 'resize', 'scroll', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'change', 'select', 'submit', 'keydown', 'keypress', 'keyup', 'contextmenu', 'click'], name if (node.callee.type !== 'MemberExpression') return if (!names.includes(node.callee.property.name)) return diff --git a/lib/web/mage/adminhtml/browser.js b/lib/web/mage/adminhtml/browser.js index 74984024b74a0..bc6d8fe7a90b1 100644 --- a/lib/web/mage/adminhtml/browser.js +++ b/lib/web/mage/adminhtml/browser.js @@ -235,7 +235,7 @@ define([ contentBlock.html(data).trigger('contentUpdated'); if (uploaded) { - contentBlock.find('.filecnt:last').click(); + contentBlock.find('.filecnt:last').trigger('click'); } }); }, @@ -244,7 +244,7 @@ define([ * @param {jQuery.Event} event */ selectFolder: function (event) { - this.element.find('[data-id="' + $(event.currentTarget).data('node').id + '"]>a').click(); + this.element.find('[data-id="' + $(event.currentTarget).data('node').id + '"]>a').trigger('click'); }, /** diff --git a/lib/web/mage/terms.js b/lib/web/mage/terms.js index bffa9e8fc2d4d..43b4636a96614 100644 --- a/lib/web/mage/terms.js +++ b/lib/web/mage/terms.js @@ -104,7 +104,7 @@ define([ } } $(switches).each(function (ind, el) { - $(el).click(function (event) { + $(el).on('click', function (event) { event.preventDefault(); showItem(ind); });