Skip to content

Commit

Permalink
ENGCOM-8287: [BUG] Admin order create validate vat confirm box #29466
Browse files Browse the repository at this point in the history
  • Loading branch information
sidolov authored Oct 1, 2020
2 parents f7759d8 + ea905c2 commit dd06aed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
17 changes: 11 additions & 6 deletions app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1507,12 +1507,17 @@ define([
if (action === 'change') {
var confirmText = message.replace(/%s/, customerGroupOption.text);
confirmText = confirmText.replace(/%s/, currentCustomerGroupTitle);
if (confirm(confirmText)) {
$$('#' + groupIdHtmlId + ' option').each(function (o) {
o.selected = o.readAttribute('value') == groupId;
});
this.accountGroupChange();
}
confirm({
content: confirmText,
actions: {
confirm: function() {
$$('#' + groupIdHtmlId + ' option').each(function (o) {
o.selected = o.readAttribute('value') == groupId;
});
this.accountGroupChange();
}.bind(this)
}
})
} else if (action === 'inform') {
alert({
content: message + '\n' + groupMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ define([
var formEl,
jQueryAjax,
order,
confirmSpy = jasmine.createSpy('confirm'),
tmpl = '<form id="edit_form" action="/">' +
'<section id="order-methods">' +
'<div id="order-billing_method"></div>' +
Expand Down Expand Up @@ -129,7 +130,7 @@ define([
mocks = {
'jquery': $,
'Magento_Catalog/catalog/product/composite/configure': jasmine.createSpy(),
'Magento_Ui/js/modal/confirm': jasmine.createSpy(),
'Magento_Ui/js/modal/confirm': confirmSpy,
'Magento_Ui/js/modal/alert': jasmine.createSpy(),
'Magento_Ui/js/lib/view/utils/async': jasmine.createSpy()
};
Expand Down Expand Up @@ -159,6 +160,22 @@ define([
jQueryAjax = undefined;
});

describe('Testing the process customer group change', function () {
it('and confirm method is called', function () {
init();
spyOn(window, '$$').and.returnValue(['testing']);
order.processCustomerGroupChange(
1,
'testMsg',
'customerGroupMsg',
'errorMsg',
1,
'change'
);
expect(confirmSpy).toHaveBeenCalledTimes(1);
});
});

describe('submit()', function () {
function testSubmit(currentPaymentMethod, paymentMethod, ajaxParams) {
$.ajax = jasmine.createSpy('$.ajax');
Expand Down

0 comments on commit dd06aed

Please sign in to comment.