choices.js
Advanced tools
Comparing version 2.8.0 to 2.8.3
{ | ||
"name": "choices.js", | ||
"version": "2.8.0", | ||
"version": "2.8.3", | ||
"description": "A vanilla JS customisable text input/select box plugin", | ||
@@ -5,0 +5,0 @@ "main": [ |
{ | ||
"name": "choices.js", | ||
"version": "2.8.0", | ||
"version": "2.8.3", | ||
"description": "A vanilla JS customisable text input/select box plugin", | ||
@@ -5,0 +5,0 @@ "main": "./assets/scripts/dist/choices.min.js", |
@@ -59,2 +59,3 @@ # Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) | ||
const choices = new Choices(elements, { | ||
silent: false, | ||
items: [], | ||
@@ -70,3 +71,3 @@ choices: [], | ||
paste: true, | ||
search: true, | ||
searchEnabled: true, | ||
searchChoices: true, | ||
@@ -138,2 +139,10 @@ searchFloor: 1, | ||
## Configuration options | ||
### silent | ||
**Type:** `Boolean` **Default:** `false` | ||
**Input types affected:** `text`, `select-single`, `select-multiple` | ||
**Usage:** Optionally suppress console errors and warnings. | ||
### items | ||
@@ -154,10 +163,10 @@ **Type:** `Array` **Default:** `[]` | ||
[{ | ||
value: 'Value 1', | ||
label: 'Label 1', | ||
id: 1 | ||
value: 'Value 1', | ||
label: 'Label 1', | ||
id: 1 | ||
}, | ||
{ | ||
value: 'Value 2', | ||
label: 'Label 2', | ||
id: 2 | ||
value: 'Value 2', | ||
label: 'Label 2', | ||
id: 2 | ||
}] | ||
@@ -177,12 +186,12 @@ ``` | ||
[{ | ||
value: 'Option 1', | ||
label: 'Option 1', | ||
selected: true, | ||
disabled: false, | ||
value: 'Option 1', | ||
label: 'Option 1', | ||
selected: true, | ||
disabled: false, | ||
}, | ||
{ | ||
value: 'Option 2', | ||
label: 'Option 2', | ||
selected: false, | ||
disabled: true, | ||
value: 'Option 2', | ||
label: 'Option 2', | ||
selected: false, | ||
disabled: true, | ||
}] | ||
@@ -199,7 +208,7 @@ ``` | ||
### addItems | ||
**Type:** `Boolean` **Default:** `true` (for text inputs) `false` (for select elements) | ||
**Type:** `Boolean` **Default:** `true` | ||
**Input types affected:** `text`, `select-one`, `select-multiple` | ||
**Input types affected:** `text` | ||
**Usage:** Whether a user can add items. | ||
**Usage:** Whether a user can add items. | ||
@@ -248,3 +257,3 @@ ### removeItems | ||
### search | ||
### searchEnabled | ||
**Type:** `Boolean` **Default:** `true` | ||
@@ -254,3 +263,3 @@ | ||
**Usage:** Whether a user should be allowed to search avaiable choices. Note that multiple select boxes will always show search inputs. | ||
**Usage:** Whether a search area should be shown. **Note:** Multiple select boxes will *always* show search areas. | ||
@@ -262,3 +271,3 @@ ### searchChoices | ||
**Usage:** Whether the plugin should filter the choices by input or not. If `false`, the search event will still emit. | ||
**Usage:** Whether choices should be filtered by input or not. If `false`, the search event will still emit, but choices will not be filtered. | ||
@@ -265,0 +274,0 @@ |
@@ -67,2 +67,3 @@ import 'whatwg-fetch'; | ||
it('should have config options', function() { | ||
expect(this.choices.config.silent).toEqual(jasmine.any(Boolean)); | ||
expect(this.choices.config.items).toEqual(jasmine.any(Array)); | ||
@@ -78,3 +79,4 @@ expect(this.choices.config.choices).toEqual(jasmine.any(Array)); | ||
expect(this.choices.config.paste).toEqual(jasmine.any(Boolean)); | ||
expect(this.choices.config.search).toEqual(jasmine.any(Boolean)); | ||
expect(this.choices.config.searchEnabled).toEqual(jasmine.any(Boolean)); | ||
expect(this.choices.config.searchChoices).toEqual(jasmine.any(Boolean)); | ||
expect(this.choices.config.searchFloor).toEqual(jasmine.any(Number)); | ||
@@ -289,3 +291,3 @@ expect(this.choices.config.searchFields).toEqual(jasmine.any(Array) || jasmine.any(String)); | ||
for (var i = 0; i < 3; i++) { | ||
for (var i = 0; i < 2; i++) { | ||
// Key down to third choice | ||
@@ -323,3 +325,3 @@ this.choices._onKeyDown({ | ||
expect(this.choices.currentState.items.length).toBe(1); | ||
expect(this.choices.currentState.items.length).toBe(2); | ||
}); | ||
@@ -340,12 +342,8 @@ | ||
// Key down to second choice | ||
let count = 0; | ||
while (count < 2) { | ||
this.choices._onKeyDown({ | ||
target: this.choices.input, | ||
keyCode: 40, | ||
ctrlKey: false, | ||
preventDefault: () => {} | ||
}); | ||
count++; | ||
} | ||
this.choices._onKeyDown({ | ||
target: this.choices.input, | ||
keyCode: 40, | ||
ctrlKey: false, | ||
preventDefault: () => {} | ||
}); | ||
@@ -352,0 +350,0 @@ // Key down to select choice |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9578
825
713215