@@ -69,7 +69,9 @@ define([
69
69
it ( 'Should transform regular properties' , function ( ) {
70
70
var data = {
71
71
carousel_products_count : 123 ,
72
- conditions_encoded : '[]'
72
+ conditions_encoded : '[]' ,
73
+ condition_option : 'condition' ,
74
+ sort_order : 'position'
73
75
} ,
74
76
config = {
75
77
html_variable : 'myhtml'
@@ -86,6 +88,9 @@ define([
86
88
expect ( result . myhtml ) . toContain ( ' id_path=""' ) ;
87
89
expect ( result . myhtml ) . toContain ( ' show_pager="0"' ) ;
88
90
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=""' ) ;
89
94
} ) ;
90
95
it ( 'Should encode conditions_encoded' , function ( ) {
91
96
var data = {
@@ -107,12 +112,24 @@ define([
107
112
expect ( result . myhtml ) . toContain ( ' show_pager="0"' ) ;
108
113
expect ( result . myhtml ) . toContain ( ' type_name="Catalog Products Carousel"' ) ;
109
114
} ) ;
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
+ } ) ;
110
126
} ) ;
111
127
describe ( 'fromDom' , function ( ) {
112
128
it ( 'Should parse regular properties without conditions_encoded' , function ( ) {
113
129
var expected = {
114
130
carousel_products_count : '123' ,
115
- conditions_encoded : ''
131
+ conditions_encoded : '' ,
132
+ condition_option : 'condition'
116
133
} ,
117
134
config = {
118
135
html_variable : 'myhtml'
@@ -124,6 +141,7 @@ define([
124
141
125
142
expect ( result . carousel_products_count ) . toBe ( expected . carousel_products_count ) ;
126
143
expect ( result . conditions_encoded ) . toBe ( expected . conditions_encoded ) ;
144
+ expect ( result . condition_option ) . toBe ( expected . condition_option ) ;
127
145
// assert the automatically added properties do not get returned.
128
146
expect ( result . type ) . toBe ( undefined ) ;
129
147
expect ( result . id_path ) . toBe ( undefined ) ;
0 commit comments