@@ -162,20 +162,22 @@ define([
162
162
163
163
describe ( 'Testing syncAddressField method' , function ( ) {
164
164
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 ;
167
169
168
170
form = document . createElement ( 'form' ) ;
169
171
170
172
//create billing country id field
171
173
billingCountryId = document . createElement ( 'select' ) ;
172
174
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' ;
179
181
billingCountryId . appendChild ( billingCountryIdOption1 ) ;
180
182
billingCountryId . appendChild ( billingCountryIdOption2 ) ;
181
183
form . appendChild ( billingCountryId ) ;
@@ -184,12 +186,12 @@ define([
184
186
billingRegionId = document . createElement ( 'select' ) ;
185
187
billingRegionId . name = 'order[billing_address][region_id]' ;
186
188
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' ;
193
195
billingRegionId . appendChild ( billingRegionOption1 ) ;
194
196
billingRegionId . appendChild ( billingRegionOption2 ) ;
195
197
form . appendChild ( billingRegionId ) ;
@@ -204,27 +206,27 @@ define([
204
206
//create shipping country id field
205
207
shippingCountryId = document . createElement ( 'select' ) ;
206
208
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' ;
213
215
shippingCountryId . appendChild ( shippingCountryIdOption1 ) ;
214
216
shippingCountryId . appendChild ( shippingOption2 ) ;
215
- shippingCountryId . value = "RO" ;
217
+ shippingCountryId . value = 'RO' ;
216
218
form . appendChild ( shippingCountryId ) ;
217
219
218
220
//create shipping region id field
219
221
shippingRegionId = document . createElement ( 'select' ) ;
220
222
shippingRegionId . name = 'order[shipping_address][region_id]' ;
221
223
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' ;
228
230
shippingRegionId . appendChild ( shippingRegionOption1 ) ;
229
231
shippingRegionId . appendChild ( shippingRegionOption2 ) ;
230
232
form . appendChild ( shippingRegionId ) ;
@@ -239,8 +241,8 @@ define([
239
241
order = new window . AdminOrder ( { } ) ;
240
242
order . syncAddressField ( form , 'order[billing_address][country_id]' , billingCountryId ) ;
241
243
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' ) ;
244
246
} ) ;
245
247
} ) ;
246
248
0 commit comments