From 5be754b7d3de102cb9ec6ef2f43dbdbcb797540a Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak Date: Thu, 28 Nov 2019 17:08:19 +0100 Subject: [PATCH] Add failing test and fix it --- .../view/frontend/web/js/section-config.js | 2 +- .../Customer/frontend/js/section-config.test.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/view/frontend/web/js/section-config.js b/app/code/Magento/Customer/view/frontend/web/js/section-config.js index 60482e5fee260..107a177d0832f 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/section-config.js +++ b/app/code/Magento/Customer/view/frontend/web/js/section-config.js @@ -50,7 +50,7 @@ define(['underscore'], function (_) { return route.indexOf(section) === 0; }); - return _.union(actions, sections['*']); + return _.union(_.toArray(actions), sections['*']); }, /** diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js index 56ed546e28f8c..ef7222883b738 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/section-config.test.js @@ -128,6 +128,21 @@ define(['squire'], function (Squire) { expect(obj.getAffectedSections('http://localhost.com/path')).toEqual(['all']); }); + + it('Ignores capitalization in parts of URL.', function () { + obj['Magento_Customer/js/section-config']({ + sections: { + 'path': [ + 'section' + ] + }, + baseUrls: [ + 'http://localhost.com/' + ] + }); + + expect(obj.getAffectedSections('http://localhost.com/PaTh')).toEqual(['section']); + }); }); describe('"filterClientSideSections" method', function () {