mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-20 14:36:34 +02:00
Merge pull request #197 from JayKid/fix/extra-parameter-in-add-item
Fix extra parameter in call to _addItem
This commit is contained in:
commit
2fefb904a3
|
@ -768,7 +768,7 @@ example.setValueByChoice('Two'); // Choice with value of 'Two' has now been sele
|
||||||
### disable();
|
### disable();
|
||||||
**Input types affected:** `text`, `select-one`, `select-multiple`
|
**Input types affected:** `text`, `select-one`, `select-multiple`
|
||||||
|
|
||||||
**Usage:** Disables input from accepting new value/sselecting further choices.
|
**Usage:** Disables input from accepting new value/selecting further choices.
|
||||||
|
|
||||||
### enable();
|
### enable();
|
||||||
**Input types affected:** `text`, `select-one`, `select-multiple`
|
**Input types affected:** `text`, `select-one`, `select-multiple`
|
||||||
|
|
|
@ -2205,7 +2205,6 @@ class Choices {
|
||||||
choiceLabel,
|
choiceLabel,
|
||||||
choiceId,
|
choiceId,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
|
||||||
customProperties
|
customProperties
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2254,7 +2253,8 @@ class Choices {
|
||||||
label,
|
label,
|
||||||
option.selected,
|
option.selected,
|
||||||
isOptDisabled,
|
isOptDisabled,
|
||||||
groupId
|
groupId,
|
||||||
|
option.customProperties
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1038,5 +1038,23 @@ describe('Choices', () => {
|
||||||
expect(selectedItems.length).toBe(1);
|
expect(selectedItems.length).toBe(1);
|
||||||
expect(selectedItems[0].customProperties).toBe(expectedCustomProperties);
|
expect(selectedItems[0].customProperties).toBe(expectedCustomProperties);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow the user to supply custom properties when directly creating a selected item', function() {
|
||||||
|
const expectedCustomProperties = {
|
||||||
|
isBestOptionEver: true
|
||||||
|
};
|
||||||
|
|
||||||
|
this.choices = new Choices(this.input);
|
||||||
|
|
||||||
|
this.choices.setValue([{
|
||||||
|
value: 'bar',
|
||||||
|
label: 'foo',
|
||||||
|
customProperties: expectedCustomProperties
|
||||||
|
}]);
|
||||||
|
const selectedItems = this.choices.getValue();
|
||||||
|
|
||||||
|
expect(selectedItems.length).toBe(1);
|
||||||
|
expect(selectedItems[0].customProperties).toBe(expectedCustomProperties);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue