aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt75
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt46
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt46
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt (renamed from src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt)4
-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/text/TextSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt54
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt54
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt70
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt50
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt117
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt56
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt55
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt3
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt57
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt47
16 files changed, 6 insertions, 732 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt
deleted file mode 100644
index 35172267..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.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.dropdown
-
-import pl.treksoft.kvision.dropdown.ContextMenu
-import pl.treksoft.kvision.html.Link.Companion.link
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.utils.obj
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ContextMenuSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val m = ContextMenu {
- link("a", "b")
- link("c", "d")
- }
- root.setContextMenu(m)
- m.show()
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<ul class=\"dropdown-menu\" style=\"display: block;\"><li><a href=\"b\">a</a></li><li><a href=\"d\">c</a></li></ul>",
- element?.innerHTML,
- "Should render correct context menu"
- )
- }
- }
-
- @Suppress("UnsafeCastFromDynamic")
- @Test
- fun positionMenu() {
- run {
- val root = Root("test", fixed = true)
- val m = ContextMenu {
- link("a", "b")
- link("c", "d")
- }
- root.setContextMenu(m)
- m.positionMenu(obj {
- pageX = 40
- pageY = 50
- })
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<ul class=\"dropdown-menu\" style=\"display: block; top: 50px; left: 40px;\"><li><a href=\"b\">a</a></li><li><a href=\"d\">c</a></li></ul>",
- element?.innerHTML,
- "Should place context menu in the correct position"
- )
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt
deleted file mode 100644
index e75baf9e..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt
+++ /dev/null
@@ -1,46 +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.dropdown
-
-import pl.treksoft.kvision.dropdown.Header
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class HeaderSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val h = Header("Test")
- root.add(h)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<li class=\"dropdown-header\">Test</li>",
- element?.innerHTML,
- "Should render correct drop down header"
- )
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt
deleted file mode 100644
index 86607ec7..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt
+++ /dev/null
@@ -1,46 +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.dropdown
-
-import pl.treksoft.kvision.dropdown.Separator
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class SeparatorSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val s = Separator()
- root.add(s)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<li class=\"divider\" role=\"separator\"></li>",
- element?.innerHTML,
- "Should render correct drop down separator"
- )
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt
index c7c4ede5..4be84d22 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt
@@ -21,7 +21,7 @@
*/
package test.pl.treksoft.kvision.form
-import pl.treksoft.kvision.form.HelpBlock
+import pl.treksoft.kvision.form.HelpText
import pl.treksoft.kvision.panel.Root
import test.pl.treksoft.kvision.DomSpec
import kotlin.browser.document
@@ -33,7 +33,7 @@ class HelpBlockSpec : DomSpec {
fun render() {
run {
val root = Root("test", fixed = true)
- val fl = HelpBlock("Form Error")
+ val fl = HelpText("Form Error")
root.add(fl)
val element = document.getElementById("test")
assertEqualsHtml(
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 a8fbbcc5..bd0b3993 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
@@ -52,7 +52,7 @@ class RadioSpec : DomSpec {
ci.squared = true
ci.inline = false
assertEqualsHtml(
- "<div class=\"checkbox kv-radio-checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"checked\" name=\"name\" disabled=\"disabled\" value=\"abc\"><label for=\"$id\">Label</label></div>",
+ "<div class=\"checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"checked\" name=\"name\" disabled=\"disabled\" value=\"abc\"><label for=\"$id\">Label</label></div>",
element?.innerHTML,
"Should render correct radio button form control"
)
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 7ce811fa..2bc35a38 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
@@ -49,7 +49,7 @@ class TextSpec : DomSpec {
)
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\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"disabled\" type=\"text\" value=\"abc\"><span class=\"help-block small\">Validation Error</span></div>",
+ "<div class=\"form-group text-danger\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"disabled\" type=\"text\" value=\"abc\"><span class=\"help-block small\">Validation Error</span></div>",
element?.innerHTML,
"Should render correct input form control with validation error"
)
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt
deleted file mode 100644
index 40720bcb..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.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.navbar
-
-import pl.treksoft.kvision.navbar.NavForm
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class NavFormSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val navf = NavForm()
- root.add(navf)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<form class=\"navbar-form navbar-left\"></form>",
- element?.innerHTML,
- "Should render correct nav form"
- )
- navf.rightAlign = true
- assertEqualsHtml(
- "<form class=\"navbar-form navbar-right\"></form>",
- element?.innerHTML,
- "Should render correct right aligned nav form"
- )
-
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt
deleted file mode 100644
index 988a706d..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.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.navbar
-
-import pl.treksoft.kvision.navbar.Nav
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class NavSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val nav = Nav()
- root.add(nav)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<ul class=\"nav navbar-nav\"></ul>",
- element?.innerHTML,
- "Should render correct nav"
- )
- nav.rightAlign = true
- assertEqualsHtml(
- "<ul class=\"nav navbar-nav navbar-right\"></ul>",
- element?.innerHTML,
- "Should render correct right aligned nav"
- )
-
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt
deleted file mode 100644
index f38a05f9..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt
+++ /dev/null
@@ -1,70 +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.navbar
-
-import pl.treksoft.kvision.html.Link.Companion.link
-import pl.treksoft.kvision.html.TAG
-import pl.treksoft.kvision.html.Tag.Companion.tag
-import pl.treksoft.kvision.navbar.Nav
-import pl.treksoft.kvision.navbar.Navbar
-import pl.treksoft.kvision.navbar.NavbarType
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class NavbarSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val navbar = Navbar("TEST", NavbarType.FIXEDTOP)
- root.add(navbar)
- val element = document.getElementById("test")
- val id = navbar.container.id
- assertEqualsHtml(
- "<nav class=\"navbar navbar-fixed-top navbar-default\"><div class=\"container-fluid\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" type=\"button\" data-toggle=\"collapse\" data-target=\"#$id\" aria-expanded=\"false\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"#\">TEST</a></div><div class=\"collapse navbar-collapse\" id=\"$id\"></div></div></nav>",
- element?.innerHTML,
- "Should render correct navbar"
- )
- navbar.inverted = true
- assertEqualsHtml(
- "<nav class=\"navbar navbar-fixed-top navbar-inverse\"><div class=\"container-fluid\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" type=\"button\" data-toggle=\"collapse\" data-target=\"#$id\" aria-expanded=\"false\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"#\">TEST</a></div><div class=\"collapse navbar-collapse\" id=\"$id\"></div></div></nav>",
- element?.innerHTML,
- "Should render correct inverted navbar"
- )
- navbar.add(Nav {
- tag(TAG.LI) {
- link("Test", "#!/test")
- }
- })
- assertEqualsHtml(
- "<nav class=\"navbar navbar-fixed-top navbar-inverse\"><div class=\"container-fluid\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" type=\"button\" data-toggle=\"collapse\" data-target=\"#$id\" aria-expanded=\"false\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"#\">TEST</a></div><div class=\"collapse navbar-collapse\" id=\"$id\"><ul class=\"nav navbar-nav\"><li><a href=\"#!/test\">Test</a></li></ul></div></div></nav>",
- element?.innerHTML,
- "Should render correct navbar with nav link"
- )
-
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
deleted file mode 100644
index fcdf9860..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
+++ /dev/null
@@ -1,50 +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.panel
-
-import pl.treksoft.kvision.html.Span
-import pl.treksoft.kvision.panel.ResponsiveGridPanel
-import pl.treksoft.kvision.panel.Root
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ResponsiveGridPanelSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val rgPanel = ResponsiveGridPanel()
- root.add(rgPanel)
- rgPanel.add(Span("abc"), 1, 1)
- rgPanel.add(Span("def"), 2, 2)
- rgPanel.add(Span("ghi"), 3, 3)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div class=\"container-fluid\"><div class=\"row\"></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>abc</span></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>def</span></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>ghi</span></div></div></div>",
- element?.innerHTML,
- "Should render correct responsive grid panel"
- )
- }
- }
-} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
deleted file mode 100644
index 9335562f..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
+++ /dev/null
@@ -1,117 +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.panel
-
-import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.html.Span
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.panel.TabPanel
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class TabPanelSpec : DomSpec {
-
- @Test
- fun render() {
- 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)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"active\"><a href=\"#\">ABC</a></li><li role=\"presentation\"><a href=\"#\">DEF</a></li></ul><div><span>abc</span></div></div>",
- element?.innerHTML,
- "Should render correct tabs"
- )
- }
- }
-
- @Test
- fun setActiveIndex() {
- 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.activeIndex = 1
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">ABC</a></li><li role=\"presentation\" class=\"active\"><a href=\"#\">DEF</a></li></ul><div><span>def</span></div></div>",
- element?.innerHTML,
- "Should change selected tab"
- )
- }
- }
-
- @Test
- fun removeTab() {
- 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.activeIndex = 1
- tabs.removeTab(1)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">ABC</a></li></ul><div><span>abc</span></div></div>",
- element?.innerHTML,
- "Should remove tab"
- )
- }
- }
-
-
- @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\"><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/progress/ProgressBarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
deleted file mode 100644
index 2f044987..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.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.progress
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.progress.ProgressBar
-import pl.treksoft.kvision.progress.ProgressBarStyle
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ProgressBarSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val progressBar =
- ProgressBar(50, style = ProgressBarStyle.SUCCESS, striped = true, content = "Processing ...")
- root.add(progressBar)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div class=\"progress\"><div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 50%;\">Processing ...</div></div>",
- element?.innerHTML,
- "Should render correct progress bar"
- )
- progressBar.max = 200
- assertEqualsHtml(
- "<div class=\"progress\"><div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"200\" style=\"width: 25%;\">Processing ...</div></div>",
- element?.innerHTML,
- "Should render correct progress bar after max value change"
- )
-
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
deleted file mode 100644
index 4aa14230..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
+++ /dev/null
@@ -1,55 +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.progress
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.progress.ProgressBarStyle
-import pl.treksoft.kvision.progress.ProgressIndicator
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ProgressIndicatorSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val ind = ProgressIndicator(50, style = ProgressBarStyle.SUCCESS, striped = true)
- root.add(ind)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 50%;\"></div>",
- element?.innerHTML,
- "Should render correct progress bar indicator"
- )
- ind.max = 200
- assertEqualsHtml(
- "<div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"200\" style=\"width: 25%;\"></div>",
- element?.innerHTML,
- "Should render correct progress bar indicator after max value change"
- )
-
- }
- }
-
-}
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 997da597..c312040a 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt
@@ -23,6 +23,7 @@ package test.pl.treksoft.kvision.table
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.table.Cell.Companion.cell
+import pl.treksoft.kvision.table.ResponsiveType
import pl.treksoft.kvision.table.Row.Companion.row
import pl.treksoft.kvision.table.Table
import pl.treksoft.kvision.table.TableType
@@ -50,7 +51,7 @@ class TableSpec : DomSpec {
"Should render correct table"
)
table.caption = "Caption"
- table.responsive = true
+ table.responsiveType = ResponsiveType.RESPONSIVE
table.types = setOf(TableType.BORDERED)
val element2 = document.getElementById("test")
assertEqualsHtml(
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt
deleted file mode 100644
index b324b8ab..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.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.toolbar
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.toolbar.ButtonGroup
-import pl.treksoft.kvision.toolbar.ButtonGroupSize
-import pl.treksoft.kvision.toolbar.ButtonGroupStyle
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ButtonGroupSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val group = ButtonGroup()
- root.add(group)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div class=\"btn-group\" role=\"group\"></div>",
- element?.innerHTML,
- "Should render correct button group"
- )
- group.size = ButtonGroupSize.LARGE
- group.style = ButtonGroupStyle.JUSTIFIED
- assertEqualsHtml(
- "<div class=\"btn-group btn-group-lg btn-group-justified\" role=\"group\"></div>",
- element?.innerHTML,
- "Should render correct button group with large and justified buttons"
- )
-
- }
- }
-
-}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt
deleted file mode 100644
index d41ef05e..00000000
--- a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt
+++ /dev/null
@@ -1,47 +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.toolbar
-
-import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.toolbar.Toolbar
-import test.pl.treksoft.kvision.DomSpec
-import kotlin.browser.document
-import kotlin.test.Test
-
-class ToolbarSpec : DomSpec {
-
- @Test
- fun render() {
- run {
- val root = Root("test", fixed = true)
- val toolbar = Toolbar()
- root.add(toolbar)
- val element = document.getElementById("test")
- assertEqualsHtml(
- "<div class=\"btn-toolbar\" role=\"toolbar\"></div>",
- element?.innerHTML,
- "Should render correct toolbar"
- )
- }
- }
-
-}