Skip to content

Commit 57b2ab0

Browse files
committed
Added Jasmine test coverage for fix
1 parent 2737bd8 commit 57b2ab0

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/dynamic-rows/dynamic-rows.test.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2017 Adobe
3+
* All Rights Reserved.
44
*/
55

66
/* eslint-disable max-nested-callbacks */
@@ -204,5 +204,36 @@ define([
204204
expect(model.pages()).toEqual(2);
205205
expect(model.currentPage()).toEqual(2);
206206
});
207+
208+
it('should process pages before addChild', function () {
209+
var ctx = {}; // Mock context
210+
var index = 5;
211+
var prop = 'someProp';
212+
model.pageSize = 2;
213+
model.relatedData = [
214+
{
215+
name: 'first'
216+
},
217+
{
218+
name: 'second'
219+
},
220+
{
221+
name: 'third'
222+
},
223+
{
224+
name: 'fourth'
225+
},
226+
{
227+
name: 'fifth'
228+
}
229+
];
230+
model.bubble = jasmine.createSpy();
231+
model.addChild = jasmine.createSpy();
232+
model.processingAddChild(ctx, index, prop);
233+
expect(model.bubble).toHaveBeenCalledWith('addChild', false);
234+
expect(model.pages()).toEqual(3);
235+
expect(model.currentPage()).toEqual(3);
236+
expect(model.addChild).toHaveBeenCalledWith(ctx, index, prop);
237+
});
207238
});
208239
});

0 commit comments

Comments
 (0)