Skip to content

Commit 979c0f7

Browse files
authored
Eslint jQuery migration tests (#42)
* MC-41858: Eslint jQuery migration tests * MC-41858: Updated eslint jQuery configuration * MC-41858: Fixed eslint jQuery static tests * MC-41858: Fixed eslint jQuery static tests * MC-41858: Fixed eslint jQuery static tests * MC-41858: Fixed eslint jQuery static tests
1 parent 95445b3 commit 979c0f7

File tree

35 files changed

+302
-54
lines changed

35 files changed

+302
-54
lines changed

app/code/Magento/Bundle/view/frontend/web/js/slide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ define([
8585
$('html, body').animate({
8686
scrollTop: $(this.options.bundleOptionsContainer).offset().top
8787
}, 600);
88-
$('#product-options-wrapper > fieldset').focus();
88+
$('#product-options-wrapper > fieldset').trigger('focus');
8989
},
9090

9191
/**

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ define([
4545
content: data.message
4646
});
4747
} else {
48-
$(this.options.categoryIdSelector).val(data.id).change();
49-
$(this.options.categoryPathSelector).val(data.path).change();
50-
$(this.options.categoryParentSelector).val(data.parentId).change();
51-
$(this.options.categoryLevelSelector).val(data.level).change();
48+
$(this.options.categoryIdSelector).val(data.id).trigger('change');
49+
$(this.options.categoryPathSelector).val(data.path).trigger('change');
50+
$(this.options.categoryParentSelector).val(data.parentId).trigger('change');
51+
$(this.options.categoryLevelSelector).val(data.level).trigger('change');
5252
}
5353
}
5454
};

app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ define([
437437
this.refreshSortableElements();
438438
this.options.selectionItemCount[data.id] = parseInt(this.options.selectionItemCount[data.id], 10) + 1;
439439

440-
$('#' + this.options.fieldId + '_' + data.id + '_select_' + data['select_id'] + '_title').focus();
440+
$('#' + this.options.fieldId + '_' + data.id + '_select_' + data['select_id'] + '_title').trigger('focus');
441441
},
442442

443443
/**

app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ define([
7575
$('#new_category_name').val(enteredName);
7676

7777
if (enteredName === '') {
78-
$('#new_category_name').focus();
78+
$('#new_category_name').trigger('focus');
7979
}
8080
$('#new_category_messages').html('');
8181
},
@@ -88,7 +88,7 @@ define([
8888
validationOptions.unhighlight($('#new_category_parent-suggest').get(0),
8989
validationOptions.errorClass, validationOptions.validClass || '');
9090
newCategoryForm.validation('clearError');
91-
$('#category_ids-suggest').focus();
91+
$('#category_ids-suggest').trigger('focus');
9292
},
9393
buttons: [{
9494
text: $.mage.__('Create Category'),

app/code/Magento/Catalog/view/frontend/web/js/zoom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ define([
9292
}, this));
9393

9494
// Window resize will change offset for draggable
95-
$(window).resize(this._draggableImage());
95+
$(window).on('resize', this._draggableImage);
9696
},
9797

9898
/**

app/code/Magento/Checkout/view/frontend/web/js/model/full-screen-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ define([
2727
*/
2828
stopLoader: function (forceStop) {
2929
var $elem = $(containerId),
30-
stop = $elem.trigger.bind($elem, 'processStop');
30+
stop = $elem.trigger.bind($elem, 'processStop'); //eslint-disable-line jquery-no-bind-unbind
3131

3232
forceStop ? stop() : resolver(stop);
3333
}

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ define([
354354
}
355355

356356
if (!emailValidationResult) {
357-
$(loginFormSelector + ' input[name=username]').focus();
357+
$(loginFormSelector + ' input[name=username]').trigger('focus');
358358

359359
return false;
360360
}

app/code/Magento/GiftMessage/view/frontend/web/js/gift-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ define([
4848
container.show()
4949
.find('.giftmessage-area:not(:visible)').each(function (x, element) {
5050
if ($(element).val().length > 0) {
51-
$(element).change();
51+
$(element).trigger('change');
5252
container.find('a').click();
5353
}
5454
});

app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/columns/image/insertImageAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define([
4949
if (targetElement.is('textarea')) {
5050
this.insertAtCursor(targetElement.get(0), data.content);
5151
targetElement.focus();
52-
$(targetElement).change();
52+
$(targetElement).trigger('change');
5353
} else {
5454
targetElement.val(data.content)
5555
.data('size', data.size)

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ define([
812812

813813
if (self.isFullscreen && !self.fotoramaItem.data('fotorama').options.fullscreen.arrows) {
814814
if ($('.' + self.FTAR + '--prev').is(':focus') || $('.' + self.FTAR + '--next').is(':focus')) {
815-
$(self.FTCF).focus();
815+
$(self.FTCF).trigger('focus');
816816
}
817817
}
818818
});

0 commit comments

Comments
 (0)