Skip to content

Commit a524e4f

Browse files
committed
PB-301: Products lose their conditions after upgrade
1 parent dbe5453 commit a524e4f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/mass-converter/carousel-widget-directive.test.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ define([
6969
it('Should transform regular properties', function () {
7070
var data = {
7171
carousel_products_count: 123,
72-
conditions_encoded: '[]'
72+
conditions_encoded: '[]',
73+
condition_option: 'condition',
74+
sort_order: 'position'
7375
},
7476
config = {
7577
html_variable: 'myhtml'
@@ -86,6 +88,9 @@ define([
8688
expect(result.myhtml).toContain(' id_path=""');
8789
expect(result.myhtml).toContain(' show_pager="0"');
8890
expect(result.myhtml).toContain(' type_name="Catalog Products Carousel"');
91+
expect(result.myhtml).toContain(' condition_option="condition');
92+
expect(result.myhtml).toContain(' sort_order="position');
93+
expect(result.myhtml).toContain(' condition_option_value=""');
8994
});
9095
it('Should encode conditions_encoded', function () {
9196
var data = {
@@ -107,12 +112,24 @@ define([
107112
expect(result.myhtml).toContain(' show_pager="0"');
108113
expect(result.myhtml).toContain(' type_name="Catalog Products Carousel"');
109114
});
115+
it('Should not add empty sort_order attribute', function () {
116+
var data = {
117+
carousel_products_count: 123,
118+
conditions_encoded: '[]'
119+
},
120+
config = {
121+
html_variable: 'myhtml'
122+
},
123+
result = model.toDom(data, config);
124+
expect(result.myhtml).not.toContain('sort_order');
125+
});
110126
});
111127
describe('fromDom', function () {
112128
it('Should parse regular properties without conditions_encoded', function () {
113129
var expected = {
114130
carousel_products_count: '123',
115-
conditions_encoded: ''
131+
conditions_encoded: '',
132+
condition_option: 'condition'
116133
},
117134
config = {
118135
html_variable: 'myhtml'
@@ -124,6 +141,7 @@ define([
124141

125142
expect(result.carousel_products_count).toBe(expected.carousel_products_count);
126143
expect(result.conditions_encoded).toBe(expected.conditions_encoded);
144+
expect(result.condition_option).toBe(expected.condition_option);
127145
// assert the automatically added properties do not get returned.
128146
expect(result.type).toBe(undefined);
129147
expect(result.id_path).toBe(undefined);

0 commit comments

Comments
 (0)