Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-co…
Browse files Browse the repository at this point in the history
…m-pr7
  • Loading branch information
zakdma committed Nov 28, 2019
2 parents 0319a23 + c7ca62e commit da284ab
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
106 changes: 106 additions & 0 deletions app/code/Magento/Customer/Test/Unit/Block/Account/NavigationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Customer\Test\Unit\Block\Account;

use PHPUnit\Framework\TestCase;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Customer\Block\Account\Navigation;
use Magento\Framework\View\Element\Template\Context;
use Magento\Framework\View\LayoutInterface;
use Magento\Wishlist\Block\Link as WishListLink;
use Magento\Customer\Block\Account\Link as CustomerAccountLink;

class NavigationTest extends TestCase
{
/**
* @var ObjectManagerHelper
*/
private $objectManagerHelper;

/**
* @var Navigation
*/
private $navigation;

/**
* @var Context|\PHPUnit_Framework_MockObject_MockObject
*/
private $contextMock;

/**
* @var LayoutInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $layoutMock;

/**
* Setup environment for test
*/
protected function setUp()
{
$this->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()
{
$wishListLinkMock = $this->getMockBuilder(WishListLink::class)
->disableOriginalConstructor()
->setMethods(['getSortOrder'])
->getMock();

$customerAccountLinkMock = $this->getMockBuilder(CustomerAccountLink::class)
->disableOriginalConstructor()
->setMethods(['getSortOrder'])
->getMock();

$wishListLinkMock->expects($this->any())
->method('getSortOrder')
->willReturn(100);

$customerAccountLinkMock->expects($this->any())
->method('getSortOrder')
->willReturn(20);

$nameInLayout = 'top.links';

$blockChildren = [
'wishListLink' => $wishListLinkMock,
'customerAccountLink' => $customerAccountLinkMock
];

$this->navigation->setNameInLayout($nameInLayout);
$this->layoutMock->expects($this->any())
->method('getChildBlocks')
->with($nameInLayout)
->willReturn($blockChildren);

/* Assertion */
$this->assertEquals(
[
0 => $wishListLinkMock,
1 => $customerAccountLinkMock
],
$this->navigation->getLinks()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@
</span>
</label>
<div class="control">
<?php
$_validationClass = $block->escapeHtmlAttr(
$this->helper(\Magento\Customer\Helper\Address::class)
->getAttributeValidationClass('telephone')
);
?>
<input type="text"
name="telephone"
id="telephone"
value="<?= $block->escapeHtmlAttr($block->getTelephone()) ?>"
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
class="input-text <?= $_validationClass ?: '' ?>"
class="input-text <?= $block->escapeHtmlAttr(
$block->getAttributeValidationClass('telephone')
) ?>"
>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php
/**
* Oder statuses grid collection
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\ResourceModel\Status;

/**
* Order statuses grid collection.
*/
class Collection extends \Magento\Sales\Model\ResourceModel\Order\Status\Collection
{
/**
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

/**
Expand Down
48 changes: 44 additions & 4 deletions app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -38,6 +39,18 @@ define([
}
},

/**
* Initialize image preview component
*
* @returns {Object}
*/
initialize: function () {
this._super();
$(document).on('keydown', this.handleKeyDown.bind(this));

return this;
},

/**
* Init observable variables
* @return {Object}
Expand All @@ -60,8 +73,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);
},
Expand All @@ -72,7 +90,12 @@ define([
* @param {Object} record
*/
prev: function (record) {
var recordToShow = this.getRecord(record._rowIndex - 1);
var recordToShow;

if (record._rowIndex === 0) {
return;
}
recordToShow = this.getRecord(record._rowIndex - 1);

recordToShow.rowNumber = record.firstInRow ? record.rowNumber - 1 : record.rowNumber;
this.show(recordToShow);
Expand Down Expand Up @@ -206,6 +229,23 @@ define([
block: 'center',
inline: 'nearest'
});
},

/**
* Handle keyboard navigation for image preview
*
* @param {Object} e
*/
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());
}
}
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ 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 = '<select name="groups[item_options]" id="123" class="customer_group_select" '
$expectedResult = '<select name="groups[item_options]" id="123" '
. 'class="customer_group_select admin__control-select" '
. 'title="Customer Group" ><option value="32000" >ALL GROUPS</option><option value="0" >NOT LOGGED IN'
. '</option><option value="1" >General</option><option value="2" >Wholesale</option><option value="3" >'
. 'Retailer</option></select>';
Expand Down
41 changes: 41 additions & 0 deletions dev/tests/js/jasmine/tests/lib/mage/tinymce4Adapter.test.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
8 changes: 2 additions & 6 deletions lib/internal/Magento/Framework/Data/Form/Element/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected function _getPluginButtonsHtml($visible = true)
if (isset($buttonOptions['style'])) {
$configStyle = $buttonOptions['style'];
}
$buttonOptions = array_merge($buttonOptions, ['style' => 'display:none;' . $configStyle]);
$buttonOptions['style'] = 'display:none; ' . $configStyle;
}
$buttonsHtml .= $this->_getButtonHtml($buttonOptions);
}
Expand Down Expand Up @@ -409,7 +409,7 @@ protected function _getButtonHtml($data)
protected function _wrapIntoContainer($html)
{
if (!$this->getConfig('use_container')) {
return '<div class="admin__control-wysiwig">' .$html . '</div>';
return '<div class="admin__control-wysiwig">' . $html . '</div>';
}

$html = '<div id="editor' . $this->getHtmlId() . '"'
Expand Down Expand Up @@ -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);
//]]>
});
</script>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
namespace Magento\Framework\Setup\Patch;

/**
* For backward compatibility with versioned style module installation. Deprecated since creation.
* 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.
*
* @deprecated
*/
interface PatchVersionInterface
{
Expand All @@ -19,7 +20,6 @@ interface PatchVersionInterface
* by old mechanism of UpgradeData.php script
*
* @return string
* @deprecated since appearance, required for backward compatibility
*/
public static function getVersion();
}
1 change: 1 addition & 0 deletions lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ define([
tinyMCE4.init(settings);
this.getPluginButtons().hide();
varienGlobalEvents.clearEventHandlers('open_browser_callback');
this.eventBus.clearEventHandlers('open_browser_callback');
this.eventBus.attachEventHandler('open_browser_callback', tinyMceEditors.get(self.id).openFileBrowser);
}.bind(this));
},
Expand Down

0 comments on commit da284ab

Please sign in to comment.