add tests

This commit is contained in:
Mads Rasmussen
2024-09-16 12:21:20 +02:00
parent 54bcc11b26
commit 9149074274

View File

@@ -76,6 +76,10 @@ describe('UmbSelectionManager', () => {
it('has a clearSelection method', () => {
expect(manager).to.have.property('clearSelection').that.is.a('function');
});
it('has a setFilter method', () => {
expect(manager).to.have.property('setFilter').that.is.a('function');
});
});
});
@@ -150,6 +154,15 @@ describe('UmbSelectionManager', () => {
manager.select('3');
expect(manager.getSelection()).to.deep.equal([]);
});
it('can not select an item if it does not pass the filter', () => {
manager.setFilter((item) => item !== '2');
manager.select('2');
expect(manager.getSelection()).to.deep.equal([]);
manager.select('1');
expect(manager.getSelection()).to.deep.equal(['1']);
});
});
describe('Deselect', () => {