fix script revert activating recommendation level

Reverting any single of the scripts from standard recommendation pool
shows "Standard" selection as selected which is wrong. This commit fixes
it, refactors selection handling in a separate class and it also adds
missing tests. It removes UserSelection.totalSelected propertty in favor of using
UserSelection.selectedScripts.length to provide unified way of accessing
the information.
This commit is contained in:
undergroundwires
2021-04-17 14:34:29 +01:00
parent aea04e5f7c
commit a2f10857e2
13 changed files with 384 additions and 109 deletions

View File

@@ -55,7 +55,7 @@ describe('CategoryCollectionState', () => {
const collection = new CategoryCollectionStub();
const sut = new CategoryCollectionState(collection);
// act
const actual = sut.selection.totalSelected;
const actual = sut.selection.selectedScripts.length;
// assert
expect(actual).to.equal(0);
});
@@ -68,7 +68,7 @@ describe('CategoryCollectionState', () => {
// act
sut.selection.selectAll();
// assert
expect(sut.selection.totalSelected).to.equal(1);
expect(sut.selection.selectedScripts.length).to.equal(1);
expect(sut.selection.isSelected(expectedScript.id)).to.equal(true);
});
});