Skip to content

Commit 1c16ca5

Browse files
authored
Merge pull request #5952 from magento-tango/TANGO-PR-07-29-2020_23
TANGO PR-07-29-2020 v23
2 parents 0df6fcd + 88e04f1 commit 1c16ca5

File tree

5 files changed

+69
-5
lines changed

5 files changed

+69
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ define([
5656
if (this.options.isMultipleCountriesAllowed) {
5757
this.element.parents('div.field').show();
5858
this.element.on('change', $.proxy(function (e) {
59+
// clear region inputs on country change
60+
$(this.options.regionListId).val('');
61+
$(this.options.regionInputId).val('');
5962
this._updateRegion($(e.target).val());
6063
}, this));
6164

@@ -165,9 +168,6 @@ define([
165168
this._clearError();
166169
this._checkRegionRequired(country);
167170

168-
$(regionList).find('option:selected').removeAttr('selected');
169-
regionInput.val('');
170-
171171
// Populate state/province dropdown list if available or use input box
172172
if (this.options.regionJson[country]) {
173173
this._removeSelectOptions(regionList);

app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
/**
1212
* Class AddComment
13+
*
14+
* Controller responsible for addition of the order comment to the order
1315
*/
1416
class AddComment extends \Magento\Sales\Controller\Adminhtml\Order implements HttpPostActionInterface
1517
{
@@ -42,6 +44,7 @@ public function execute()
4244
);
4345
}
4446

47+
$order->setStatus($data['status']);
4548
$notify = $data['is_customer_notified'] ?? false;
4649
$visible = $data['is_visible_on_front'] ?? false;
4750

app/code/Magento/Sales/Model/Order/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Config
5252
*/
5353
protected $maskStatusesMapping = [
5454
\Magento\Framework\App\Area::AREA_FRONTEND => [
55-
\Magento\Sales\Model\Order::STATUS_FRAUD => \Magento\Sales\Model\Order::STATE_PROCESSING,
55+
\Magento\Sales\Model\Order::STATUS_FRAUD => \Magento\Sales\Model\Order::STATUS_FRAUD,
5656
\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW => \Magento\Sales\Model\Order::STATE_PROCESSING
5757
]
5858
];

dev/tests/integration/testsuite/Magento/Sales/Model/Order/ConfigTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,28 @@ public function testCorrectCompleteStatusInStatesList()
5050

5151
$this->assertEquals($completeStatus->getLabel(), $completeState->getText());
5252
}
53+
54+
/**
55+
* Test Mask Status For Area
56+
*
57+
* @param string $code
58+
* @param string $expected
59+
* @dataProvider dataProviderForTestMaskStatusForArea
60+
*/
61+
public function testMaskStatusForArea(string $code, string $expected)
62+
{
63+
$result = $this->orderConfig->getStatusFrontendLabel($code);
64+
$this->assertEquals($expected, $result);
65+
}
66+
67+
/**
68+
* @return array
69+
*/
70+
public function dataProviderForTestMaskStatusForArea()
71+
{
72+
return [
73+
['fraud', 'Suspected Fraud'],
74+
['processing', 'Processing'],
75+
];
76+
}
5377
}

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

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ define([
5151
'': '',
5252
'US': 'United States',
5353
'GB': 'United Kingdom',
54-
'DE': 'Germany'
54+
'DE': 'Germany',
55+
'IT': 'Italy'
5556
},
5657
regions = {
5758
'': 'Please select a region, state or province.'
@@ -202,5 +203,41 @@ define([
202203
expect($(regionSelectEl).is(':visible')).toBe(false);
203204
expect($(regionInputEl).is(':visible')).toBe(false);
204205
});
206+
it('Check that initial values are not overwritten - region input', function () {
207+
$(countryEl).val('GB');
208+
$(regionInputEl).val('Liverpool');
209+
$(postalCodeEl).val('L13 0AL');
210+
init();
211+
expect($(countryEl).val()).toBe('GB');
212+
expect($(regionInputEl).val()).toBe('Liverpool');
213+
expect($(postalCodeEl).val()).toBe('L13 0AL');
214+
});
215+
it('Check that initial values are not overwritten - region select', function () {
216+
$(countryEl).val('US');
217+
$(postalCodeEl).val('99501');
218+
init({
219+
defaultRegion: '2'
220+
});
221+
expect($(countryEl).val()).toBe('US');
222+
expect($(regionSelectEl).find('option:selected').text()).toBe('Alaska');
223+
expect($(postalCodeEl).val()).toBe('99501');
224+
});
225+
it('Check that region values are cleared out on country change - region input', function () {
226+
$(countryEl).val('GB');
227+
$(regionInputEl).val('Liverpool');
228+
init();
229+
$(countryEl).val('IT').change();
230+
expect($(countryEl).val()).toBe('IT');
231+
expect($(regionInputEl).val()).toBe('');
232+
});
233+
it('Check that region values are cleared out on country change - region select', function () {
234+
$(countryEl).val('US');
235+
init({
236+
defaultRegion: '2'
237+
});
238+
$(countryEl).val('DE').change();
239+
expect($(countryEl).val()).toBe('DE');
240+
expect($(regionSelectEl).val()).toBe('');
241+
});
205242
});
206243
});

0 commit comments

Comments
 (0)