Skip to content

Commit b2799f1

Browse files
committed
ACP2E-3294: The shipping address state is not auto updating
1 parent bf4e18e commit b2799f1

File tree

1 file changed

+31
-29
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/Sales/adminhtml/js/order/create

1 file changed

+31
-29
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Sales/adminhtml/js/order/create/scripts.test.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,22 @@ define([
162162

163163
describe('Testing syncAddressField method', function () {
164164
it('Synchronize region and region_id fields display when called with field named "country"', function () {
165-
let form, billingCountryId, billingRegionId, billingRegion;
166-
let shippingCountryId, shippingRegionId, shippingRegion;
165+
let form, billingCountryId, billingRegionId, billingRegion, billingCountryIdOption1,
166+
billingCountryIdOption2, shippingCountryId, shippingRegionId, shippingRegion, billingRegionOption1,
167+
billingRegionOption2, shippingCountryIdOption1, shippingOption2, shippingRegionOption1,
168+
shippingRegionOption2;
167169

168170
form = document.createElement('form');
169171

170172
//create billing country id field
171173
billingCountryId = document.createElement('select');
172174
billingCountryId.name = 'order[billing_address][country_id]';
173-
let billingCountryIdOption1 = document.createElement("option");
174-
billingCountryIdOption1.value = "USA";
175-
billingCountryIdOption1.innerText = "United States of America";
176-
let billingCountryIdOption2 = document.createElement("option");
177-
billingCountryIdOption2.value = "RO";
178-
billingCountryIdOption2.innerText = "Romania";
175+
billingCountryIdOption1 = document.createElement('option');
176+
billingCountryIdOption1.value = 'USA';
177+
billingCountryIdOption1.innerText = 'United States of America';
178+
billingCountryIdOption2 = document.createElement('option');
179+
billingCountryIdOption2.value = 'RO';
180+
billingCountryIdOption2.innerText = 'Romania';
179181
billingCountryId.appendChild(billingCountryIdOption1);
180182
billingCountryId.appendChild(billingCountryIdOption2);
181183
form.appendChild(billingCountryId);
@@ -184,12 +186,12 @@ define([
184186
billingRegionId = document.createElement('select');
185187
billingRegionId.name = 'order[billing_address][region_id]';
186188
billingRegionId.id = 'order-billing_address_region_id';
187-
let billingRegionOption1 = document.createElement("option");
188-
billingRegionOption1.value = "NY";
189-
billingRegionOption1.innerText = "New York";
190-
let billingRegionOption2 = document.createElement("option");
191-
billingRegionOption2.value = "TX";
192-
billingRegionOption2.innerText = "Texas";
189+
billingRegionOption1 = document.createElement('option');
190+
billingRegionOption1.value = 'NY';
191+
billingRegionOption1.innerText = 'New York';
192+
billingRegionOption2 = document.createElement('option');
193+
billingRegionOption2.value = 'TX';
194+
billingRegionOption2.innerText = 'Texas';
193195
billingRegionId.appendChild(billingRegionOption1);
194196
billingRegionId.appendChild(billingRegionOption2);
195197
form.appendChild(billingRegionId);
@@ -204,27 +206,27 @@ define([
204206
//create shipping country id field
205207
shippingCountryId = document.createElement('select');
206208
shippingCountryId.name = 'order[shipping_address][country_id]';
207-
let shippingCountryIdOption1 = document.createElement("option");
208-
shippingCountryIdOption1.value = "USA";
209-
shippingCountryIdOption1.innerText = "United States of America";
210-
let shippingOption2 = document.createElement("option");
211-
shippingOption2.value = "RO";
212-
shippingOption2.innerText = "Romania";
209+
shippingCountryIdOption1 = document.createElement('option');
210+
shippingCountryIdOption1.value = 'USA';
211+
shippingCountryIdOption1.innerText = 'United States of America';
212+
shippingOption2 = document.createElement('option');
213+
shippingOption2.value = 'RO';
214+
shippingOption2.innerText = 'Romania';
213215
shippingCountryId.appendChild(shippingCountryIdOption1);
214216
shippingCountryId.appendChild(shippingOption2);
215-
shippingCountryId.value = "RO";
217+
shippingCountryId.value = 'RO';
216218
form.appendChild(shippingCountryId);
217219

218220
//create shipping region id field
219221
shippingRegionId = document.createElement('select');
220222
shippingRegionId.name = 'order[shipping_address][region_id]';
221223
shippingRegionId.id = 'order-shipping_address_region_id';
222-
let shippingRegionOption1 = document.createElement("option");
223-
shippingRegionOption1.value = "B";
224-
shippingRegionOption1.innerText = "Bucuresti";
225-
let shippingRegionOption2 = document.createElement("option");
226-
shippingRegionOption2.value = "CT";
227-
shippingRegionOption2.innerText = "Constanta";
224+
shippingRegionOption1 = document.createElement('option');
225+
shippingRegionOption1.value = 'B';
226+
shippingRegionOption1.innerText = 'Bucuresti';
227+
shippingRegionOption2 = document.createElement('option');
228+
shippingRegionOption2.value = 'CT';
229+
shippingRegionOption2.innerText = 'Constanta';
228230
shippingRegionId.appendChild(shippingRegionOption1);
229231
shippingRegionId.appendChild(shippingRegionOption2);
230232
form.appendChild(shippingRegionId);
@@ -239,8 +241,8 @@ define([
239241
order = new window.AdminOrder({});
240242
order.syncAddressField(form, 'order[billing_address][country_id]', billingCountryId);
241243

242-
expect(shippingCountryId.value).toEqual("USA");
243-
expect(shippingRegion.style.display).toEqual("none");
244+
expect(shippingCountryId.value).toEqual('USA');
245+
expect(shippingRegion.style.display).toEqual('none');
244246
});
245247
});
246248

0 commit comments

Comments
 (0)