update unittests:

add test for disabled choices getter
This commit is contained in:
alex 2020-04-16 03:28:15 +02:00
parent 2b89d38a68
commit 21a6e22711
2 changed files with 14 additions and 1 deletions

View file

@ -2176,6 +2176,7 @@ describe('choices', () => {
describe('_onKeyDown', () => {
let activeItems;
let disabledChoices;
let hasItems;
let hasActiveDropdown;
let hasFocussedInput;
@ -2188,7 +2189,7 @@ describe('choices', () => {
instance._onDirectionKey = stub();
instance._onDeleteKey = stub();
({ activeItems } = instance._store);
({ activeItems, disabledChoices } = instance._store);
hasItems = instance.itemList.hasChildren();
hasActiveDropdown = instance.dropdown.isActive;
hasFocussedInput = instance.input.isFocussed;
@ -2212,6 +2213,8 @@ describe('choices', () => {
expect(instance._onDirectionKey).to.have.been.calledWith(
event,
activeItems,
disabledChoices,
hasActiveDropdown,
);
});
@ -2244,6 +2247,7 @@ describe('choices', () => {
expect(instance._onEnterKey).to.have.been.calledWith(
event,
activeItems,
disabledChoices,
hasActiveDropdown,
);
});

View file

@ -191,6 +191,15 @@ describe('reducers/store', () => {
});
});
describe('disabledChoices getter', () => {
it('returns choices that are disabled', () => {
const expectedResponse = state.choices.filter(
choice => choice.disabled,
);
expect(instance.disabledChoices).to.eql(expectedResponse);
});
});
describe('selectableChoices getter', () => {
it('returns choices that are not disabled', () => {
const expectedResponse = state.choices.filter(