aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorRobbie Cronin <robert.cronin@uqconnect.edu.au>2019-06-21 13:17:30 +0800
committerGitHub <noreply@github.com>2019-06-21 13:17:30 +0800
commit2f8e0060308b0f5b1eeac9541600bfed3ad5acc9 (patch)
tree80d40364c5f5957da8c82578dd1152adac06912e /src/test/kotlin
parent9038555f9e46a32a0a725112304e64cdd408bf8e (diff)
parentd9f1a90c772719d14540eb2bf7bc3b8384fa7a72 (diff)
downloadkvision-2f8e0060308b0f5b1eeac9541600bfed3ad5acc9.tar.gz
kvision-2f8e0060308b0f5b1eeac9541600bfed3ad5acc9.tar.bz2
kvision-2f8e0060308b0f5b1eeac9541600bfed3ad5acc9.zip
Merge pull request #1 from rjaros/master
merge
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt10
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt6
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt4
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectInputSpec.kt51
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectSpec.kt53
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/CanvasSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/DivSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/IframeSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt4
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt8
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt8
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt31
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/table/CellSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/table/HeaderCellSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt2
64 files changed, 207 insertions, 78 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt
index 37d7a9df..13c8531b 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt
@@ -86,7 +86,7 @@ interface WSpec : DomSpec {
fun runW(code: (widget: Widget, element: Element?) -> Unit) {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val widget = Widget()
widget.id = "test_id"
root.add(widget)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt
index 3e16fff8..960a18b6 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt
@@ -34,7 +34,7 @@ class ContainerSpec : DomSpec {
@Test
fun add() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val container = SimplePanel()
val child1 = Widget()
child1.id = "child1"
@@ -52,7 +52,7 @@ class ContainerSpec : DomSpec {
@Test
fun addAll() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val container = SimplePanel()
val child1 = Widget()
child1.id = "child1"
@@ -69,7 +69,7 @@ class ContainerSpec : DomSpec {
@Test
fun remove() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val container = SimplePanel()
val child1 = Widget()
child1.id = "child1"
@@ -88,7 +88,7 @@ class ContainerSpec : DomSpec {
@Test
fun removeAll() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val container = SimplePanel()
val child1 = Widget()
child1.id = "child1"
@@ -107,7 +107,7 @@ class ContainerSpec : DomSpec {
@Test
fun getChildren() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val container = SimplePanel()
val child1 = Widget()
child1.id = "child1"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt
index bdb93744..4fbe3d59 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt
@@ -37,7 +37,7 @@ class StyleSpec : DomSpec {
@Test
fun render() {
run {
- Root("test", true) {
+ Root("test", fixed = true) {
widget {
style {
margin = 2.px
@@ -58,7 +58,7 @@ class StyleSpec : DomSpec {
@Test
fun renderCustomClass() {
run {
- Root("test", true) {
+ Root("test", fixed = true) {
widget {
style("customclass") {
margin = 2.px
@@ -79,7 +79,7 @@ class StyleSpec : DomSpec {
@Test
fun renderSubclass() {
run {
- Root("test", true) {
+ Root("test", fixed = true) {
widget {
style("customclass") {
margin = 2.px
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt
index fc1cc761..6b9be23d 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt
@@ -130,7 +130,7 @@ class WidgetSpec : WSpec {
@Test
fun getRoot() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val widget = Widget()
root.add(widget)
val r = widget.getRoot()
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt
index aac92c50..0c28c327 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt
@@ -35,7 +35,7 @@ class WidgetWrapperSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val widget = Widget()
val wrapper = WidgetWrapper(widget)
wrapper.width = 100 to UNIT.em
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt
index 7d320e2e..35172267 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt
@@ -34,7 +34,7 @@ class ContextMenuSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val m = ContextMenu {
link("a", "b")
link("c", "d")
@@ -54,7 +54,7 @@ class ContextMenuSpec : DomSpec {
@Test
fun positionMenu() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val m = ContextMenu {
link("a", "b")
link("c", "d")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt
index 5a9a050c..e75baf9e 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt
@@ -32,7 +32,7 @@ class HeaderSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h = Header("Test")
root.add(h)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt
index 2f2d22bf..86607ec7 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt
@@ -32,7 +32,7 @@ class SeparatorSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val s = Separator()
root.add(s)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt
index d13bc920..5319d4bc 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt
@@ -32,7 +32,7 @@ class FieldLabelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val fl = FieldLabel("input", "Label")
root.add(fl)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt
index c7d0b0da..c7c4ede5 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt
@@ -32,7 +32,7 @@ class HelpBlockSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val fl = HelpBlock("Form Error")
root.add(fl)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxInputSpec.kt
index 8a9f86d5..677a2b8e 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxInputSpec.kt
@@ -32,7 +32,7 @@ class CheckBoxInputSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = CheckBoxInput(value = true).apply {
name = "name"
id = "idti"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt
index 9a178abb..16da0c70 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt
@@ -33,7 +33,7 @@ class CheckBoxSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = CheckBox(value = true, label = "Label").apply {
name = "name"
style = CheckBoxStyle.DANGER
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt
index f74a76f7..55788c84 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt
@@ -33,7 +33,7 @@ class RadioGroupInputSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = RadioGroupInput(options = listOf("a" to "A", "b" to "B"), value = "a").apply {
disabled = true
inline = true
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt
index e55e9913..2ed52b67 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt
@@ -33,7 +33,7 @@ class RadioGroupSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = RadioGroup(options = listOf("a" to "A", "b" to "B"), value = "a", label = "Label").apply {
disabled = true
inline = true
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioInputSpec.kt
index 55d4108a..5b4fe836 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioInputSpec.kt
@@ -32,7 +32,7 @@ class RadioInputSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = RadioInput(value = true).apply {
name = "name"
id = "idti"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
index 09763cc7..a8fbbcc5 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
@@ -33,7 +33,7 @@ class RadioSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ci = Radio(value = true, label = "Label", extraValue = "abc").apply {
name = "name"
style = RadioStyle.DANGER
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectInputSpec.kt
new file mode 100644
index 00000000..b2c77d10
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectInputSpec.kt
@@ -0,0 +1,51 @@
+/*
+ * 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.SimpleSelectInput
+import pl.treksoft.kvision.panel.Root
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class SimpleSelectInputSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", fixed = true)
+ val si = SimpleSelectInput(listOf("test1" to "Test 1", "test2" to "Test 2"), "test1", true).apply {
+ name = "name"
+ id = "idti"
+ disabled = true
+ }
+ root.add(si)
+ val element = document.getElementById("test")
+ assertEqualsHtml(
+ "<select class=\"form-control\" id=\"idti\" name=\"name\" disabled=\"disabled\"><option value=\"#kvnull\"></option><option value=\"test1\" selected=\"selected\">Test 1</option><option value=\"test2\">Test 2</option></select>",
+ element?.innerHTML,
+ "Should render correct simple select input control"
+ )
+ }
+ }
+
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectSpec.kt
new file mode 100644
index 00000000..db1c36f0
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SimpleSelectSpec.kt
@@ -0,0 +1,53 @@
+/*
+ * 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.SimpleSelect
+import pl.treksoft.kvision.panel.Root
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class SimpleSelectSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", fixed = true)
+ val select =
+ SimpleSelect(listOf("test1" to "Test 1", "test2" to "Test 2"), "test1", true, "select", "Label").apply {
+ name = "name"
+ id = "idti"
+ disabled = true
+ }
+ root.add(select)
+ val element = document.getElementById("test")
+ val id = select.input.id
+ assertEqualsHtml(
+ "<div class=\"form-group\" id=\"idti\"><label class=\"control-label\" for=\"$id\">Label</label><select class=\"form-control\" id=\"$id\" name=\"name\" disabled=\"disabled\"><option value=\"#kvnull\"></option><option value=\"test1\" selected=\"selected\">Test 1</option><option value=\"test2\">Test 2</option></select></div>",
+ element?.innerHTML,
+ "Should render correct simple select form control"
+ )
+ }
+ }
+
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt
index dc46782b..5d6c2738 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt
@@ -32,7 +32,7 @@ class PasswordSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ti = Password(value = "abc", label = "Label").apply {
placeholder = "place"
name = "name"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt
index 0e8257ff..815f12e7 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt
@@ -32,7 +32,7 @@ class TextAreaInputSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ti = TextAreaInput(cols = 5, rows = 2, value = "abc").apply {
placeholder = "place"
name = "name"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt
index c948628b..31b4baf2 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt
@@ -32,7 +32,7 @@ class TextAreaSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ti = TextArea(cols = 5, rows = 2, value = "abc", label = "Label").apply {
placeholder = "place"
name = "name"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt
index bd8c9786..6d21ab14 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt
@@ -33,7 +33,7 @@ class TextInputSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ti = TextInput(type = TextInputType.PASSWORD, value = "abc").apply {
placeholder = "place"
name = "name"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt
index 071bf35b..7ce811fa 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt
@@ -32,7 +32,7 @@ class TextSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ti = Text(value = "abc", label = "Label").apply {
placeholder = "place"
name = "name"
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt
index de2ea036..512c3bc2 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt
@@ -34,7 +34,7 @@ class ButtonSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val button = Button("Cancel", "fa-bars", ButtonStyle.PRIMARY)
button.size = ButtonSize.LARGE
button.block = true
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/CanvasSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/CanvasSpec.kt
index a896d9e5..f30872ca 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/CanvasSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/CanvasSpec.kt
@@ -32,7 +32,7 @@ class CanvasSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val canvas = Canvas(800, 600)
root.add(canvas)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/DivSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/DivSpec.kt
index 4fd64478..528fc0ae 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/DivSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/DivSpec.kt
@@ -32,7 +32,7 @@ class DivSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val div = Div("This is a div")
root.add(div)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt
index 6398d95c..69819203 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt
@@ -32,7 +32,7 @@ class FooterSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val footer = Footer("This is a footer")
root.add(footer)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt
index 6f22b89f..bd0c69b6 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt
@@ -32,7 +32,7 @@ class H1Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h1 = H1("This is h1 header")
root.add(h1)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt
index 1ca74077..5ec2a666 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt
@@ -32,7 +32,7 @@ class H2Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h2 = H2("This is h2 header")
root.add(h2)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt
index a9f58473..f85ede34 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt
@@ -32,7 +32,7 @@ class H3Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h3 = H3("This is h3 header")
root.add(h3)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt
index 47550459..ce52282b 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt
@@ -32,7 +32,7 @@ class H4Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h4 = H4("This is h4 header")
root.add(h4)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt
index 6b3fc647..029a692f 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt
@@ -32,7 +32,7 @@ class H5Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val h5 = H5("This is h5 header")
root.add(h5)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt
index e22bd401..06a851e0 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt
@@ -32,7 +32,7 @@ class H6Spec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val div = H1("This is h1 header")
root.add(div)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt
index e5ea8679..1b33adcc 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt
@@ -32,7 +32,7 @@ class HeaderSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val header = Header("This is a header")
root.add(header)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt
index fde07413..ea3425c5 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt
@@ -32,7 +32,7 @@ class IconSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val icon = Icon("fa-check")
root.add(icon)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/IframeSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/IframeSpec.kt
index 60a380b7..69051f92 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/IframeSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/IframeSpec.kt
@@ -33,7 +33,7 @@ class IframeSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val iframe = Iframe("https://www.google.com", null, "test", 800, 600, setOf(Sandbox.ALLOWSAMEORIGIN))
root.add(iframe)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt
index fa32a24f..169575fc 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt
@@ -34,7 +34,7 @@ class ImageSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val res = require("./img/placeholder.png")
@Suppress("UnsafeCastFromDynamic")
val image = Image(res, "Image", true, ImageShape.ROUNDED, true)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt
index 6a4434ae..88869cf4 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt
@@ -32,7 +32,7 @@ class LinkSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val link = Link("Google", "http://www.google.com")
root.add(link)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt
index 5f0aac69..bf52f1dc 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt
@@ -35,7 +35,7 @@ class ListSpec : DomSpec {
@Test
fun renderElements() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val list = ListTag(ListType.DL_HORIZ, listOf("a1", "a2", "b1", "b2"))
root.add(list)
val element = document.getElementById("test")
@@ -50,7 +50,7 @@ class ListSpec : DomSpec {
@Test
fun renderAsContainer() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val list = ListTag(ListType.UL)
list.add(Tag(TAG.PRE, "pre"))
list.add(Tag(TAG.DEL, "del"))
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt
index d5af81e3..0ab9c5bc 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt
@@ -32,7 +32,7 @@ class PSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val par = P("This is a paragraph")
root.add(par)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt
index 4fb7a490..fa987d05 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt
@@ -32,7 +32,7 @@ class SectionSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val section = Section("This is a section")
root.add(section)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt
index b1f49b45..88604b5e 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt
@@ -32,7 +32,7 @@ class SpanSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val span = Span("This is a label")
root.add(span)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt
index 29a5c079..b6017804 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt
@@ -35,7 +35,7 @@ class TagSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = false, align = Align.CENTER)
root.add(tag)
val element = document.getElementById("test")
@@ -50,7 +50,7 @@ class TagSpec : DomSpec {
@Test
fun renderRich() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = true, align = Align.RIGHT)
root.add(tag)
val element = document.getElementById("test")
@@ -65,7 +65,7 @@ class TagSpec : DomSpec {
@Test
fun renderAsContainer() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tag = Tag(TAG.P, align = Align.RIGHT)
tag.add(Tag(TAG.DEL, "This is test"))
tag.add(Link("abc", "/x"))
@@ -82,7 +82,7 @@ class TagSpec : DomSpec {
@Test
fun renderUnaryPlus() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tag = Tag(TAG.H1, rich = true) {
+"This is <b>h1</b>"
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt
index aeea7a3b..40720bcb 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt
@@ -32,7 +32,7 @@ class NavFormSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val navf = NavForm()
root.add(navf)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt
index 2ecad124..988a706d 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt
@@ -32,7 +32,7 @@ class NavSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val nav = Nav()
root.add(nav)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt
index 90af4450..f38a05f9 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt
@@ -37,7 +37,7 @@ class NavbarSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val navbar = Navbar("TEST", NavbarType.FIXEDTOP)
root.add(navbar)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
index d387be56..5684120d 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
@@ -34,7 +34,7 @@ class DockPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val dockPanel = DockPanel()
root.add(dockPanel)
dockPanel.add(Span("abc"), Side.UP)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
index 5bcc68f6..b897fef2 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
@@ -35,7 +35,7 @@ class FlexPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val flexPanel = FlexPanel(FlexDir.ROWREV, justify = FlexJustify.SPACEEVENLY)
root.add(flexPanel)
flexPanel.add(Span("abc"), 1)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
index add3638f..d7d9beb7 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
@@ -33,7 +33,7 @@ class GridPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val gridPanel = GridPanel()
root.add(gridPanel)
gridPanel.add(Span("abc"), 1, 1)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
index a185420c..c53b2e57 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
@@ -34,7 +34,7 @@ class HPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val hPanel = HPanel(justify = FlexJustify.SPACEBETWEEN)
root.add(hPanel)
hPanel.add(Span("abc"), 1)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
index eb710cef..fcdf9860 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
@@ -33,7 +33,7 @@ class ResponsiveGridPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val rgPanel = ResponsiveGridPanel()
root.add(rgPanel)
rgPanel.add(Span("abc"), 1, 1)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt
index 659dac9a..474b1d6a 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt
@@ -50,7 +50,7 @@ class RootSpec : DomSpec {
@Test
fun getRoot() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val r = root.getRoot()
assertTrue("Should return self") { r == root }
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
index 09c397ce..94ed165a 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
@@ -34,7 +34,7 @@ class SplitPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val splitPanel = SplitPanel(Direction.VERTICAL)
root.add(splitPanel)
val label1 = Span("abc")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
index f52b6486..8a1ce795 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
@@ -33,7 +33,7 @@ class StackPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val stackPanel = StackPanel()
root.add(stackPanel)
val label1 = Span("abc")
@@ -48,7 +48,7 @@ class StackPanelSpec : DomSpec {
@Test
fun renderNotActivateLast() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val stackPanel = StackPanel(activateLast = false)
root.add(stackPanel)
val label1 = Span("abc")
@@ -67,7 +67,7 @@ class StackPanelSpec : DomSpec {
@Test
fun remove() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val stackPanel = StackPanel(activateLast = false)
root.add(stackPanel)
val label1 = Span("abc")
@@ -83,7 +83,7 @@ class StackPanelSpec : DomSpec {
@Test
fun removeAll() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val stackPanel = StackPanel(activateLast = false)
root.add(stackPanel)
val label1 = Span("abc")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
index 900a7268..35620818 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
@@ -21,6 +21,7 @@
*/
package test.pl.treksoft.kvision.panel
+import pl.treksoft.jquery.jQuery
import pl.treksoft.kvision.html.Span
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.panel.TabPanel
@@ -33,7 +34,7 @@ class TabPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tabs = TabPanel()
root.add(tabs)
val label1 = Span("abc")
@@ -52,7 +53,7 @@ class TabPanelSpec : DomSpec {
@Test
fun setActiveIndex() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tabs = TabPanel()
root.add(tabs)
val label1 = Span("abc")
@@ -72,7 +73,7 @@ class TabPanelSpec : DomSpec {
@Test
fun removeTab() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val tabs = TabPanel()
root.add(tabs)
val label1 = Span("abc")
@@ -89,4 +90,28 @@ class TabPanelSpec : DomSpec {
)
}
}
+
+
+ @Test
+ fun tabClick() {
+ run {
+ val root = Root("test", fixed = true)
+ val tabs = TabPanel()
+ root.add(tabs)
+ val label1 = Span("abc")
+ val label2 = Span("def")
+ tabs.addTab("ABC", label1)
+ tabs.addTab("DEF", label2)
+ tabs.removeTab(0)
+ val label3 = Span("ghi")
+ tabs.addTab("GHI", label3)
+ jQuery("#test a")[0]?.click()
+ val element = document.getElementById("test")
+ assertEqualsHtml(
+ "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">DEF</a></li><li role=\"presentation\"><a href=\"#\">GHI</a></li></ul><div><span>def</span></div></div>",
+ element?.innerHTML,
+ "Should select correct tab by clicking"
+ )
+ }
+ }
} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
index 81ea720d..5bed89f1 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
@@ -34,7 +34,7 @@ class VPanelSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val vPanel = VPanel(justify = FlexJustify.SPACEBETWEEN)
root.add(vPanel)
vPanel.add(Span("abc"), 1)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
index d520f0b6..2f044987 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
@@ -33,7 +33,7 @@ class ProgressBarSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val progressBar =
ProgressBar(50, style = ProgressBarStyle.SUCCESS, striped = true, content = "Processing ...")
root.add(progressBar)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
index 83892ed9..4aa14230 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
@@ -33,7 +33,7 @@ class ProgressIndicatorSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val ind = ProgressIndicator(50, style = ProgressBarStyle.SUCCESS, striped = true)
root.add(ind)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/CellSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/CellSpec.kt
index 435e9b22..582212bd 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/table/CellSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/table/CellSpec.kt
@@ -32,7 +32,7 @@ class CellSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val cell = Cell("This is a cell")
root.add(cell)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/HeaderCellSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/HeaderCellSpec.kt
index 8c210ae0..40f25a66 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/table/HeaderCellSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/table/HeaderCellSpec.kt
@@ -32,7 +32,7 @@ class HeaderCellSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val cell = HeaderCell("This is a header cell")
root.add(cell)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt
index 6c2f3c1c..d9a6fdfa 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt
@@ -33,7 +33,7 @@ class RowSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val row = Row {
cell("A")
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt
index 637f8f28..997da597 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt
@@ -35,7 +35,7 @@ class TableSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val table = Table(listOf("a", "b")) {
row {
cell("A")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt
index 16b352d8..b324b8ab 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt
@@ -34,7 +34,7 @@ class ButtonGroupSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val group = ButtonGroup()
root.add(group)
val element = document.getElementById("test")
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt
index 4d296e03..d41ef05e 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt
@@ -32,7 +32,7 @@ class ToolbarSpec : DomSpec {
@Test
fun render() {
run {
- val root = Root("test", true)
+ val root = Root("test", fixed = true)
val toolbar = Toolbar()
root.add(toolbar)
val element = document.getElementById("test")