Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ define([
storage.remove(sectionName);
sectionDataIds = $.cookieStorage.get('section_data_ids') || {};
_.each(sectionDataIds, function (data, name) {
if (name != sectionName) { //eslint-disable-line eqeqeq
if (name !== sectionName) {
newSectionDataIds[name] = data;
}
});
Expand Down Expand Up @@ -266,7 +266,7 @@ define([

if (typeof sectionData === 'undefined' ||
typeof sectionData === 'object' &&
cookieSectionTimestamp != sectionData['data_id'] //eslint-disable-line
cookieSectionTimestamp !== sectionData['data_id']
) {
expiredSectionNames.push(sectionName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define(['underscore'], function (_) {
/**
* Returns a list of sections which should be invalidated for given URL.
* @param {String} url - URL which was requested.
* @return {Array} - List of sections to invalidate.
* @return {Object} - List of sections to invalidate.
*/
getAffectedSections: function (url) {
var route = canonize(url),
Expand All @@ -55,8 +55,8 @@ define(['underscore'], function (_) {

/**
* Filters the list of given sections to the ones defined as client side.
* @param {Array} allSections - List of sections to check.
* @return {Array} - List of filtered sections.
* @param {Object} allSections - List of sections to check.
* @return {Object} - List of filtered sections.
*/
filterClientSideSections: function (allSections) {
return _.difference(allSections, clientSideSections);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
/* eslint-disable no-undef */
define([
'jquery',
'underscore',
'Magento_Ui/js/grid/columns/column',
'Magento_Ui/js/lib/key-codes'
], function ($, Column, keyCodes) {
], function ($, _, Column, keyCodes) {
'use strict';

return Column.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* See COPYING.txt for license details.
*/

/* global _ */
/* eslint max-nested-callbacks: 0 */
/* jscs:disable jsDoc*/

define([
'underscore',
'squire',
'jquery',
'Magento_Customer/js/section-config',
'Magento_Customer/js/customer-data',
'jquery/jquery-storageapi'
], function (Squire, $, sectionConfig, customerData) {
], function (_, Squire, $, sectionConfig, customerData) {
'use strict';

var injector = new Squire(),
Expand Down Expand Up @@ -98,9 +98,6 @@ define([
}

describe('Magento_Customer/js/customer-data', function () {

var _;

beforeAll(function () {
clearLocalStorage();
});
Expand Down Expand Up @@ -401,7 +398,6 @@ define([
}
};
};

expect(parameters).toEqual(jasmine.objectContaining({
sections: 'section'
}));
Expand All @@ -410,7 +406,6 @@ define([
});

result = obj.reload(['section'], true);

expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
section: {}
Expand All @@ -422,7 +417,6 @@ define([
var result;

spyOn(sectionConfig, 'filterClientSideSections').and.returnValue(['cart,customer,messages']);

$.getJSON = jasmine.createSpy().and.callFake(function (url, parameters) {
var deferred = $.Deferred();

Expand All @@ -448,7 +442,6 @@ define([
});

result = obj.reload(['cart', 'customer', 'messages'], true);

expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
cart: {},
Expand All @@ -457,7 +450,7 @@ define([
}
}));
});
//

it('Check it returns all sections when passed wildcard string', function () {
var result;

Expand Down Expand Up @@ -486,7 +479,6 @@ define([
});

result = obj.reload('*', true);

expect($.getJSON).toHaveBeenCalled();
expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
Expand Down
7 changes: 6 additions & 1 deletion lib/web/mage/utils/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ define(function (require) {
'use strict';

var utils = {},
_ = require('underscore');
_ = require('underscore'),
root = typeof self == 'object' && self.self === self && self ||
typeof global == 'object' && global.global === global && global ||
Function('return this')() || {};

root._ = _;

return _.extend(
utils,
Expand Down
Loading