Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #12945: Naming collision in Javascript ui registry (backend) to 2.2 (by @VladimirZaets)
 - #12902: Fix #12900: Braintree "Place Order" button is disabled after failed validation (by @joni-jones)
 - #12755: #12294: Bug: Adding Custom Attribute - The value of A… (by @virtual97)


Fixed GitHub Issues:
 - #12555: Naming collision in Javascript ui registry (backend) (reported by @EliasZ) has been fixed in #12945 by @VladimirZaets in 2.2-develop branch
   Related commits:
     1. 64a1689

 - #12900: Braintree "Place Order" button is disabled after failed validation (reported by @ifekaj) has been fixed in #12902 by @joni-jones in 2.2-develop branch
   Related commits:
     1. 0c5cb6a

 - #12294: Bug: Adding Custom Attribute - The value of Admin scope can't be empty (reported by @webscot) has been fixed in #12755 by @virtual97 in 2.2-develop branch
   Related commits:
     1. 2ccb374
     2. 288d0d4
     3. e78ea61
  • Loading branch information
magento-team committed Jan 3, 2018
2 parents 7d47591 + 79c6a80 commit 79d8e9a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ define(
*/
onError: function (response) {
braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized'));
this.isPlaceOrderActionAllowed(true);
throw response.message;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder();
<input type="hidden" id="option-count-check" value="" />
</div>
<script id="row-template" type="text/x-magento-template">
<tr>
<tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>>
<td class="col-draggable">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<div data-role="draggable-handle" class="draggable-handle"
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/view/adminhtml/web/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define([
totalItems: 0,
rendered: 0,
template: mageTemplate('#row-template'),
newOptionClass: 'new-option',
isReadOnly: config.isReadOnly,
add: function (data, render) {
var isNewOption = false,
Expand All @@ -32,7 +33,8 @@ define([
if (typeof data.id == 'undefined') {
data = {
'id': 'option_' + this.itemCount,
'sort_order': this.itemCount + 1
'sort_order': this.itemCount + 1,
'rowClasses': this.newOptionClass
};
isNewOption = true;
}
Expand Down Expand Up @@ -84,6 +86,10 @@ define([
this.totalItems--;
this.updateItemsCountField();
}

if (element.hasClassName(this.newOptionClass)) {
element.remove();
}
},
updateItemsCountField: function () {
$('option-count-check').value = this.totalItems > 0 ? '1' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ define([
var element;

_.each(this.disabledAttributes, function (attribute) {
registry.get('index = ' + attribute).disabled(false);
registry.get('code = ' + attribute, 'index = ' + attribute).disabled(false);
});
this.disabledAttributes = [];

_.each(attributes, function (attribute) {
element = registry.get('index = ' + attribute.code);
element = registry.get('code = ' + attribute.code, 'index = ' + attribute.code);

if (!_.isUndefined(element)) {
element.disabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define([
),
'Magento_Braintree/js/view/payment/adapter': jasmine.createSpyObj(
'adapter',
['setup', 'setConfig']
['setup', 'setConfig', 'showError']
)
},
braintreeCcForm;
Expand All @@ -43,14 +43,17 @@ define([
};
injector.mock(mocks);
injector.require(['Magento_Braintree/js/view/payment/method-renderer/cc-form'], function (Constr) {
braintreeCcForm = new Constr({
provider: 'provName',
name: 'test',
index: 'test'
});

done();
braintreeCcForm = new Constr({
provider: 'provName',
name: 'test',
index: 'test',
item: {
title: 'Braintree'
}
});

done();
});
});

it('Check if payment code and message container are restored after onActiveChange call.', function () {
Expand All @@ -65,5 +68,21 @@ define([
expect(braintreeCcForm.getCode()).toEqual(expectedCode);
expect(braintreeCcForm.messageContainer).toEqual(expectedMessageContainer);
});

it('Check if form validation fails when "Place Order" button should be active.', function () {
var errorMessage = 'Something went wrong.',

/**
* Anonymous wrapper
*/
func = function () {
braintreeCcForm.clientConfig.onError({
'message': errorMessage
});
};

expect(func).toThrow(errorMessage);
expect(braintreeCcForm.isPlaceOrderActionAllowed()).toBeTruthy();
});
});
});

0 comments on commit 79d8e9a

Please sign in to comment.