mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-19 14:15:08 +02:00
A few tests
This commit is contained in:
parent
94e3c97b4e
commit
1013f32ce6
|
@ -2737,6 +2737,7 @@ class Choices {
|
|||
const dropdown = this._getTemplate('dropdown');
|
||||
const placeholder = this.config.placeholder ?
|
||||
this.config.placeholderValue ||
|
||||
this.config.searchPlaceholderValue ||
|
||||
this.passedElement.getAttribute('placeholder') :
|
||||
false;
|
||||
|
||||
|
@ -2782,7 +2783,7 @@ class Choices {
|
|||
// If select one element with a search placeholder value
|
||||
if (this.config.searchPlaceholderValue) {
|
||||
input.placeholder = this.config.searchPlaceholderValue;
|
||||
} else {
|
||||
} else if (this.placeholder) {
|
||||
const placeholderItem = this._getTemplate('placeholder', this.placeholder);
|
||||
this.itemList.appendChild(placeholderItem);
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ describe('Choices', () => {
|
|||
ctrlKey: false
|
||||
});
|
||||
|
||||
const activeOptions = this.choices.currentState.choices.filter(function (choice) {
|
||||
const activeOptions = this.choices.currentState.choices.filter(function(choice) {
|
||||
return choice.active;
|
||||
});
|
||||
|
||||
|
@ -566,6 +566,15 @@ describe('Choices', () => {
|
|||
|
||||
expect(this.choices.currentState.choices[0].value).toEqual('Value 1');
|
||||
});
|
||||
|
||||
it('should set searchPlaceholderValue if set', function() {
|
||||
const dummyPlaceholder = 'Test placeholder';
|
||||
this.choices = new Choices(this.input, {
|
||||
searchPlaceholderValue: dummyPlaceholder
|
||||
});
|
||||
|
||||
expect(this.choices.input.placeholder).toEqual(dummyPlaceholder);
|
||||
});
|
||||
});
|
||||
|
||||
describe('should accept multiple select inputs', function() {
|
||||
|
|
Loading…
Reference in a new issue