mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-03 14:23:12 +02:00
update unittests:
add test for disabled choices getter
This commit is contained in:
parent
2b89d38a68
commit
21a6e22711
|
@ -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,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue