From 70d2f14d4a34f841a3161482eec5d355cbd755f6 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 4 Feb 2018 21:49:23 +0100 Subject: Refactoring packages layout --- .../test/pl/treksoft/kvision/KVManagerSpec.kt | 57 +++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/TestUtil.kt | 2 +- .../test/pl/treksoft/kvision/core/ContainerSpec.kt | 2 +- .../test/pl/treksoft/kvision/core/KVManagerSpec.kt | 58 ---------------------- .../test/pl/treksoft/kvision/core/RootSpec.kt | 52 ------------------- .../test/pl/treksoft/kvision/core/WidgetSpec.kt | 2 +- .../pl/treksoft/kvision/core/WidgetWrapperSpec.kt | 2 +- .../pl/treksoft/kvision/data/DataContainerSpec.kt | 2 +- .../pl/treksoft/kvision/dropdown/DropDownSpec.kt | 2 +- .../pl/treksoft/kvision/form/FieldLabelSpec.kt | 2 +- .../test/pl/treksoft/kvision/form/HelpBlockSpec.kt | 2 +- .../pl/treksoft/kvision/form/check/CheckBoxSpec.kt | 2 +- .../treksoft/kvision/form/check/CheckInputSpec.kt | 2 +- .../treksoft/kvision/form/check/RadioGroupSpec.kt | 2 +- .../pl/treksoft/kvision/form/check/RadioSpec.kt | 2 +- .../kvision/form/select/SelectInputSpec.kt | 2 +- .../kvision/form/select/SelectOptGroupSpec.kt | 2 +- .../kvision/form/select/SelectOptionSpec.kt | 2 +- .../pl/treksoft/kvision/form/select/SelectSpec.kt | 2 +- .../kvision/form/spinner/SpinnerInputSpec.kt | 2 +- .../treksoft/kvision/form/spinner/SpinnerSpec.kt | 2 +- .../pl/treksoft/kvision/form/text/PasswordSpec.kt | 2 +- .../kvision/form/text/RichTextInputSpec.kt | 2 +- .../pl/treksoft/kvision/form/text/RichTextSpec.kt | 2 +- .../kvision/form/text/TextAreaInputSpec.kt | 2 +- .../pl/treksoft/kvision/form/text/TextAreaSpec.kt | 2 +- .../pl/treksoft/kvision/form/text/TextInputSpec.kt | 2 +- .../test/pl/treksoft/kvision/form/text/TextSpec.kt | 2 +- .../kvision/form/time/DateTimeInputSpec.kt | 2 +- .../pl/treksoft/kvision/form/time/DateTimeSpec.kt | 2 +- .../pl/treksoft/kvision/helpers/CloseIconSpec.kt | 27 ---------- .../test/pl/treksoft/kvision/html/ButtonSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/ImageSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/LabelSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/LinkSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/ListSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/TagSpec.kt | 2 +- .../test/pl/treksoft/kvision/modal/AlertSpec.kt | 2 +- .../pl/treksoft/kvision/modal/CloseIconSpec.kt | 27 ++++++++++ .../test/pl/treksoft/kvision/modal/ConfirmSpec.kt | 2 +- .../test/pl/treksoft/kvision/modal/ModalSpec.kt | 2 +- .../pl/treksoft/kvision/panel/DockPanelSpec.kt | 2 +- .../pl/treksoft/kvision/panel/FlexPanelSpec.kt | 2 +- .../pl/treksoft/kvision/panel/GridPanelSpec.kt | 2 +- .../test/pl/treksoft/kvision/panel/HPanelSpec.kt | 2 +- .../kvision/panel/ResponsiveGridPanelSpec.kt | 2 +- .../test/pl/treksoft/kvision/panel/RootSpec.kt | 52 +++++++++++++++++++ .../pl/treksoft/kvision/panel/SplitPanelSpec.kt | 2 +- .../pl/treksoft/kvision/panel/StackPanelSpec.kt | 2 +- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 2 +- .../test/pl/treksoft/kvision/panel/VPanelSpec.kt | 2 +- 51 files changed, 181 insertions(+), 182 deletions(-) create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/KVManagerSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/core/KVManagerSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/core/RootSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt (limited to 'src/test') diff --git a/src/test/kotlin/test/pl/treksoft/kvision/KVManagerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/KVManagerSpec.kt new file mode 100644 index 00000000..bbf3241f --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/KVManagerSpec.kt @@ -0,0 +1,57 @@ +package test.pl.treksoft.kvision + +import com.github.snabbdom.h +import pl.treksoft.kvision.KVManager +import pl.treksoft.kvision.utils.snAttrs +import pl.treksoft.kvision.utils.snOpt +import pl.treksoft.kvision.utils.snStyle +import kotlin.browser.document +import kotlin.test.Test +import kotlin.test.assertTrue + +class KVManagerSpec : DomSpec { + + @Test + fun patchById() { + run { + val vnode = h("span", snOpt { + attrs = snAttrs(listOf("id" to "test_new")) + style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) + }) + KVManager.patch("test", vnode) + assertTrue("Original child should not exist") { document.getElementById("test") == null } + assertTrue("New child should exist") { document.getElementById("test_new") != null } + } + } + + @Test + fun patchByVnode() { + run { + val vnode1 = h("span", snOpt { + attrs = snAttrs(listOf("id" to "test2")) + style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) + }) + val vnode2 = KVManager.patch("test", vnode1) + val vnode3 = h("span", snOpt { + attrs = snAttrs(listOf("id" to "test3")) + style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) + }) + KVManager.patch(vnode2, vnode3) + assertTrue("First child should not exist") { document.getElementById("test") == null } + assertTrue("Second child should not exist") { document.getElementById("test2") == null } + assertTrue("Third child should exist") { document.getElementById("test3") != null } + } + } + + @Test + fun virtualize() { + run { + val node = KVManager.virtualize("

Virtual node

") + KVManager.patch("test", node) + assertTrue("Original child should not exist") { document.getElementById("test") == null } + val v = document.getElementById("virtual") + assertTrue("New child should exist") { v != null } + assertTrue("New child should have one child") { v?.children?.length == 1 } + } + } +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt index 808ca86d..a7e2e872 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt @@ -2,7 +2,7 @@ package test.pl.treksoft.kvision import org.w3c.dom.Element import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.core.Widget import kotlin.browser.document 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 e0bc16da..923ec98f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.core -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.panel.SimplePanel import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/KVManagerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/KVManagerSpec.kt deleted file mode 100644 index 307ebd67..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/KVManagerSpec.kt +++ /dev/null @@ -1,58 +0,0 @@ -package test.pl.treksoft.kvision.core - -import com.github.snabbdom.h -import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.snabbdom.snAttrs -import pl.treksoft.kvision.snabbdom.snOpt -import pl.treksoft.kvision.snabbdom.snStyle -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertTrue - -class KVManagerSpec : DomSpec { - - @Test - fun patchById() { - run { - val vnode = h("span", snOpt { - attrs = snAttrs(listOf("id" to "test_new")) - style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) - }) - KVManager.patch("test", vnode) - assertTrue("Original child should not exist") { document.getElementById("test") == null } - assertTrue("New child should exist") { document.getElementById("test_new") != null } - } - } - - @Test - fun patchByVnode() { - run { - val vnode1 = h("span", snOpt { - attrs = snAttrs(listOf("id" to "test2")) - style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) - }) - val vnode2 = KVManager.patch("test", vnode1) - val vnode3 = h("span", snOpt { - attrs = snAttrs(listOf("id" to "test3")) - style = snStyle(listOf("fontWeight" to "bold", "fontStyle" to "italic")) - }) - KVManager.patch(vnode2, vnode3) - assertTrue("First child should not exist") { document.getElementById("test") == null } - assertTrue("Second child should not exist") { document.getElementById("test2") == null } - assertTrue("Third child should exist") { document.getElementById("test3") != null } - } - } - - @Test - fun virtualize() { - run { - val node = KVManager.virtualize("

Virtual node

") - KVManager.patch("test", node) - assertTrue("Original child should not exist") { document.getElementById("test") == null } - val v = document.getElementById("virtual") - assertTrue("New child should exist") { v != null } - assertTrue("New child should have one child") { v?.children?.length == 1 } - } - } -} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/RootSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/RootSpec.kt deleted file mode 100644 index 9895c16d..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/RootSpec.kt +++ /dev/null @@ -1,52 +0,0 @@ -package test.pl.treksoft.kvision.core - -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.modal.Modal -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertTrue - -class RootSpec : DomSpec { - - @Test - fun getSnClass() { - run { - Root("test") - val rootElem = document.getElementById("test") - assertTrue("Standard root child has correct css class") { rootElem?.className == "container-fluid" } - } - } - - @Test - fun getSnClass_Fluid() { - run { - Root("test", fixed = true) - val rootElem = document.getElementById("test") - assertTrue("Fluid root child has correct css class") { rootElem?.className == "container" } - } - } - - @Test - fun getRoot() { - run { - val root = Root("test") - val r = root.getRoot() - assertTrue("Should return self") { r == root } - } - } - - @Test - fun addModal() { - run { - val root = Root("test") - val modal = Modal("test") - modal.id = "test_modal" - root.addModal(modal) - modal.show() - val elem = document.getElementById("test_modal") - assertTrue("Should render standard modal") { elem != null } - modal.hide() - } - } -} \ No newline at end of file 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 4e8c4ea1..8c0ec323 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.core -import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.core.Widget +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.WSpec import kotlin.browser.document import kotlin.test.Test 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 01aee755..0c686de0 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.core -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.core.UNIT import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.core.WidgetWrapper diff --git a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt index 20a1e484..9eb97115 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt @@ -2,7 +2,7 @@ package test.pl.treksoft.kvision.data import com.lightningkite.kotlin.observable.list.observableListOf import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.data.BaseDataComponent import pl.treksoft.kvision.data.DataContainer import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt index 41931abd..530cb941 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.dropdown -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.dropdown.DD import pl.treksoft.kvision.dropdown.DropDown import test.pl.treksoft.kvision.DomSpec 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 fa206efd..99dd9ebe 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.FieldLabel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 1b8d2a6a..642e5f2b 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.HelpBlock import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 e049aa17..04cbbff9 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.check.CHECKBOXSTYLE import pl.treksoft.kvision.form.check.CheckBox import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt index 584b1232..84ed59e2 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.check.CHECKINPUTTYPE import pl.treksoft.kvision.form.check.CheckInput import test.pl.treksoft.kvision.DomSpec 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 d301a533..638a887e 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.check.Radio import pl.treksoft.kvision.form.check.RadioGroup import test.pl.treksoft.kvision.DomSpec 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 6eedfd27..3826b3a8 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.check.RADIOSTYLE import pl.treksoft.kvision.form.check.Radio import test.pl.treksoft.kvision.DomSpec 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 index 28f9eb03..a191ba5d 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.core.Root +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 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 index 8562d3cc..9de293ad 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.select.SelectOptGroup import pl.treksoft.kvision.form.select.SelectOption import test.pl.treksoft.kvision.DomSpec 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 index 221d46b0..c7b314cd 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.select.SelectOption import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 index 1afb6c79..b265b994 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.core.Root +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 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 index 8c90c684..acfce2c4 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerInputSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.spinner -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.spinner.SpinnerInput import test.pl.treksoft.kvision.DomSpec import kotlin.test.Test 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 index 8a7a346b..7882b16c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.spinner -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.spinner.Spinner import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 1cbb29cc..cc86061b 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.Password import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 index 92e0e9ff..511898ee 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.form.text import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.RichTextInput import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 index 28ce2ee7..719453c9 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.form.text import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.RichText import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 a27e959d..54eba437 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.TextAreaInput import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 8f9cf639..3207fe9d 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.TextArea import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 a3402c45..45861293 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.TEXTINPUTTYPE import pl.treksoft.kvision.form.text.TextInput import test.pl.treksoft.kvision.DomSpec 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 77741f26..27e30c8c 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 @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.Text import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 index 909c4928..28916443 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.time -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.time.DateTimeInput import pl.treksoft.kvision.utils.toStringF import test.pl.treksoft.kvision.DomSpec 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 index 8ac43174..96cbf34e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.form.time -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.time.DateTime import pl.treksoft.kvision.utils.toStringF import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt deleted file mode 100644 index eb573d4f..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt +++ /dev/null @@ -1,27 +0,0 @@ -package test.pl.treksoft.kvision.helpers - -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.helpers.CloseIcon -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertEquals - -class CloseIconSpec : DomSpec { - - @Test - fun render() { - run { - val root = Root("test") - val ci = CloseIcon() - root.add(ci) - val element = document.getElementById("test") - assertEquals( - "", - element?.innerHTML, - "Should render correct close icon" - ) - } - } - -} \ No newline at end of file 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 e81cec7b..39d53881 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.BUTTONSIZE import pl.treksoft.kvision.html.BUTTONSTYLE import pl.treksoft.kvision.html.Button 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 283847e8..f19fcd8a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.IMAGESHAPE import pl.treksoft.kvision.html.Image import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt index 9c6c4e6e..2d83df63 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.Label import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 0087f56a..7ab75809 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.Link import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 bdf1ca0f..f3f093ed 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.LIST import pl.treksoft.kvision.html.ListTag import pl.treksoft.kvision.html.TAG 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 9840ff3e..88ce062a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.ALIGN import pl.treksoft.kvision.html.Link import pl.treksoft.kvision.html.TAG diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt index d34bbb2b..6582e33c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.modal import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.modal.Alert import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt new file mode 100644 index 00000000..275ceb6b --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt @@ -0,0 +1,27 @@ +package test.pl.treksoft.kvision.modal + +import pl.treksoft.kvision.modal.CloseIcon +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 CloseIconSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test") + val ci = CloseIcon() + root.add(ci) + val element = document.getElementById("test") + assertEquals( + "", + element?.innerHTML, + "Should render correct close icon" + ) + } + } + +} \ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt index 06b71720..479d6418 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.modal import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.modal.Confirm import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/ModalSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/ModalSpec.kt index 7bdd3562..efc449c7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/ModalSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/ModalSpec.kt @@ -1,8 +1,8 @@ package test.pl.treksoft.kvision.modal import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.modal.Modal +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.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 c748a45c..2e63821b 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.DockPanel import pl.treksoft.kvision.panel.SIDE import test.pl.treksoft.kvision.DomSpec 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 d79b06f9..a662bcbd 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FLEXDIR import pl.treksoft.kvision.panel.FLEXJUSTIFY import pl.treksoft.kvision.panel.FlexPanel 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 6590e0b0..3bbd0b95 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.GridPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 a76c7eb0..f380d8e4 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FLEXJUSTIFY import pl.treksoft.kvision.panel.HPanel import test.pl.treksoft.kvision.DomSpec 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 d52fb3d7..c0343395 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.ResponsiveGridPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt new file mode 100644 index 00000000..203bba8f --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/RootSpec.kt @@ -0,0 +1,52 @@ +package test.pl.treksoft.kvision.panel + +import pl.treksoft.kvision.modal.Modal +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 RootSpec : DomSpec { + + @Test + fun getSnClass() { + run { + Root("test") + val rootElem = document.getElementById("test") + assertTrue("Standard root child has correct css class") { rootElem?.className == "container-fluid" } + } + } + + @Test + fun getSnClass_Fluid() { + run { + Root("test", fixed = true) + val rootElem = document.getElementById("test") + assertTrue("Fluid root child has correct css class") { rootElem?.className == "container" } + } + } + + @Test + fun getRoot() { + run { + val root = Root("test") + val r = root.getRoot() + assertTrue("Should return self") { r == root } + } + } + + @Test + fun addModal() { + run { + val root = Root("test") + val modal = Modal("test") + modal.id = "test_modal" + root.addModal(modal) + modal.show() + val elem = document.getElementById("test_modal") + assertTrue("Should render standard modal") { elem != null } + modal.hide() + } + } +} \ No newline at end of file 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 4be7f441..a6d1c4a3 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.DIRECTION import pl.treksoft.kvision.panel.SplitPanel import test.pl.treksoft.kvision.DomSpec 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 51e4a3f2..3232a419 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.StackPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 4d1803b1..527f6297 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.TabPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document 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 ad8ceaac..ec52d753 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FLEXJUSTIFY import pl.treksoft.kvision.panel.VPanel import test.pl.treksoft.kvision.DomSpec -- cgit