Skip to content

Commit 7bbfbad

Browse files
committed
PB-500 static test fixes and MFTF fixes
1 parent b6f3663 commit 7bbfbad

File tree

5 files changed

+63
-64
lines changed

5 files changed

+63
-64
lines changed

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderRowTest/RowDuplicateTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
<argument name="x" value="5"/>
121121
<argument name="y" value="5"/>
122122
</actionGroup>
123+
<click selector="{{PageBuilderPanel.searchPanel}}" stepKey="clickAwayFromHiddenRow"/>
124+
123125
<!-- Duplicate and Validate Stage -->
124126
<comment userInput="Duplicate" stepKey="commentDuplicate"/>
125127
<actionGroup ref="duplicateContentType" stepKey="duplicateContentType">

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

Lines changed: 30 additions & 30 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/js/content-type/column/preview.js

Lines changed: 5 additions & 5 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: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Resize, {
2626
} from "../column/resize";
2727
import {
2828
ContentTypeDroppedCreateEventParamsInterface,
29-
ContentTypeRemovedEventParamsInterface
29+
ContentTypeRemovedEventParamsInterface,
3030
} from "../content-type-events.types";
3131
import ObservableUpdater from "../observable-updater";
3232
import PreviewCollection from "../preview-collection";
@@ -39,7 +39,6 @@ import {OptionsInterface} from "Magento_PageBuilder/js/content-type-menu/option.
3939
import HideShowOption from "Magento_PageBuilder/js/content-type-menu/hide-show-option";
4040
import ContentTypeInterface from "Magento_PageBuilder/js/content-type.types";
4141

42-
4342
/**
4443
* @api
4544
*/
@@ -149,7 +148,7 @@ export default class Preview extends PreviewCollection {
149148
*/
150149
public onOptionEdit(): void {
151150
const numCols = this.contentType.getChildren()().length;
152-
//count the number of non empty columns
151+
// count the number of non empty columns
153152
let numEmptyColumns = 0;
154153
this.contentType.getChildren()().forEach(
155154
(column: ContentTypeCollectionInterface<ColumnPreview>) => {
@@ -158,13 +157,12 @@ export default class Preview extends PreviewCollection {
158157
}
159158
});
160159

161-
this.contentType.dataStore.set('non_empty_column_count', numCols - numEmptyColumns);
162-
this.contentType.dataStore.set('max_grid_size', getMaxGridSize());
163-
this.contentType.dataStore.set('initial_grid_size', this.contentType.dataStore.get('grid_size'));
160+
this.contentType.dataStore.set("non_empty_column_count", numCols - numEmptyColumns);
161+
this.contentType.dataStore.set("max_grid_size", getMaxGridSize());
162+
this.contentType.dataStore.set("initial_grid_size", this.contentType.dataStore.get("grid_size"));
164163
super.openEdit();
165164
}
166165

167-
168166
/**
169167
* Bind events
170168
*/
@@ -181,7 +179,7 @@ export default class Preview extends PreviewCollection {
181179
}
182180

183181
events.on(`form:${this.contentType.id}:saveAfter`, () => {
184-
if (this.contentType.dataStore.get('grid_size') != this.contentType.dataStore.get('initial_grid_size')) {
182+
if (this.contentType.dataStore.get("grid_size") !== this.contentType.dataStore.get("initial_grid_size")) {
185183
this.updateGridSize();
186184
}
187185
});
@@ -191,10 +189,9 @@ export default class Preview extends PreviewCollection {
191189
* Set default grid size on current column group
192190
*/
193191
public setDefaultGridSizeOnColumnGroup(): void {
194-
this.contentType.dataStore.set('grid_size', getDefaultGridSize());
192+
this.contentType.dataStore.set("grid_size", getDefaultGridSize());
195193
}
196194

197-
198195
/**
199196
* Add Columns to the current Column Group
200197
*
@@ -325,18 +322,6 @@ export default class Preview extends PreviewCollection {
325322
});
326323
}
327324

328-
/**
329-
* Fire the mount event for content types
330-
*
331-
* @param {ContentTypeInterface[]} contentTypes
332-
*/
333-
private fireMountEvent(...contentTypes: ContentTypeInterface[]) {
334-
contentTypes.forEach((contentType) => {
335-
events.trigger("contentType:mountAfter", {id: contentType.id, contentType});
336-
events.trigger(contentType.config.name + ":mountAfter", {id: contentType.id, contentType});
337-
});
338-
}
339-
340325
/**
341326
* Handle an existing column being dropped into a new column group
342327
*
@@ -594,6 +579,18 @@ export default class Preview extends PreviewCollection {
594579
}
595580
}
596581

582+
/**
583+
* Fire the mount event for content types
584+
*
585+
* @param {ContentTypeInterface[]} contentTypes
586+
*/
587+
private fireMountEvent(...contentTypes: ContentTypeInterface[]) {
588+
contentTypes.forEach((contentType) => {
589+
events.trigger("contentType:mountAfter", {id: contentType.id, contentType});
590+
events.trigger(contentType.config.name + ":mountAfter", {id: contentType.id, contentType});
591+
});
592+
}
593+
597594
/**
598595
* Set columns in the group as resizing
599596
*

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
ContentTypeDroppedCreateEventParamsInterface, ContentTypeDuplicateEventParamsInterface,
2222
ContentTypeMountEventParamsInterface,
2323
ContentTypeMoveEventParamsInterface,
24-
ContentTypeRemovedEventParamsInterface
24+
ContentTypeRemovedEventParamsInterface,
2525
} from "../content-type-events.types";
2626
import ObservableUpdater from "../observable-updater";
2727
import PreviewCollection from "../preview-collection";
@@ -293,26 +293,26 @@ export default class Preview extends PreviewCollection {
293293
}
294294

295295
/**
296-
* Reset remove option on all columns in a column-group parentContentType depending on the number of remaining child columns
296+
* Reset remove option on all columns within a column-group depending on the number of remaining child columns
297297
* @param parentContentType
298298
*/
299299
public resetRemoveOnLastColumn(parentContentType: ContentTypeCollectionInterface) {
300300
if (!parentContentType) {
301-
//can happen if the column is moved within the same column group
301+
// can happen if the column is moved within the same column group
302302
return;
303303
}
304304
const siblings = parentContentType.children();
305305
if (siblings.length < 1) {
306306
return;
307307
}
308-
if (siblings.length == 1) {
308+
if (siblings.length === 1) {
309309
const lastColumn = siblings[0];
310310
const options = lastColumn.preview.getOptions();
311-
options.getOption('remove').isDisabled(true)
311+
options.getOption("remove").isDisabled(true);
312312
return;
313313
}
314-
siblings.forEach( function(column) {
315-
const removeOption = column.preview.getOptions().getOption('remove');
314+
siblings.forEach((column) => {
315+
const removeOption = column.preview.getOptions().getOption("remove");
316316
removeOption.isDisabled(false);
317317
});
318318
}

0 commit comments

Comments
 (0)