CollectionEditor: When there is only one item, moving item does not work

Found in

EPiServer.CMS.UI 9.2.0

Fixed in

EPiServer.CMS.UI 9.6.0


Oct 13, 2015


May 13, 2016




Closed, Fixed and tested


This is hard to reproduce without Commerce installed, since only Commerce is using CollectionEditor at this point.

1. Log in to a commerce site > go to New Catalog Commerce UI.
2. Select any product under Departmental Catalog>Departments>Fashion>Tops>Tops-Tunic ( eg: Tops-Tunics-CowlNeck)
3. Open the item in Categories view.
4. On the Categories related list, there should only be one Tops-Tunic category.
5. Drag it and drop it to the drop area (the area with downward arrow).

Expected: The category (Tops-Tunic) still shows on the grid.
Actual: The categories grid list is empty.

Note: If list has at least 2 categories, the issue does not occur.

To reproduce the error, add the following unit test to CollectionEditorModel_specs.js

         describe("#moveItem", function () { //this already exist in the file
            // ...
            describe("when #before is true", function () { //also this
                describe('and there is only one item', function () { //this is the new test
                    beforeEach(function (done) {
               = [{ id: 1 }];
                        model.initialize().then(function () {
                    it('should not change the list', function () {
                        item = model.get("items")[0];
                        model.moveItem(item, null, true);
                        var pos = model.get("items").indexOf(item);