Choices/src/scripts/components/wrapped-input.js
Josh Johnson 879c97f64c
Resolve undefined error (#528)
* Remove run-p from test command

* Remove dropdown interaction tests

* Tidy utils

* Use merge lib

* Remove string casting

* Sanitise in constants

* Housekeeping

* Add non-string value tests
2019-02-22 22:04:55 +00:00

22 lines
575 B
JavaScript

import WrappedElement from './wrapped-element';
export default class WrappedInput extends WrappedElement {
constructor({ element, classNames, delimiter }) {
super({ element, classNames });
this.delimiter = delimiter;
}
set value(items) {
const itemValues = items.map(({ value }) => value);
const joinedValues = itemValues.join(this.delimiter);
this.element.setAttribute('value', joinedValues);
this.element.value = joinedValues;
}
// @todo figure out why we need this? Perhaps a babel issue
get value() {
return super.value;
}
}