Skip to content

Commit 4129c75

Browse files
committed
Merge branch 'ACP2E-1568' of https://github.com/magento-l3/magento2-page-builder into PR-2023-02-24
2 parents 477fcf8 + a206263 commit 4129c75

File tree

3 files changed

+49
-5
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web
  • dev/tests/js/jasmine/tests/app/code/Magento/PageBuilder/adminhtml/web/js/content-type/column-group

3 files changed

+49
-5
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/column-group/preview.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/column-group/preview.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {DataObject} from "../../data-store";
2121
import {moveContentType} from "../../drag-drop/move-content-type";
2222
import {getDraggedContentTypeConfig} from "../../drag-drop/registry";
2323
import {hiddenClass} from "../../drag-drop/sortable";
24+
import checkStageFullScreen from "../../utils/check-stage-full-screen";
2425
import {createStyleSheet} from "../../utils/create-stylesheet";
2526
import {default as ColumnGroupPreview} from "../column-group/preview";
2627
import {BindResizeHandleEventParamsInterface, InitElementEventParamsInterface} from "../column/column-events.types";
@@ -134,7 +135,7 @@ export default class Preview extends PreviewCollection {
134135
});
135136

136137
events.on(
137-
`stage:${this.contentType.stageId}:fullScreenModeChangeAfter`,
138+
`stage:${this.contentType.stageId}:readyAfter`,
138139
this.moveContentsToNewColumnGroup.bind(this),
139140
);
140141

@@ -624,7 +625,7 @@ export default class Preview extends PreviewCollection {
624625
private hasColumnLine(contentType: ContentTypeInterface | ContentTypeCollectionInterface): boolean {
625626
const children = this.contentType.getChildren()();
626627
let hasColumnLine = false;
627-
if (children.length === 0) {
628+
if (children.length === 0 && checkStageFullScreen(contentType.stageId)) {
628629
// new column group, so it has a column line
629630
hasColumnLine = true;
630631
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/* eslint-disable max-nested-callbacks */
7+
define([
8+
'ko',
9+
'jquery',
10+
'Magento_PageBuilder/js/content-type/column-group/preview',
11+
'Magento_PageBuilder/js/config',
12+
'Magento_PageBuilder/js/events'
13+
], function (ko,$, Preview, Config, Events) {
14+
'use strict';
15+
16+
describe('Magento_PageBuilder/js/content-type/column-group/preview', function () {
17+
var model;
18+
19+
beforeEach(function () {
20+
Config.config = {content_types: {}};
21+
model = new Preview(
22+
{
23+
dataStore: {subscribe: jasmine.createSpy()},
24+
getChildren: function () {
25+
return ko.observableArray([]);
26+
},
27+
children: {subscribe: jasmine.createSpy()},
28+
stageId: 'STAGEID'
29+
},
30+
{config: {content_types: {}}});
31+
});
32+
33+
describe('Stage readyAfter event', function () {
34+
it('Should call methods to upgrade to column-line if needed', function () {
35+
spyOn(model, 'getCurrentIndexInParent');
36+
spyOn(model, 'hasColumnLine');
37+
Events.trigger('stage:' + model.contentType.stageId + ':readyAfter');
38+
expect(model.getCurrentIndexInParent).toHaveBeenCalled();
39+
expect(model.hasColumnLine).toHaveBeenCalled();
40+
});
41+
});
42+
});
43+
});

0 commit comments

Comments
 (0)