summaryrefslogtreecommitdiffstats
path: root/test/static/replaceSpec.js
Commit message (Collapse)AuthorAgeFilesLines
* Separate label/value for each suggestion on the list.Vladislav Zarakovsky2016-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is now possible to show a suggestion label in completer, but insert a suggestion value into the input instead. In addition to String as before, each list item now can also be: - a `{ label, value }` Object - a `[ label, value ]` Array To show full country name in completer, but insert country code into the input you can use these items: - `{ label: "United States", value: "US" }` - `[ "United States", "US" ]` Despite this data format change, old code will continue to work as before. This is taken care by `Suggestion()`. It uses `label` property automatically when string is expected anywhere in the API. One known issue is that accessing suggestion's characters by index won't work with old API. It's easy to fix though. Instead of `item[idx]` use `item.value[idx]` or `item.label[idx]` directly. In addition to default support for String/Object/Array items, we also add `data` method, which can be used to support any additional custom item formats and to generate data dynamically, as in changed Email example. The only thing you need to do in this case is to return item in any of String/Array/Object formats supported by default.
* Tests for Awesomplete.ITEM and Awesomplete.REPLACEVladislav Zarakovsky2016-01-301-0/+11