Skip to content

Commit 774ba63

Browse files
committed
ACP2E-1542: Pagebuilder floating editor adds "tabindex" attribute when editing hyperlink and saving the template
1 parent a79c344 commit 774ba63

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/PageBuilder/adminhtml/web/js/form/element/image-uploader.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
/* eslint-disable max-nested-callbacks */
88
define([
9+
'jquery',
910
'squire'
10-
], function (Squire) {
11+
], function ($, Squire) {
1112
'use strict';
1213

1314
var uploader,
@@ -72,7 +73,7 @@ define([
7273

7374
beforeEach(function (done) {
7475
injector.mock(mocks);
75-
injector.require(['Magento_PageBuilder/js/form/element/image-uploader', 'jquery'], function (ImageUploader, $) {
76+
injector.require(['Magento_PageBuilder/js/form/element/image-uploader'], function (ImageUploader) {
7677
/**
7778
* A stub constructor to bypass the original
7879
* @constructor
@@ -113,7 +114,7 @@ define([
113114
expect(uploader.$uploadArea.removeClass).toHaveBeenCalledWith('foo bar');
114115
});
115116

116-
scenarios.forEach(function (scenario, i) {
117+
$.each(scenarios, function (i, scenario) {
117118
it('Should add modifier classes if configuration is met in scenario ' + i, function () {
118119
uploader.elementWidthModifierClasses = scenario.config;
119120
spyOn(uploader.$uploadArea, 'is').and.returnValue(true);

dev/tests/js/jasmine/tests/app/code/Magento/PageBuilder/adminhtml/web/js/form/element/wysiwyg.test.js

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,34 @@
66

77
/* eslint-disable max-nested-callbacks */
88
define([
9-
'squire'
10-
], function (Squire) {
9+
'jquery',
10+
'Magento_PageBuilder/js/form/element/wysiwyg'
11+
], function ($, UiWysiwyg) {
1112
'use strict';
1213

13-
var injector = new Squire(),
14-
mocks = {
15-
'Magento_PageBuilder/js/events': jasmine.createSpyObj('events',['on', 'trigger']),
16-
'Magento_PageBuilder/js/page-builder': function () {}
17-
},
18-
wysiwyg,
19-
$;
14+
var wysiwyg;
2015

21-
beforeEach(function (done) {
22-
injector.mock(mocks);
23-
injector.require(['Magento_PageBuilder/js/form/element/wysiwyg', 'jquery'], function (UiWysiwyg, jq) {
24-
var MockWysiwyg = function () {};
16+
function createWysiwygMock() {
17+
var mock,
18+
MockWysiwyg = function () {};
2519

26-
MockWysiwyg.prototype = Object.create(UiWysiwyg.prototype);
27-
MockWysiwyg.prototype.constructor = MockWysiwyg;
28-
wysiwyg = new MockWysiwyg();
29-
$ = jq;
30-
$.extend(wysiwyg, UiWysiwyg.defaults, {pageBuilder: {id: 'pb-wysiwyg-test'}});
31-
$(document.body).append(
32-
$('<div><div contenteditable="true"><a href="/login"></a><span tabindex="0"></span></div></div>')
33-
.attr('id', wysiwyg.pageBuilder.id)
34-
);
35-
done();
36-
});
20+
MockWysiwyg.prototype = Object.create(UiWysiwyg.prototype);
21+
MockWysiwyg.prototype.constructor = MockWysiwyg;
22+
mock = new MockWysiwyg();
23+
$.extend(mock, UiWysiwyg.defaults);
24+
return mock;
25+
}
26+
27+
beforeEach(function () {
28+
wysiwyg = createWysiwygMock();
29+
wysiwyg.pageBuilder = {id: 'pb-wysiwyg-test'};
30+
$(document.body).append(
31+
$('<div><div contenteditable="true"><a href="/login"></a><span tabindex="0"></span></div></div>')
32+
.attr('id', wysiwyg.pageBuilder.id)
33+
);
3734
});
3835

3936
afterEach(function () {
40-
try {
41-
injector.clean();
42-
injector.remove();
43-
} catch (e) {}
4437
$('#' + wysiwyg.pageBuilder.id).remove();
4538
});
4639

0 commit comments

Comments
 (0)