Skip to content

Commit 7b16d76

Browse files
committed
Cover with js unit test, static test fix
1 parent 2c2748d commit 7b16d76

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ define([
7878
}
7979

8080
tinyMCE3.init(this.getSettings(mode));
81-
varienGlobalEvents.clearEventHandlers("open_browser_callback");
82-
varienGlobalEvents.attachEventHandler("open_browser_callback", tinyMceEditors.get(this.id).openFileBrowser);
81+
varienGlobalEvents.clearEventHandlers('open_browser_callback');
82+
varienGlobalEvents.attachEventHandler('open_browser_callback', tinyMceEditors.get(this.id).openFileBrowser);
8383
},
8484

8585
/**
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'wysiwygAdapter',
8+
'underscore'
9+
], function (wysiwygAdapter, _) {
10+
'use strict';
11+
12+
var obj;
13+
14+
beforeEach(function () {
15+
16+
/**
17+
* Dummy constructor to use for instantiation
18+
* @constructor
19+
*/
20+
var Constr = function () {};
21+
22+
Constr.prototype = wysiwygAdapter;
23+
24+
obj = new Constr();
25+
obj.eventBus = new window.varienEvents();
26+
obj.initialize(1, {
27+
'store_id': 0,
28+
'tinymce4': {
29+
'content_css': ''
30+
},
31+
'files_browser_window_url': 'url'
32+
});
33+
obj.setup();
34+
});
35+
36+
describe('"openFileBrowser" method', function () {
37+
it('Opens file browser to given instance', function () {
38+
expect(_.size(obj.eventBus.arrEvents['open_browser_callback'])).toBe(1);
39+
});
40+
});
41+
});

lib/internal/Magento/Framework/Data/Form/Element/Editor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,7 @@ protected function _getPluginButtonsHtml($visible = true)
310310
if (isset($buttonOptions['style'])) {
311311
$configStyle = $buttonOptions['style'];
312312
}
313-
// phpcs:disable Magento2.Performance.ForeachArrayMerge
314-
$buttonOptions = array_merge($buttonOptions, ['style' => 'display:none;' . $configStyle]);
315-
// phpcs:enable
313+
$buttonOptions['style'] = 'display:none; ' . $configStyle;
316314
}
317315
$buttonsHtml .= $this->_getButtonHtml($buttonOptions);
318316
}

0 commit comments

Comments
 (0)