Make sure the addablePresetIDs can be reset back to null too

This commit is contained in:
Bryan Housel
2020-02-07 12:55:16 -05:00
parent 1155498766
commit 2149692bee
2 changed files with 6 additions and 0 deletions

View File

@@ -328,6 +328,8 @@ export function presetIndex(context) {
_addablePresetIDs = val;
if (_addablePresetIDs) { // reset all presets
_this.collection.forEach(p => p.addable(_addablePresetIDs.has(p.id)));
} else {
_this.collection.forEach(p => p.addable(true));
}
return _this;

View File

@@ -192,6 +192,10 @@ describe('iD.presetIndex', function () {
expect(presets.item('point').addable()).to.be.true;
expect(presets.item('line').addable()).to.be.false;
expect(presets.addablePresetIDs()).to.eql(ids);
presets.addablePresetIDs(null);
expect(presets.item('point').addable()).to.be.true;
expect(presets.item('line').addable()).to.be.true;
});
});