File tree 3 files changed +20
-10
lines changed
ConfigurableProduct/view/adminhtml/web/js/components
Ui/view/base/web/js/dynamic-rows
dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components
3 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -219,19 +219,18 @@ define([
219
219
_ . each ( tmpData , function ( row , index ) {
220
220
path = this . dataScope + '.' + this . index + '.' + ( this . startIndex + index ) ;
221
221
row . attributes = $ ( '<i></i>' ) . text ( row . attributes ) . html ( ) ;
222
- row . sku = row . sku ;
223
222
this . source . set ( path , row ) ;
224
223
} , this ) ;
225
224
226
225
this . source . set ( this . dataScope + '.' + this . index , data ) ;
227
226
this . parsePagesData ( data ) ;
228
227
229
228
// Render
230
- dataCount = data . length ;
229
+ dataCount = tmpData . length ;
231
230
elemsCount = this . elems ( ) . length ;
232
231
233
232
if ( dataCount > elemsCount ) {
234
- this . getChildItems ( ) . each ( function ( elemData , index ) {
233
+ tmpData . each ( function ( elemData , index ) {
235
234
this . addChild ( elemData , this . startIndex + index ) ;
236
235
} , this ) ;
237
236
} else {
@@ -243,6 +242,15 @@ define([
243
242
this . generateAssociatedProducts ( ) ;
244
243
} ,
245
244
245
+ /**
246
+ * Set initial property to records data
247
+ *
248
+ * @returns {Object } Chainable.
249
+ */
250
+ setInitialProperty : function ( ) {
251
+ return this ;
252
+ } ,
253
+
246
254
/**
247
255
* Parsed data
248
256
*
Original file line number Diff line number Diff line change @@ -1126,13 +1126,17 @@ define([
1126
1126
* Update whether value differs from default value
1127
1127
*/
1128
1128
setDifferedFromDefault : function ( ) {
1129
- var recordData = utils . copy ( this . recordData ( ) ) ;
1129
+ var recordData ;
1130
1130
1131
- Array . isArray ( recordData ) && recordData . forEach ( function ( item ) {
1132
- delete item [ 'record_id' ] ;
1133
- } ) ;
1131
+ if ( this . default ) {
1132
+ recordData = utils . copy ( this . recordData ( ) ) ;
1133
+
1134
+ Array . isArray ( recordData ) && recordData . forEach ( function ( item ) {
1135
+ delete item [ 'record_id' ] ;
1136
+ } ) ;
1134
1137
1135
- this . isDifferedFromDefault ( ! _ . isEqual ( recordData , this . default ) ) ;
1138
+ this . isDifferedFromDefault ( ! _ . isEqual ( recordData , this . default ) ) ;
1139
+ }
1136
1140
} ,
1137
1141
1138
1142
/**
Original file line number Diff line number Diff line change @@ -41,11 +41,9 @@ define([
41
41
} )
42
42
} ;
43
43
44
- model . getChildItems = jasmine . createSpy ( ) . and . returnValue ( $ ( '' ) ) ;
45
44
model . source = sourceMock ;
46
45
model . processingUnionInsertData ( mockData ) ;
47
46
expect ( model . source . get ) . toHaveBeenCalled ( ) ;
48
- expect ( model . getChildItems ) . toHaveBeenCalled ( ) ;
49
47
expect ( expectedData [ 1 ] . sku ) . toBe ( 'Conf&-sdfs' ) ;
50
48
} ) ;
51
49
You can’t perform that action at this time.
0 commit comments