Skip to content

Commit 0670c3c

Browse files
committed
add tests
1 parent c6138ce commit 0670c3c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/packages/core/utils/selection-manager/selection.manager.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ describe('UmbSelectionManager', () => {
7676
it('has a clearSelection method', () => {
7777
expect(manager).to.have.property('clearSelection').that.is.a('function');
7878
});
79+
80+
it('has a setFilter method', () => {
81+
expect(manager).to.have.property('setFilter').that.is.a('function');
82+
});
7983
});
8084
});
8185

@@ -150,6 +154,15 @@ describe('UmbSelectionManager', () => {
150154
manager.select('3');
151155
expect(manager.getSelection()).to.deep.equal([]);
152156
});
157+
158+
it('can not select an item if it does not pass the filter', () => {
159+
manager.setFilter((item) => item !== '2');
160+
manager.select('2');
161+
expect(manager.getSelection()).to.deep.equal([]);
162+
163+
manager.select('1');
164+
expect(manager.getSelection()).to.deep.equal(['1']);
165+
});
153166
});
154167

155168
describe('Deselect', () => {

0 commit comments

Comments
 (0)