aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/FormPanelSpec.kt6
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/FormSpec.kt10
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt53
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt54
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt59
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt58
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt75
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt82
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt51
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt58
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt53
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt62
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt57
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt56
14 files changed, 6 insertions, 728 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/FormPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/FormPanelSpec.kt
index 5c07ca58..39c9e8b1 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/FormPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FormPanelSpec.kt
@@ -23,8 +23,6 @@ package test.pl.treksoft.kvision.form
import pl.treksoft.kvision.form.FormPanel
import pl.treksoft.kvision.form.text.Text
-import pl.treksoft.kvision.form.time.DateTime
-import pl.treksoft.kvision.types.KDate
import test.pl.treksoft.kvision.SimpleSpec
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -125,14 +123,14 @@ class FormPanelSpec : SimpleSpec {
formPanel.add(DataForm2::s, Text()) {
it.getValue()?.length ?: 0 > 4
}
- formPanel.add(DataForm2::d, DateTime(), required = true)
+ formPanel.add(DataForm2::d, Text(), required = true)
formPanel.setData(DataForm2(s = "123"))
val valid = formPanel.validate()
assertEquals(false, valid, "Should be invalid with initial data")
formPanel.setData(DataForm2(s = "12345"))
val valid2 = formPanel.validate()
assertEquals(false, valid2, "Should be invalid with partially changed data")
- formPanel.setData(DataForm2(s = "12345", d = KDate()))
+ formPanel.setData(DataForm2(s = "12345", d = "abc"))
val valid3 = formPanel.validate()
assertEquals(true, valid3, "Should be valid")
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/FormSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/FormSpec.kt
index f673018a..de875c67 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/FormSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FormSpec.kt
@@ -24,8 +24,6 @@ package test.pl.treksoft.kvision.form
import kotlinx.serialization.Serializable
import pl.treksoft.kvision.form.Form
import pl.treksoft.kvision.form.text.Text
-import pl.treksoft.kvision.form.time.DateTime
-import pl.treksoft.kvision.types.KDate
import test.pl.treksoft.kvision.SimpleSpec
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -36,13 +34,13 @@ import kotlin.test.assertNull
data class DataForm(
val a: String? = null,
val b: Boolean? = null,
- val c: KDate? = null
+ val c: String? = null
)
@Serializable
data class DataForm2(
val s: String? = null,
- val d: KDate? = null
+ val d: String? = null
)
@@ -140,14 +138,14 @@ class FormSpec : SimpleSpec {
form.add(DataForm2::s, Text()) {
it.getValue()?.length ?: 0 > 4
}
- form.add(DataForm2::d, DateTime(), required = true)
+ form.add(DataForm2::d, Text(), required = true)
form.setData(DataForm2(s = "123"))
val valid = form.validate()
assertEquals(false, valid, "Should be invalid with initial data")
form.setData(DataForm2(s = "12345"))
val valid2 = form.validate()
assertEquals(false, valid2, "Should be invalid with partially changed data")
- form.setData(DataForm2(s = "12345", d = KDate()))
+ form.setData(DataForm2(s = "12345", d = "abc"))
val valid3 = form.validate()
assertEquals(true, valid3, "Should be valid")
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt
deleted file mode 100644
index 30f42e9c..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.select
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.form.select.SelectWidthType
-import pl.treksoft.kvision.form.select.SelectInput
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-import kotlin.test.assertTrue
-
-class SelectInputSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val selectInput = SelectInput(listOf("test1" to "Test 1", "test2" to "Test 2"), "test1", true).apply {
- liveSearch = true
- placeholder = "Choose ..."
- selectWidthType = SelectWidthType.FIT
- emptyOption = true
- }
- root.add(selectInput)
- val element = document.getElementById("test")
- assertTrue(
- true == element?.innerHTML?.endsWith("<select class=\"selectpicker\" multiple=\"multiple\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div>"),
- "Should render correct select input"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt
deleted file mode 100644
index bd88f560..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.select
-
-import pl.treksoft.kvision.form.select.SelectOptGroup
-import pl.treksoft.kvision.form.select.SelectOption
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class SelectOptGroupSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val selectOptGroup = SelectOptGroup("Group", listOf("test1" to "Test 1", "test2" to "Test 2"), 2)
- root.add(selectOptGroup)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></optgroup>",
- element?.innerHTML,
- "Should render correct select option group"
- )
- selectOptGroup.add(SelectOption("test3", "Test 3"))
- assertEqualsHtml(
- "<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option><option value=\"test3\">Test 3</option></optgroup>",
- element?.innerHTML,
- "Should render correct select option group with added option"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt
deleted file mode 100644
index f7e07d42..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.select
-
-import pl.treksoft.kvision.form.select.SelectOption
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class SelectOptionSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val selectOption = SelectOption("testValue", "testLabel")
- root.add(selectOption)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<option value=\"testValue\">testLabel</option>",
- element?.innerHTML,
- "Should render correct select option"
- )
- selectOption.icon = "fa-flag"
- assertEqualsHtml(
- "<option value=\"testValue\" data-icon=\"fa fa-flag\">testLabel</option>",
- element?.innerHTML,
- "Should render correct select option with icon"
- )
- selectOption.divider = true
- assertEqualsHtml(
- "<option data-divider=\"true\"></option>",
- element?.innerHTML,
- "Should render correct divider option"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt
deleted file mode 100644
index eaccd551..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.select
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.form.select.SelectWidthType
-import pl.treksoft.kvision.form.select.Select
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-import kotlin.test.assertTrue
-
-class SelectSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val select = Select(listOf("test1" to "Test 1", "test2" to "Test 2"), "test1", null, true, null, "Label").apply {
- liveSearch = true
- placeholder = "Choose ..."
- selectWidthType = SelectWidthType.FIT
- emptyOption = true
- }
- root.add(select)
- val element = document.getElementById("test")
- val id = select.input.id
- assertTrue(
- true == element?.innerHTML?.startsWith("<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label>"),
- "Should render correct select form control"
- )
- assertTrue(
- true == element?.innerHTML?.endsWith("<select class=\"form-control selectpicker\" id=\"$id\" multiple=\"multiple\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div></div>"),
- "Should render correct select form control"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt
deleted file mode 100644
index a240bfd8..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.spinner
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.form.spinner.SpinnerInput
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class SpinnerInputSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val si = SpinnerInput(value = 13).apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(si)
- val value = si.getElementJQuery()?.`val`()
- assertEquals("13", value, "Should render spinner input with correct value")
- }
- }
-
- @Test
- fun spinUp() {
- run {
- val root = Root("test", true)
- val si = SpinnerInput(value = 13).apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(si)
- assertEquals(13, si.value, "Should return initial value before spinUp")
- si.spinUp()
- assertEquals(14, si.value, "Should return changed value after spinUp")
- }
- }
-
- @Test
- fun spinDown() {
- run {
- val root = Root("test", true)
- val si = SpinnerInput(value = 13).apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(si)
- assertEquals(13, si.value, "Should return initial value before spinDown")
- si.spinDown()
- assertEquals(12, si.value, "Should return changed value after spinDown")
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt
deleted file mode 100644
index e2eec3f9..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.spinner
-
-import pl.treksoft.kvision.form.spinner.Spinner
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class SpinnerSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val ti = Spinner(value = 13, label = "Label").apply {
- placeholder = "place"
- name = "name"
- disabled = true
- }
- root.add(ti)
- val element = document.getElementById("test")
- val id = ti.input.id
- assertEqualsHtml(
- "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div></div>",
- element?.innerHTML,
- "Should render correct spinner input form control"
- )
- ti.validatorError = "Validation Error"
- assertEqualsHtml(
- "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div><span class=\"help-block small\">Validation Error</span></div>",
- element?.innerHTML,
- "Should render correct spinner input form control with validation error"
- )
- }
- }
-
- @Test
- fun spinUp() {
- run {
- val root = Root("test", true)
- val si = Spinner(value = 13)
- root.add(si)
- assertEquals(13, si.value, "Should return initial value before spinUp")
- si.spinUp()
- assertEquals(14, si.value, "Should return changed value after spinUp")
- }
- }
-
- @Test
- fun spinDown() {
- run {
- val root = Root("test", true)
- val si = Spinner(value = 13)
- root.add(si)
- assertEquals(13, si.value, "Should return initial value before spinDown")
- si.spinDown()
- assertEquals(12, si.value, "Should return changed value after spinDown")
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt
deleted file mode 100644
index 21b7dc39..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.text
-
-import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.form.text.RichTextInput
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-import kotlin.test.assertTrue
-
-class RichTextInputSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val hai = RichTextInput(value = "abc").apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(hai)
- val content = document.getElementById("test")?.let { jQuery(it).find("trix-editor")[0]?.outerHTML }
- assertTrue(
- content?.startsWith("<trix-editor") == true,
- "Should render correct html area control"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt
deleted file mode 100644
index 844b7e94..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.text
-
-import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.form.text.RichText
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-import kotlin.test.assertTrue
-
-class RichTextSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val hai = RichText(value = "abc", label = "Field").apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(hai)
- val iid = hai.input.id
- val content = document.getElementById("test")?.let { jQuery(it).find("trix-editor")[0]?.outerHTML }
- assertTrue(
- content?.startsWith("<trix-editor") == true,
- "Should render correct html area form control"
- )
- val label = document.getElementById("test")?.let { jQuery(it).find("label")[0]?.outerHTML }
- assertEqualsHtml(
- "<label class=\"control-label\" for=\"$iid\">Field</label>",
- label,
- "Should render correct label for html area form control"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
deleted file mode 100644
index d824125b..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.time
-
-import pl.treksoft.kvision.form.time.DateTimeInput
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.types.KDate
-import pl.treksoft.kvision.types.toStringF
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class DateTimeInputSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val data = KDate()
- val dti = DateTimeInput(value = data).apply {
- placeholder = "place"
- id = "idti"
- }
- root.add(dti)
- val value = dti.getElementJQuery()?.`val`()
- assertEquals(
- data.toStringF(dti.format),
- value,
- "Should render date time input with correctly formatted value"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
deleted file mode 100644
index 482a7b7a..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.time
-
-import pl.treksoft.kvision.form.time.DateTime
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.types.KDate
-import pl.treksoft.kvision.types.toStringF
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class DateTimeSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val data = KDate()
- val ti = DateTime(value = data, label = "Label").apply {
- placeholder = "place"
- name = "name"
- disabled = true
- }
- root.add(ti)
- val element = document.getElementById("test")
- val id = ti.input.id
- val datastr = data.toStringF(ti.format)
- assertEqualsHtml(
- "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" value=\"$datastr\"></div>",
- element?.innerHTML,
- "Should render correct date time input form control"
- )
- ti.validatorError = "Validation Error"
- assertEqualsHtml(
- "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" value=\"$datastr\"><span class=\"help-block small\">Validation Error</span></div>",
- element?.innerHTML,
- "Should render correct date time input form control with validation error"
- )
- }
- }
-
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt
deleted file mode 100644
index 626b70e4..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.upload
-
-import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.form.upload.UploadInput
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class UploadInputSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val upi = UploadInput(multiple = true).apply {
- id = "idti"
- }
- root.add(upi)
- val content = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
- assertEqualsHtml(
- "<input class=\"form-control\" id=\"idti\" type=\"file\" multiple=\"true\">",
- content,
- "Should render correct file input control for multiple files"
- )
- upi.multiple = false
- val content2 = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
- assertEqualsHtml(
- "<input class=\"form-control\" id=\"idti\" type=\"file\">",
- content2,
- "Should render correct file input control for single file"
- )
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt
deleted file mode 100644
index bea4ddee..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package test.pl.treksoft.kvision.form.upload
-
-import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.form.upload.Upload
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class UploadSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", true)
- val upi = Upload(multiple = true)
- val id = upi.input.id
- root.add(upi)
- val content = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
- assertEqualsHtml(
- "<input class=\"form-control\" id=\"$id\" type=\"file\" multiple=\"true\">",
- content,
- "Should render correct file input control for multiple files"
- )
- upi.multiple = false
- val content2 = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
- assertEqualsHtml(
- "<input class=\"form-control\" id=\"$id\" type=\"file\">",
- content2,
- "Should render correct file input control for single file"
- )
- }
- }
-
-}