Skip to content

Commit

Permalink
Merge pull request #19 from vgelani/2.3-develop-PR-port-15340
Browse files Browse the repository at this point in the history
[Forwardport] Submitting search form (mini) with enter key fires event handlers bound by jquery twice
  • Loading branch information
gelanivishal authored Jun 3, 2018
2 parents a0a0f11 + 04583ac commit 6e2ce07
Show file tree
Hide file tree
Showing 38 changed files with 830 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ public function __construct(
$this->_storeManager = $storeManager;
$this->_currencyLocator = $currencyLocator;
$this->_localeCurrency = $localeCurrency;
$defaultBaseCurrencyCode = $this->_scopeConfig->getValue(
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
'default'
);
$defaultBaseCurrencyCode = $currencyLocator->getDefaultCurrency($this->_request);
$this->_defaultBaseCurrency = $currencyFactory->create()->load($defaultBaseCurrencyCode);
}

Expand Down
13 changes: 0 additions & 13 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,19 +513,6 @@ public function getStoreId()
return $this->_storeManager->getStore()->getId();
}

/**
* Get collection instance
*
* @return object
* @deprecated 101.1.0 because collections should be used directly via factory
*/
public function getResourceCollection()
{
$collection = parent::getResourceCollection();
$collection->setStoreId($this->getStoreId());
return $collection;
}

/**
* Get product url model
*
Expand Down
19 changes: 16 additions & 3 deletions app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public function getOptionPrice($optionValue, $basePrice)
{
$option = $this->getOption();

return $this->_getChargableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice);
return $this->_getChargeableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice);
}

/**
Expand Down Expand Up @@ -395,14 +395,27 @@ public function getProductOptions()
}

/**
* Return final chargable price for option
*
* @param float $price Price of option
* @param boolean $isPercent Price type - percent or fixed
* @param float $basePrice For percent price type
* @return float
* @deprecated 102.0.4 typo in method name
* @see _getChargeableOptionPrice
*/
protected function _getChargableOptionPrice($price, $isPercent, $basePrice)
{
return $this->_getChargeableOptionPrice($price, $isPercent, $basePrice);
}

