|
7 | 7 | /* jscs:disable jsDoc*/
|
8 | 8 |
|
9 | 9 | define([
|
| 10 | + 'underscore', |
10 | 11 | 'squire',
|
11 | 12 | 'jquery',
|
12 | 13 | 'Magento_Customer/js/section-config',
|
13 | 14 | 'Magento_Customer/js/customer-data',
|
14 | 15 | 'jquery/jquery-storageapi'
|
15 |
| -], function (Squire, $, sectionConfig, customerData) { |
| 16 | +], function (_, Squire, $, sectionConfig, customerData) { |
16 | 17 | 'use strict';
|
17 | 18 |
|
18 | 19 | var injector = new Squire(),
|
@@ -45,27 +46,6 @@ define([
|
45 | 46 | ]
|
46 | 47 | };
|
47 | 48 |
|
48 |
| - var _; |
49 |
| - |
50 |
| - beforeEach(function (done) { |
51 |
| - injector.require([ |
52 |
| - 'underscore', |
53 |
| - 'Magento_Customer/js/customer-data' |
54 |
| - ], function (underscore, Constr) { |
55 |
| - _ = underscore; |
56 |
| - obj = Constr; |
57 |
| - done(); |
58 |
| - }); |
59 |
| - }); |
60 |
| - |
61 |
| - afterEach(function () { |
62 |
| - try { |
63 |
| - injector.clean(); |
64 |
| - injector.remove(); |
65 |
| - } catch (e) { |
66 |
| - } |
67 |
| - }); |
68 |
| - |
69 | 49 | function init(config) {
|
70 | 50 | var defaultConfig = {
|
71 | 51 | sectionLoadUrl: 'http://localhost/customer/section/load/',
|
@@ -109,22 +89,31 @@ define([
|
109 | 89 | );
|
110 | 90 | }
|
111 | 91 |
|
112 |
| - describe('Magento_Customer/js/customer-data', function () { |
113 |
| - function clearLocalStorage() { |
114 |
| - $.cookieStorage.set('section_data_ids', {}); |
| 92 | + function clearLocalStorage() { |
| 93 | + $.cookieStorage.set('section_data_ids', {}); |
115 | 94 |
|
116 |
| - if (window.localStorage) { |
117 |
| - window.localStorage.clear(); |
118 |
| - } |
| 95 | + if (window.localStorage) { |
| 96 | + window.localStorage.clear(); |
119 | 97 | }
|
| 98 | + } |
120 | 99 |
|
| 100 | + describe('Magento_Customer/js/customer-data', function () { |
121 | 101 | beforeAll(function () {
|
122 | 102 | clearLocalStorage();
|
123 | 103 | });
|
124 | 104 |
|
125 |
| - beforeEach(function () { |
| 105 | + beforeEach(function (done) { |
126 | 106 | originalGetJSON = $.getJSON;
|
127 | 107 | sectionConfig['Magento_Customer/js/section-config'](sectionConfigSettings);
|
| 108 | + |
| 109 | + injector.require([ |
| 110 | + 'underscore', |
| 111 | + 'Magento_Customer/js/customer-data' |
| 112 | + ], function (underscore, Constr) { |
| 113 | + _ = underscore; |
| 114 | + obj = Constr; |
| 115 | + done(); |
| 116 | + }); |
128 | 117 | });
|
129 | 118 |
|
130 | 119 | afterEach(function () {
|
|
0 commit comments