Skip to content

Commit 1324176

Browse files
committed
MC-37377: Incorrect count of selected records in customer address grid
1 parent 57c527e commit 1324176

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/code/Magento/Customer/view/adminhtml/web/js/form/components/insert-listing.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ define([
7272
},
7373

7474
/**
75-
* Delete customer address by ids
75+
* Delete customer address and selections by provided ids.
7676
*
7777
* @param {Array} ids
7878
*/
@@ -87,6 +87,10 @@ define([
8787
if (ids.indexOf(defaultBillingId) !== -1) {
8888
this.source.set('data.default_billing_address', []);
8989
}
90+
91+
_.each(ids, function (id) {
92+
this.selections().deselect(id.toString(), false);
93+
}, this);
9094
}
9195
});
9296
});

dev/tests/js/jasmine/tests/app/code/Magento/Customer/adminhtml/js/view/form/components/insert-listing.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
1818
}
1919
},
2020
selectionsProvider = {
21-
selected: jasmine.createSpy().and.returnValue(ids)
21+
selected: jasmine.createSpy().and.returnValue(ids),
22+
deselect: jasmine.createSpy()
2223
};
2324

2425
beforeEach(function () {
@@ -54,7 +55,7 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
5455
expect(obj._delete).toHaveBeenCalledWith([1, 2]);
5556
});
5657

57-
it('Check removal of default addresses', function () {
58+
it('Check removal of default addresses and selections by provided ids', function () {
5859
obj.source = {
5960
get: jasmine.createSpy().and.returnValues(2, 3),
6061
set: jasmine.createSpy()
@@ -64,6 +65,7 @@ define(['Magento_Customer/js/form/components/insert-listing'], function (Constr)
6465
expect(selectionsProvider.selected).not.toHaveBeenCalled();
6566
expect(obj.source.get.calls.count()).toEqual(2);
6667
expect(obj.source.set.calls.count()).toEqual(1);
68+
expect(selectionsProvider.deselect.calls.count()).toEqual(2);
6769
});
6870
});
6971
});

0 commit comments

Comments
 (0)