diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-10-19 13:51:01 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-10-19 13:51:01 +0200 |
commit | 6caae545b7961f9ba5f136d38730ecf026ab7fbb (patch) | |
tree | 46e987bbf1cc0c30075c32e50140f4f90834c22c /src | |
parent | d17f27058f41f2dddd9fd5e88149ed55f9f7bf0c (diff) | |
download | kvision-6caae545b7961f9ba5f136d38730ecf026ab7fbb.tar.gz kvision-6caae545b7961f9ba5f136d38730ecf026ab7fbb.tar.bz2 kvision-6caae545b7961f9ba5f136d38730ecf026ab7fbb.zip |
Refactoring - CheckBoxInput -> CheckInput
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/CheckBox.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/CheckInput.kt (renamed from src/main/kotlin/pl/treksoft/kvision/form/CheckBoxInput.kt) | 8 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/Radio.kt | 2 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/form/CheckInputSpec.kt (renamed from src/test/kotlin/test/pl/treksoft/kvision/form/CheckBoxInputSpec.kt) | 10 |
4 files changed, 10 insertions, 12 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/CheckBox.kt b/src/main/kotlin/pl/treksoft/kvision/form/CheckBox.kt index 13551f67..87963922 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/CheckBox.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/CheckBox.kt @@ -70,7 +70,7 @@ open class CheckBox(value: Boolean = false, name: String? = null, style: CHECKBO } private val idc = "kv_form_checkbox_" + counter - val input: CheckBoxInput = CheckBoxInput(CHECKINPUTTYPE.CHECKBOX, value, name, disabled, idc, null, setOf("styled")) + val input: CheckInput = CheckInput(CHECKINPUTTYPE.CHECKBOX, value, name, disabled, idc, null, setOf("styled")) val flabel: FieldLabel = FieldLabel(idc, label, rich) init { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/CheckBoxInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/CheckInput.kt index 5fa220e9..131793b8 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/CheckBoxInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/CheckInput.kt @@ -10,10 +10,10 @@ enum class CHECKINPUTTYPE(val type: String) { RADIO("radio") } -open class CheckBoxInput(type: CHECKINPUTTYPE = CHECKINPUTTYPE.CHECKBOX, override var value: Boolean = false, - name: String? = null, disabled: Boolean = false, id: String? = null, - extraValue: String? = null, - classes: Set<String> = setOf()) : Widget(classes), BoolFormField { +open class CheckInput(type: CHECKINPUTTYPE = CHECKINPUTTYPE.CHECKBOX, override var value: Boolean = false, + name: String? = null, disabled: Boolean = false, id: String? = null, + extraValue: String? = null, + classes: Set<String> = setOf()) : Widget(classes), BoolFormField { init { this.id = id diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/Radio.kt index f3f72a3d..f8db5162 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/Radio.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/Radio.kt @@ -75,7 +75,7 @@ open class Radio(value: Boolean = false, extraValue: String? = null, name: Strin } private val idc = "kv_form_radio_" + counter - val input: CheckBoxInput = CheckBoxInput(CHECKINPUTTYPE.RADIO, value, name, disabled, idc, extraValue) + val input: CheckInput = CheckInput(CHECKINPUTTYPE.RADIO, value, name, disabled, idc, extraValue) val flabel: FieldLabel = FieldLabel(idc, label, rich) init { diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/CheckBoxInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/CheckInputSpec.kt index efc6d78e..8991b710 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/CheckBoxInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/CheckInputSpec.kt @@ -2,21 +2,19 @@ package test.pl.treksoft.kvision.form import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.form.CHECKINPUTTYPE -import pl.treksoft.kvision.form.CheckBoxInput -import pl.treksoft.kvision.form.TEXTINPUTTYPE -import pl.treksoft.kvision.form.TextInput +import pl.treksoft.kvision.form.CheckInput import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test import kotlin.test.assertEquals -class CheckBoxInputSpec : DomSpec { +class CheckInputSpec : DomSpec { @Test fun render() { run { val root = Root("test") - val ci = CheckBoxInput(value = true, name = "name", id = "idti", disabled = true) + val ci = CheckInput(value = true, name = "name", id = "idti", disabled = true) root.add(ci) val element = document.getElementById("test") assertEquals("<input id=\"idti\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\">", element?.innerHTML, "Should render correct checkbox field") @@ -27,7 +25,7 @@ class CheckBoxInputSpec : DomSpec { fun renderAsRadio() { run { val root = Root("test") - val ci = CheckBoxInput(type = CHECKINPUTTYPE.RADIO, value = true, name = "name", id = "idti", extraValue = "abc") + val ci = CheckInput(type = CHECKINPUTTYPE.RADIO, value = true, name = "name", id = "idti", extraValue = "abc") root.add(ci) val element = document.getElementById("test") assertEquals("<input id=\"idti\" type=\"radio\" checked=\"\" name=\"name\" value=\"abc\">", element?.innerHTML, "Should render correct radio button field") |