* Renders field. * @protected * @return {?HTMLElement}
()
| 39 | * @return {?HTMLElement} |
| 40 | */ |
| 41 | renderField () { |
| 42 | this._$input = View.createElement('input', { |
| 43 | className: 'field-boolean__input', |
| 44 | type: 'checkbox', |
| 45 | id: this.getId(), |
| 46 | onChange: this.inputValueDidChange.bind(this), |
| 47 | checked: this.getModel().getValue(), |
| 48 | onFocus: evt => this.focus(), |
| 49 | onBlur: evt => this.blur() |
| 50 | }) |
| 51 | |
| 52 | const $toggle = View.createElement('label', { |
| 53 | className: 'field-boolean__toggle', |
| 54 | htmlFor: this.getId() |
| 55 | }, [ |
| 56 | View.createElement('span', { |
| 57 | className: 'field-boolean__choice' |
| 58 | }, this.getModel().getTrueLabel()), |
| 59 | View.createElement('span', { |
| 60 | className: 'field-boolean__choice' |
| 61 | }, this.getModel().getFalseLabel()) |
| 62 | ]) |
| 63 | |
| 64 | const $field = super.renderField() |
| 65 | $field.appendChild(this._$input) |
| 66 | $field.appendChild($toggle) |
| 67 | return $field |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Triggered when input value has been changed. |
nothing calls this directly
no test coverage detected