From 666a333d19152b86069f2a0e667fc61631141f3d Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Thu, 29 Aug 2019 17:44:27 +0530 Subject: [PATCH 01/22] Correct spelling --- .../Magento/Sales/Model/ResourceModel/Status/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php index 23d835db603df..393494858a3bb 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php @@ -1,6 +1,6 @@ Date: Thu, 29 Aug 2019 17:46:44 +0530 Subject: [PATCH 02/22] update Correct spelling --- .../Magento/Sales/Model/ResourceModel/Status/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php index 393494858a3bb..f429a62fc3f03 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php @@ -1,6 +1,6 @@ Date: Fri, 1 Nov 2019 10:09:20 +0530 Subject: [PATCH 03/22] move description before the class name --- .../Magento/Sales/Model/ResourceModel/Status/Collection.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php index f429a62fc3f03..f9dc4a7d83ae2 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php @@ -1,12 +1,14 @@ Date: Fri, 15 Nov 2019 00:10:37 +0530 Subject: [PATCH 04/22] Resolved Adobe issue 691 --- .../base/web/js/grid/columns/image-preview.js | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js index 1ef2ebf6594fa..7cbbfdab28ba1 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js @@ -4,8 +4,9 @@ */ define([ 'jquery', - 'Magento_Ui/js/grid/columns/column' -], function ($, Column) { + 'Magento_Ui/js/grid/columns/column', + 'Magento_Ui/js/lib/key-codes' +], function ($, Column, keyCodes) { 'use strict'; return Column.extend({ @@ -32,6 +33,18 @@ define([ } }, + /** + * Initialize image preview component + * + * @returns {Object} + */ + initialize: function () { + this._super(); + this.setNavigationListener(); + + return this; + }, + /** * Init observable variables * @return {Object} @@ -174,6 +187,36 @@ define([ block: 'center', inline: 'nearest' }); - } + }, + + /** + * Set image preview keyboard navigation listener + */ + setNavigationListener: function () { + var imageIndex, endIndex, key, + startIndex = 0, + imageColumnSelector = '.masonry-image-column', + adobeModalSelector = '.adobe-stock-modal', + imageGridSelector = '.masonry-image-grid'; + + $(document).on('keydown', function(e) { + key = keyCodes[e.keyCode]; + endIndex = $(imageGridSelector)[0].children.length - 1; + + if($(this.previewImageSelector).length > 0) { + imageIndex = $(this.previewImageSelector) + .parents(imageColumnSelector) + .data('repeatIndex'); + } + + if($(adobeModalSelector).hasClass('_show')) { + if(key === 'pageLeftKey' && imageIndex !== startIndex) { + $(this.previewImageSelector + ' .action-previous').click(); + } else if (key === 'pageRightKey' && imageIndex !== endIndex) { + $(this.previewImageSelector + ' .action-next').click(); + } + } + }); + }, }); }); From 53515bdd1d06206f3f126254aaa719abbbc2e8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Mon, 18 Nov 2019 15:10:36 -0300 Subject: [PATCH 05/22] Telephone Widget > Template > Removing this and helper --- .../view/frontend/templates/widget/telephone.phtml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/widget/telephone.phtml b/app/code/Magento/Customer/view/frontend/templates/widget/telephone.phtml index c444a15705909..4c3432233189b 100644 --- a/app/code/Magento/Customer/view/frontend/templates/widget/telephone.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/widget/telephone.phtml @@ -14,18 +14,14 @@
- escapeHtmlAttr( - $this->helper(\Magento\Customer\Helper\Address::class) - ->getAttributeValidationClass('telephone') - ); - ?>
From dc1ab99136f06a550a12580832bca6cd726b0440 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Wed, 20 Nov 2019 17:13:21 +0200 Subject: [PATCH 06/22] Remove duplicated fireEcent, that prevents to duble initialization --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index df691601eccb9..6cc53e3d40d92 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -293,7 +293,6 @@ define([ }; varienGlobalEvents.fireEvent('open_browser_callback', payload); - this.eventBus.fireEvent('open_browser_callback', payload); }.bind(this); } From d56adbb6e91bb014feafa6febfde65a53b7d3cf3 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Thu, 21 Nov 2019 09:23:14 +0200 Subject: [PATCH 07/22] Revert event add checks that method not fires two times at the time --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 6cc53e3d40d92..94e931f3349d7 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -293,6 +293,7 @@ define([ }; varienGlobalEvents.fireEvent('open_browser_callback', payload); + this.eventBus.fireEvent('open_browser_callback', payload); }.bind(this); } @@ -372,7 +373,7 @@ define([ /** * @param {Object} o */ - openFileBrowser: function (o) { + openFileBrowser: _.debounce(function (o) { var typeTitle = this.translate('Select Images'), storeId = this.config['store_id'] ? this.config['store_id'] : 0, frameDialog = jQuery('div.mce-container[role="dialog"]'), @@ -405,7 +406,7 @@ define([ } ); }); - }, + }, 250), /** * @param {String} string From 76b782005c1913981244f1547d74af5ef80c7433 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 21 Nov 2019 15:08:52 -0600 Subject: [PATCH 08/22] MC-17545: Remove deprecation annotations from the PatchVersionInterface --- .../Magento/Framework/Setup/Patch/PatchVersionInterface.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php b/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php index fb2b0e2c379f4..1638d67041a11 100644 --- a/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php +++ b/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php @@ -6,9 +6,8 @@ namespace Magento\Framework\Setup\Patch; /** - * For backward compatibility with versioned style module installation. Deprecated since creation. + * For backward compatibility with versioned style module installation. * - * @deprecated */ interface PatchVersionInterface { @@ -19,7 +18,6 @@ interface PatchVersionInterface * by old mechanism of UpgradeData.php script * * @return string - * @deprecated since appearance, required for backward compatibility */ public static function getVersion(); } From a880a833582e76446ca12e23850805da0357299c Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Fri, 22 Nov 2019 14:38:47 +0200 Subject: [PATCH 09/22] remove duplicated events on wisiwyg initialization --- lib/internal/Magento/Framework/Data/Form/Element/Editor.php | 4 ---- lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index b5f2017501c01..92dc2e6c97ecd 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -533,10 +533,6 @@ protected function getInlineJs($jsSetupObject, $forceLoad) $jsSetupObject . ')); varienGlobalEvents.attachEventHandler("formSubmit", editorFormValidationHandler); - varienGlobalEvents.clearEventHandlers("open_browser_callback"); - varienGlobalEvents.attachEventHandler("open_browser_callback", ' . - $jsSetupObject . - '.openFileBrowser); //]]> }); '; diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js index 94e931f3349d7..df691601eccb9 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js @@ -373,7 +373,7 @@ define([ /** * @param {Object} o */ - openFileBrowser: _.debounce(function (o) { + openFileBrowser: function (o) { var typeTitle = this.translate('Select Images'), storeId = this.config['store_id'] ? this.config['store_id'] : 0, frameDialog = jQuery('div.mce-container[role="dialog"]'), @@ -406,7 +406,7 @@ define([ } ); }); - }, 250), + }, /** * @param {String} string From 07fc246f5db339b9a79cc9ebe841df28eb1a239e Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Fri, 22 Nov 2019 15:03:06 +0200 Subject: [PATCH 10/22] Static test fix --- lib/internal/Magento/Framework/Data/Form/Element/Editor.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index 92dc2e6c97ecd..0c9a3ee5b9495 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -309,9 +309,11 @@ protected function _getPluginButtonsHtml($visible = true) $configStyle = ''; if (isset($buttonOptions['style'])) { $configStyle = $buttonOptions['style']; - } + } + // phpcs:disable Magento2.Performance.ForeachArrayMerge $buttonOptions = array_merge($buttonOptions, ['style' => 'display:none;' . $configStyle]); - } + // phpcs:enable + } $buttonsHtml .= $this->_getButtonHtml($buttonOptions); } } From a6ba5850045eb2276fb91ce6b12bf0e12b90b383 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Fri, 22 Nov 2019 15:24:42 +0200 Subject: [PATCH 11/22] Remove duplicated event --- .../Magento/Framework/Data/Form/Element/Editor.php | 8 ++++---- .../mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index 0c9a3ee5b9495..5059fb38f29ca 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -309,11 +309,11 @@ protected function _getPluginButtonsHtml($visible = true) $configStyle = ''; if (isset($buttonOptions['style'])) { $configStyle = $buttonOptions['style']; - } + } // phpcs:disable Magento2.Performance.ForeachArrayMerge $buttonOptions = array_merge($buttonOptions, ['style' => 'display:none;' . $configStyle]); - // phpcs:enable - } + // phpcs:enable + } $buttonsHtml .= $this->_getButtonHtml($buttonOptions); } } @@ -411,7 +411,7 @@ protected function _getButtonHtml($data) protected function _wrapIntoContainer($html) { if (!$this->getConfig('use_container')) { - return '
' .$html . '
'; + return '
' . $html . '
'; } $html = '
Date: Fri, 22 Nov 2019 17:07:53 +0200 Subject: [PATCH 12/22] Fix for tinymce3 editor --- app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index bb3300baf988a..86602b2017c15 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -78,6 +78,8 @@ define([ } tinyMCE3.init(this.getSettings(mode)); + varienGlobalEvents.clearEventHandlers("open_browser_callback"); + varienGlobalEvents.attachEventHandler("open_browser_callback", tinyMceEditors.get(this.id).openFileBrowser); }, /** From 34998b6ee11084d047aeca7c137d4fd65818e821 Mon Sep 17 00:00:00 2001 From: Eden Date: Sat, 23 Nov 2019 23:10:37 +0700 Subject: [PATCH 13/22] Resolve Wrong Css at "Minimum Qty Allowed in Shopping Cart" on Google Chrome issue25647 --- .../Block/Adminhtml/Form/Field/Minsaleqty.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php index 6c4f6a0f46a59..ffcb758dcbd66 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php @@ -37,7 +37,7 @@ protected function _getGroupRenderer() '', ['data' => ['is_render_to_js_template' => true]] ); - $this->_groupRenderer->setClass('customer_group_select'); + $this->_groupRenderer->setClass('customer_group_select admin__control-select'); } return $this->_groupRenderer; } @@ -57,7 +57,7 @@ protected function _prepareToRender() 'min_sale_qty', [ 'label' => __('Minimum Qty'), - 'class' => 'required-entry validate-number validate-greater-than-zero' + 'class' => 'required-entry validate-number validate-greater-than-zero admin__control-text' ] ); $this->_addAfter = false; From 20fd591f056285e1d906fd64fe18919f83e5963e Mon Sep 17 00:00:00 2001 From: Eden Date: Sat, 23 Nov 2019 23:12:03 +0700 Subject: [PATCH 14/22] Resolve Wrong Css at "Minimum Qty Allowed in Shopping Cart" on Google Chrome issue25647 --- .../Block/Adminhtml/Form/Field/CustomergroupTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php index 527828a92dea8..f552f10d50304 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php @@ -22,11 +22,11 @@ protected function setUp() public function testToHtml() { - $this->_block->setClass('customer_group_select'); + $this->_block->setClass('customer_group_select admin__control-select'); $this->_block->setId('123'); $this->_block->setTitle('Customer Group'); $this->_block->setInputName('groups[item_options]'); - $expectedResult = ''; From 0a4393ccce5760c8551a315ac774b160c0b6e19a Mon Sep 17 00:00:00 2001 From: Eden Date: Sat, 23 Nov 2019 23:51:12 +0700 Subject: [PATCH 15/22] Fix static test --- .../Block/Adminhtml/Form/Field/CustomergroupTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php index f552f10d50304..b7be72e9ff827 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php @@ -26,7 +26,8 @@ public function testToHtml() $this->_block->setId('123'); $this->_block->setTitle('Customer Group'); $this->_block->setInputName('groups[item_options]'); - $expectedResult = ''; From 7b16d76207684bc5422058d323d5e35d36ac58bc Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Sun, 24 Nov 2019 01:13:15 +0200 Subject: [PATCH 16/22] Cover with js unit test, static test fix --- .../Tinymce3/view/base/web/tinymce3Adapter.js | 4 +- .../tests/lib/mage/tinymce4Adapter.test.js | 41 +++++++++++++++++++ .../Framework/Data/Form/Element/Editor.php | 4 +- 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 dev/tests/js/jasmine/tests/lib/mage/tinymce4Adapter.test.js diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 86602b2017c15..15bc5465e5d04 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -78,8 +78,8 @@ define([ } tinyMCE3.init(this.getSettings(mode)); - varienGlobalEvents.clearEventHandlers("open_browser_callback"); - varienGlobalEvents.attachEventHandler("open_browser_callback", tinyMceEditors.get(this.id).openFileBrowser); + varienGlobalEvents.clearEventHandlers('open_browser_callback'); + varienGlobalEvents.attachEventHandler('open_browser_callback', tinyMceEditors.get(this.id).openFileBrowser); }, /** diff --git a/dev/tests/js/jasmine/tests/lib/mage/tinymce4Adapter.test.js b/dev/tests/js/jasmine/tests/lib/mage/tinymce4Adapter.test.js new file mode 100644 index 0000000000000..7af1a19e4b4c1 --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/tinymce4Adapter.test.js @@ -0,0 +1,41 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'wysiwygAdapter', + 'underscore' +], function (wysiwygAdapter, _) { + 'use strict'; + + var obj; + + beforeEach(function () { + + /** + * Dummy constructor to use for instantiation + * @constructor + */ + var Constr = function () {}; + + Constr.prototype = wysiwygAdapter; + + obj = new Constr(); + obj.eventBus = new window.varienEvents(); + obj.initialize(1, { + 'store_id': 0, + 'tinymce4': { + 'content_css': '' + }, + 'files_browser_window_url': 'url' + }); + obj.setup(); + }); + + describe('"openFileBrowser" method', function () { + it('Opens file browser to given instance', function () { + expect(_.size(obj.eventBus.arrEvents['open_browser_callback'])).toBe(1); + }); + }); +}); diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index 5059fb38f29ca..08a5edd09bf35 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -310,9 +310,7 @@ protected function _getPluginButtonsHtml($visible = true) if (isset($buttonOptions['style'])) { $configStyle = $buttonOptions['style']; } - // phpcs:disable Magento2.Performance.ForeachArrayMerge - $buttonOptions = array_merge($buttonOptions, ['style' => 'display:none;' . $configStyle]); - // phpcs:enable + $buttonOptions['style'] = 'display:none; ' . $configStyle; } $buttonsHtml .= $this->_getButtonHtml($buttonOptions); } From 539e4c620a75aa294050025d02d48f313e6dd2c7 Mon Sep 17 00:00:00 2001 From: Eden Date: Sun, 24 Nov 2019 23:09:54 +0700 Subject: [PATCH 17/22] [Customer] Cover Customer Navigation Block by Unit Test --- .../Unit/Block/Account/NavigationTest.php | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php diff --git a/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php b/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php new file mode 100644 index 0000000000000..ac439d1c7973f --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php @@ -0,0 +1,106 @@ +contextMock = $this->createMock(Context::class); + $this->layoutMock = $this->createMock(LayoutInterface::class); + $this->contextMock->expects($this->any()) + ->method('getLayout') + ->willReturn($this->layoutMock); + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->navigation = $this->objectManagerHelper->getObject( + Navigation::class, + [ + 'context' => $this->contextMock + ] + ); + } + + /** + * Test get links with block customer account link and wish list link + * + * @return void + */ + public function testGetLinksWithCustomerAndWishList() + { + $wishListLink = $this->getMockBuilder(WishListLink::class) + ->disableOriginalConstructor() + ->setMethods(['getSortOrder']) + ->getMock(); + + $customerAccountLink = $this->getMockBuilder(CustomerAccountLink::class) + ->disableOriginalConstructor() + ->setMethods(['getSortOrder']) + ->getMock(); + + $wishListLink->expects($this->any()) + ->method('getSortOrder') + ->willReturn(100); + + $customerAccountLink->expects($this->any()) + ->method('getSortOrder') + ->willReturn(20); + + $nameInLayout = 'top.links'; + + $blockChildren = [ + 'wishListLink' => $wishListLink, + 'customerAccountLink' => $customerAccountLink + ]; + + $this->navigation->setNameInLayout($nameInLayout); + $this->layoutMock->expects($this->any()) + ->method('getChildBlocks') + ->with($nameInLayout) + ->willReturn($blockChildren); + + /* Assertion */ + $this->assertEquals( + [ + 0 => $wishListLink, + 1 => $customerAccountLink + ], + $this->navigation->getLinks() + ); + } +} From 49b0c16a24a0bc8b77f2066f4f2bd8a1856f21bc Mon Sep 17 00:00:00 2001 From: Eden Date: Sun, 24 Nov 2019 23:10:51 +0700 Subject: [PATCH 18/22] [Customer] Cover Customer Navigation Block by Unit Test --- .../Test/Unit/Block/Account/NavigationTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php b/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php index ac439d1c7973f..e8c7bd886ab01 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php @@ -63,29 +63,29 @@ protected function setUp() */ public function testGetLinksWithCustomerAndWishList() { - $wishListLink = $this->getMockBuilder(WishListLink::class) + $wishListLinkMock = $this->getMockBuilder(WishListLink::class) ->disableOriginalConstructor() ->setMethods(['getSortOrder']) ->getMock(); - $customerAccountLink = $this->getMockBuilder(CustomerAccountLink::class) + $customerAccountLinkMock = $this->getMockBuilder(CustomerAccountLink::class) ->disableOriginalConstructor() ->setMethods(['getSortOrder']) ->getMock(); - $wishListLink->expects($this->any()) + $wishListLinkMock->expects($this->any()) ->method('getSortOrder') ->willReturn(100); - $customerAccountLink->expects($this->any()) + $customerAccountLinkMock->expects($this->any()) ->method('getSortOrder') ->willReturn(20); $nameInLayout = 'top.links'; $blockChildren = [ - 'wishListLink' => $wishListLink, - 'customerAccountLink' => $customerAccountLink + 'wishListLink' => $wishListLinkMock, + 'customerAccountLink' => $customerAccountLinkMock ]; $this->navigation->setNameInLayout($nameInLayout); @@ -97,8 +97,8 @@ public function testGetLinksWithCustomerAndWishList() /* Assertion */ $this->assertEquals( [ - 0 => $wishListLink, - 1 => $customerAccountLink + 0 => $wishListLinkMock, + 1 => $customerAccountLinkMock ], $this->navigation->getLinks() ); From 1298766deffe2c992b3f29aeb85454cc7bc6e44c Mon Sep 17 00:00:00 2001 From: Adarsh Manickam Date: Tue, 19 Nov 2019 20:01:53 +0530 Subject: [PATCH 19/22] Refactored action click --- .../base/web/js/grid/columns/image-preview.js | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js index 7cbbfdab28ba1..98bb5770dca5d 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js @@ -40,7 +40,7 @@ define([ */ initialize: function () { this._super(); - this.setNavigationListener(); + $(document).on('keydown', this.handleKeyDown.bind(this)); return this; }, @@ -67,8 +67,13 @@ define([ * @param {Object} record */ next: function (record) { - var recordToShow = this.getRecord(record._rowIndex + 1); + var recordToShow; + if (record._rowIndex + 1 === this.masonry().rows().length) { + return; + } + + recordToShow = this.getRecord(record._rowIndex + 1); recordToShow.rowNumber = record.lastInRow ? record.rowNumber + 1 : record.rowNumber; this.show(recordToShow); }, @@ -79,6 +84,9 @@ define([ * @param {Object} record */ prev: function (record) { + if (record._rowIndex === 0) { + return; + } var recordToShow = this.getRecord(record._rowIndex - 1); recordToShow.rowNumber = record.firstInRow ? record.rowNumber - 1 : record.rowNumber; @@ -190,33 +198,20 @@ define([ }, /** - * Set image preview keyboard navigation listener + * Handle keyboard navigation for image preview + * + * @param {Object} e */ - setNavigationListener: function () { - var imageIndex, endIndex, key, - startIndex = 0, - imageColumnSelector = '.masonry-image-column', - adobeModalSelector = '.adobe-stock-modal', - imageGridSelector = '.masonry-image-grid'; - - $(document).on('keydown', function(e) { - key = keyCodes[e.keyCode]; - endIndex = $(imageGridSelector)[0].children.length - 1; - - if($(this.previewImageSelector).length > 0) { - imageIndex = $(this.previewImageSelector) - .parents(imageColumnSelector) - .data('repeatIndex'); + handleKeyDown: function (e) { + var key = keyCodes[e.keyCode]; + + if (this.visibleRecord() !== null) { + if (key === 'pageLeftKey') { + this.prev(this.displayedRecord()); + } else if (key === 'pageRightKey') { + this.next(this.displayedRecord()); } - - if($(adobeModalSelector).hasClass('_show')) { - if(key === 'pageLeftKey' && imageIndex !== startIndex) { - $(this.previewImageSelector + ' .action-previous').click(); - } else if (key === 'pageRightKey' && imageIndex !== endIndex) { - $(this.previewImageSelector + ' .action-next').click(); - } - } - }); - }, + } + } }); }); From b7d1359371841ddf9fd8f2494567f56ccb5da027 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Tue, 26 Nov 2019 11:30:29 +0200 Subject: [PATCH 20/22] magento/magento2#5328: Static test fix. --- .../Magento/Sales/Model/ResourceModel/Status/Collection.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php index f9dc4a7d83ae2..83346d4528c22 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Status/Collection.php @@ -6,8 +6,7 @@ namespace Magento\Sales\Model\ResourceModel\Status; /** - * Class Collection - * Oder statuses grid collection + * Order statuses grid collection. */ class Collection extends \Magento\Sales\Model\ResourceModel\Order\Status\Collection { From 41c95a21ff19503b3870748f0c5a8bbb5b6d3bdb Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Tue, 26 Nov 2019 11:34:50 +0200 Subject: [PATCH 21/22] magento/magento2#25611: Static test fix. --- .../Magento/Ui/view/base/web/js/grid/columns/image-preview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js index 98bb5770dca5d..fec9fd969d61e 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js @@ -84,10 +84,12 @@ define([ * @param {Object} record */ prev: function (record) { + var recordToShow; + if (record._rowIndex === 0) { return; } - var recordToShow = this.getRecord(record._rowIndex - 1); + recordToShow = this.getRecord(record._rowIndex - 1); recordToShow.rowNumber = record.firstInRow ? record.rowNumber - 1 : record.rowNumber; this.show(recordToShow); From e695e09b98621ed5d8b593f079299d8e5cdefc40 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 27 Nov 2019 14:18:22 -0600 Subject: [PATCH 22/22] MC-17545: Remove deprecation annotations from the PatchVersionInterface --- .../Magento/Framework/Setup/Patch/PatchVersionInterface.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php b/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php index 1638d67041a11..c1f4439d692a4 100644 --- a/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php +++ b/lib/internal/Magento/Framework/Setup/Patch/PatchVersionInterface.php @@ -7,6 +7,8 @@ /** * For backward compatibility with versioned style module installation. + * The interface should be used for migration from the legacy installation approach to the declarative installation + * mechanism. The usage of this interface prohibited for the new data or schema patches. * */ interface PatchVersionInterface