mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-18 05:26:35 +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', () => {
|
describe('_onKeyDown', () => {
|
||||||
let activeItems;
|
let activeItems;
|
||||||
|
let disabledChoices;
|
||||||
let hasItems;
|
let hasItems;
|
||||||
let hasActiveDropdown;
|
let hasActiveDropdown;
|
||||||
let hasFocussedInput;
|
let hasFocussedInput;
|
||||||
|
@ -2188,7 +2189,7 @@ describe('choices', () => {
|
||||||
instance._onDirectionKey = stub();
|
instance._onDirectionKey = stub();
|
||||||
instance._onDeleteKey = stub();
|
instance._onDeleteKey = stub();
|
||||||
|
|
||||||
({ activeItems } = instance._store);
|
({ activeItems, disabledChoices } = instance._store);
|
||||||
hasItems = instance.itemList.hasChildren();
|
hasItems = instance.itemList.hasChildren();
|
||||||
hasActiveDropdown = instance.dropdown.isActive;
|
hasActiveDropdown = instance.dropdown.isActive;
|
||||||
hasFocussedInput = instance.input.isFocussed;
|
hasFocussedInput = instance.input.isFocussed;
|
||||||
|
@ -2212,6 +2213,8 @@ describe('choices', () => {
|
||||||
|
|
||||||
expect(instance._onDirectionKey).to.have.been.calledWith(
|
expect(instance._onDirectionKey).to.have.been.calledWith(
|
||||||
event,
|
event,
|
||||||
|
activeItems,
|
||||||
|
disabledChoices,
|
||||||
hasActiveDropdown,
|
hasActiveDropdown,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -2244,6 +2247,7 @@ describe('choices', () => {
|
||||||
expect(instance._onEnterKey).to.have.been.calledWith(
|
expect(instance._onEnterKey).to.have.been.calledWith(
|
||||||
event,
|
event,
|
||||||
activeItems,
|
activeItems,
|
||||||
|
disabledChoices,
|
||||||
hasActiveDropdown,
|
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', () => {
|
describe('selectableChoices getter', () => {
|
||||||
it('returns choices that are not disabled', () => {
|
it('returns choices that are not disabled', () => {
|
||||||
const expectedResponse = state.choices.filter(
|
const expectedResponse = state.choices.filter(
|
||||||
|
|
Loading…
Reference in a new issue