Skip to content

Commit b61b550

Browse files
committed
32996 - unit test fixes
1 parent 33851bf commit b61b550

File tree

2 files changed

+43
-41
lines changed

2 files changed

+43
-41
lines changed

app/code/Magento/Directory/view/frontend/web/js/region-updater.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
], function ($, mageTemplate, _) {
1313
'use strict';
1414

15-
$.widget('mage.regionUpdater', {
15+
$.widget('mage.directoryRegionUpdater', {
1616
options: {
1717
regionTemplate:
1818
'<option value="<%- data.value %>" <% if (data.isSelected) { %>selected="selected"<% } %>>' +
@@ -256,5 +256,5 @@ define([
256256
}
257257
});
258258

259-
return $.mage.regionUpdater;
259+
return $.mage.directoryRegionUpdater;
260260
});

dev/tests/js/jasmine/tests/app/code/Magento/Directory/frontend/js/region-updater.test.js

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,42 @@ define([
1717
'US'
1818
]
1919
},
20-
'US': {
21-
'1': {
22-
'id': 1,
23-
'code': 'AL',
24-
'name': 'Alabama'
25-
},
26-
'2': {
27-
'id': 2,
28-
'code': 'AK',
29-
'name': 'Alaska'
30-
},
31-
'3': {
32-
'id': 3,
33-
'code': 'AS',
34-
'name': 'American Samoa'
35-
}
36-
},
37-
'DE': {
38-
'81': {
39-
'id': 4,
40-
'code': 'BAY',
41-
'name': 'Bayern'
42-
},
43-
'82': {
44-
'id': 5,
45-
'code': 'BER',
46-
'name': 'Berlin'
47-
},
48-
'83': {
49-
'id': 6,
50-
'code': 'BRG',
51-
'name': 'Brandenburg'
52-
}
53-
}
20+
'US':
21+
[
22+
{
23+
'id': 1,
24+
'code': 'AL',
25+
'name': 'Alabama'
26+
},
27+
{
28+
'id': 2,
29+
'code': 'AK',
30+
'name': 'Alaska'
31+
},
32+
{
33+
'id': 3,
34+
'code': 'AS',
35+
'name': 'American Samoa'
36+
}
37+
],
38+
'DE':
39+
[
40+
{
41+
'id': 81,
42+
'code': 'BAY',
43+
'name': 'Bayern'
44+
},
45+
{
46+
'id': 82,
47+
'code': 'BER',
48+
'name': 'Berlin'
49+
},
50+
{
51+
'id': 83,
52+
'code': 'BRG',
53+
'name': 'Brandenburg'
54+
}
55+
]
5456
},
5557
defaultCountry = 'GB',
5658
countries = {
@@ -122,7 +124,7 @@ define([
122124
'countriesWithOptionalZip': ['GB']
123125
};
124126

125-
$(countryEl).regionUpdater($.extend({}, defaultConfig, config || {}));
127+
$(countryEl).directoryRegionUpdater($.extend({}, defaultConfig, config || {}));
126128
}
127129

128130
beforeEach(function () {
@@ -132,13 +134,13 @@ define([
132134
regionInputEl = document.createElement('input');
133135
postalCodeEl = document.createElement('input');
134136
countryEl = document.createElement('select');
135-
regionSelectEl.setAttribute('id', 'region_id');
137+
regionSelectEl.setAttribute('id', 'dir_region_id');
136138
regionSelectEl.setAttribute('style', 'display:none;');
137-
regionInputEl.setAttribute('id', 'region');
139+
regionInputEl.setAttribute('id', 'dir_region');
138140
regionInputEl.setAttribute('style', 'display:none;');
139-
countryEl.setAttribute('id', 'country');
141+
countryEl.setAttribute('id', 'dir_country');
140142
postalCodeEl.setAttribute('id', 'zip');
141-
formEl.setAttribute('id', 'test_form');
143+
formEl.setAttribute('id', 'dir_test_form');
142144
formEl.appendChild(createFormField(countryEl));
143145
formEl.appendChild(createFormField(regionSelectEl, regionInputEl));
144146
formEl.appendChild(createFormField(postalCodeEl));

0 commit comments

Comments
 (0)