/**
* Return final chargeable price for option
*
* @param float $price Price of option
* @param boolean $isPercent Price type - percent or fixed
* @param float $basePrice For percent price type
* @return float
*/
protected function _getChargeableOptionPrice($price, $isPercent, $basePrice)
{
if ($isPercent) {
return $basePrice * $price / 100;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Product/Option/Type/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function getOptionPrice($optionValue, $basePrice)
foreach (explode(',', $optionValue) as $value) {
$_result = $option->getValueById($value);
if ($_result) {
$result += $this->_getChargableOptionPrice(
$result += $this->_getChargeableOptionPrice(
$_result->getPrice(),
$_result->getPriceType() == 'percent',
$basePrice
Expand All @@ -246,7 +246,7 @@ public function getOptionPrice($optionValue, $basePrice)
} elseif ($this->_isSingleSelection()) {
$_result = $option->getValueById($optionValue);
if ($_result) {
$result = $this->_getChargableOptionPrice(
$result = $this->_getChargeableOptionPrice(
$_result->getPrice(),
$_result->getPriceType() == 'percent',
$basePrice
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@
<argument name="customFilters" xsi:type="array">
<item name="category_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductCategoryFilter</item>
<item name="store" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductStoreFilter</item>
<item name="store_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductStoreFilter</item>
<item name="website_id" xsi:type="object">Magento\Catalog\Model\Api\SearchCriteria\CollectionProcessor\FilterProcessor\ProductWebsiteFilter</item>
</argument>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,6 @@ define([
menuContainer: '[data-action="navigation"] > ul'
},

/** @inheritdoc */
_init: function () {
var menu,
originalInit = this._super.bind(this);

// render breadcrumbs after navigation menu is loaded.
menu = $(this.options.menuContainer).data('mageMenu');

if (typeof menu === 'undefined') {
$(this.options.menuContainer).on('menucreate', function () {
originalInit();
});
} else {
this._super();
}
},

/** @inheritdoc */
_render: function () {
this._appendCatalogCrumbs();
Expand Down Expand Up @@ -89,14 +72,10 @@ define([
* @private
*/
_getCategoryCrumb: function (menuItem) {
var categoryId = /(\d+)/i.exec(menuItem.attr('id'))[0],
categoryName = menuItem.text(),
categoryUrl = menuItem.attr('href');

return {
'name': 'category' + categoryId,
'label': categoryName,
'link': categoryUrl,
'name': 'category',
'label': menuItem.text(),
'link': menuItem.attr('href'),
'title': ''
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
<span class="count" if="maxItemsToDisplay < getCartLineItemsCount()" text="maxItemsToDisplay"/>
<translate args="'of'" if="maxItemsToDisplay < getCartLineItemsCount()"/>
<span class="count" text="getCartLineItemsCount()"/>
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
<!-- ko if: (getCartLineItemsCount() === 1) -->
<span translate="'Item in Cart'"/>
<!--/ko-->
<!-- ko if: (getCartLineItemsCount() > 1) -->
<span translate="'Items in Cart'"/>
<!--/ko-->
</div>

<each args="getRegion('subtotalContainer')" render=""/>
Expand Down
15 changes: 14 additions & 1 deletion app/code/Magento/Paypal/Model/Api/Nvp.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public function callGetExpressCheckoutDetails()
$request = $this->_exportToRequest($this->_getExpressCheckoutDetailsRequest);
$response = $this->call(self::GET_EXPRESS_CHECKOUT_DETAILS, $request);
$this->_importFromResponse($this->_paymentInformationResponse, $response);
$this->_exportAddressses($response);
$this->_exportAddresses($response);
}

/**
Expand Down Expand Up @@ -1461,8 +1461,21 @@ protected function _exportLineItems(array &$request, $i = 0)
*
* @param array $data
* @return void
* @deprecated 100.2.2 typo in method name
* @see _exportAddresses
*/
protected function _exportAddressses($data)
{
$this->_exportAddresses($data);
}

/**
* Create billing and shipping addresses basing on response data
*
* @param array $data
* @return void
*/
protected function _exportAddresses($data)
{
$address = new \Magento\Framework\DataObject();
\Magento\Framework\DataObject\Mapper::accumulateByMap($data, $address, $this->_billingAddressMap);
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Search/view/frontend/web/form-mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ define([

case $.ui.keyCode.ENTER:
this.searchForm.trigger('submit');
e.preventDefault();
break;

case $.ui.keyCode.DOWN:
Expand Down
8 changes: 5 additions & 3 deletions app/code/Magento/Webapi/Model/Soap/Fault.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class Fault
const NODE_DETAIL_WRAPPER = 'GenericFault';
/**#@-*/

/**#@-*/
/**
* @var string
*/
protected $_soapFaultCode;

/**
Expand Down Expand Up @@ -114,7 +116,7 @@ public function __construct(
\Magento\Framework\Locale\ResolverInterface $localeResolver,
State $appState
) {
$this->_soapCode = $exception->getOriginator();
$this->_soapFaultCode = $exception->getOriginator();
$this->_parameters = $exception->getDetails();
$this->_wrappedErrors = $exception->getErrors();
$this->stackTrace = $exception->getStackTrace() ?: $exception->getTraceAsString();
Expand Down Expand Up @@ -194,7 +196,7 @@ public function getDetails()
*/
public function getSoapCode()
{
return $this->_soapCode;
return $this->_soapFaultCode;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="logout">
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/auth/logout/" stepKey="amOnLogoutPage"/>
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
<page name="AdminLogoutPage" url="admin/auth/logout/" area="admin" module="Magento_Backend">
<section name="removeAfterMqe-896"/>
</page>
<page name="AdminLogoutPage" url="admin/auth/logout/" area="admin" module="Magento_Backend"/>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,70 @@
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="seeCategoryInTree"/>
</actionGroup>

<!-- Go to create new root or sub category page -->
<actionGroup name="goToCreateCategoryPage">
<arguments>
<argument name="selector" defaultValue="AdminCategorySidebarActionSection.AddSubcategoryButton"/>
</arguments>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/>
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<click selector="{{selector}}" stepKey="clickOnAddCategory"/>
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/>
</actionGroup>

<!-- Fill category fields -->
<actionGroup name="fillCategoryForm">
<arguments>
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
</arguments>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/>
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/>
</actionGroup>

<!-- Save category form -->
<actionGroup name="saveCategoryForm">
<seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/>
</actionGroup>

<!--Upload image for category -->
<actionGroup name="addCategoryImage">
<arguments>
<argument name="image" defaultValue="ImageUpload"/>
</arguments>
<conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad"/>
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
<attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/>
<waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
<see selector="{{AdminCategoryContentSection.imageFileName}}" userInput="{{image.file}}" stepKey="seeImage"/>
</actionGroup>

<!-- Remove image from category -->
<actionGroup name="removeCategoryImage">
<conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
<click selector="{{AdminCategoryContentSection.removeImageButton}}" stepKey="clickRemoveImage"/>
<waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
<dontSee selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="dontSeeImage"/>
</actionGroup>

<actionGroup name="checkCategoryImageInAdmin">
<arguments>
<argument name="image" defaultValue="ImageUpload"/>
</arguments>
<conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
<see selector="{{AdminCategoryContentSection.imageFileName}}" userInput="{{image.file}}" stepKey="seeImage"/>
</actionGroup>

<!--Actions to check if a category exists on StoreFront-->
<actionGroup name="CheckCategoryOnStorefront">
<arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<section name="AdminCategoryProductsGridSection"/>
<section name="AdminCategoryModalSection"/>
<section name="AdminCategoryMessagesSection"/>
<section name="AdminCategoryContentSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminCategoryContentSection">
<element name="sectionHeader" type="button" selector="div[data-index='content']" timeout="30"/>
<element name="uploadButton" type="button" selector="//*[@class='file-uploader-area']/label[text()='Upload']"/>
<element name="selectFromGalleryButton" type="button" selector="//*[@class='file-uploader-area']/label[text()='Select from Gallery']"/>
<element name="uploadImageFile" type="input" selector=".file-uploader-area>input"/>
<element name="imageFileName" type="text" selector=".file-uploader-filename"/>
<element name="removeImageButton" type="button" selector=".file-uploader-summary .action-remove"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
<element name="productLink" type="text" selector="a.product-item-link"/>
<element name="productLinkByHref" type="text" selector="a.product-item-link[href$='{{var1}}.html']" parameterized="true"/>
<element name="productPrice" type="text" selector="div.price-box.price-final_price"/>
<element name="categoryImage" type="text" selector=".category-image"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="StorefrontProductActionSection">
<element name="quantity" type="input" selector="#qty"/>
<element name="addToCart" type="button" selector="#product-addtocart-button"/>
<element name="addToCartButtonTitleIsAdding" type="text" selector="//button/span[text()='Adding...']"/>
<element name="addToCartButtonTitleIsAdded" type="text" selector="//button/span[text()='Added']"/>
Expand Down
Loading

0 comments on commit 6e2ce07

Please sign in to comment.