diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-10-07 09:58:14 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-10-07 09:58:14 +0200 |
commit | 04ac8542c218b7ce5199350f0880e8f7cb4252b6 (patch) | |
tree | 4f96d1c3bb8281289b96e2b11eecc404a3c98788 /src/test | |
parent | 6678eec9799681b09e5ac85de1a39596d56de22f (diff) | |
parent | 6b14906f0e35dc522bd1c1a44682d728315cf619 (diff) | |
download | kvision-04ac8542c218b7ce5199350f0880e8f7cb4252b6.tar.gz kvision-04ac8542c218b7ce5199350f0880e8f7cb4252b6.tar.bz2 kvision-04ac8542c218b7ce5199350f0880e8f7cb4252b6.zip |
Merge branch 'bs4'
Diffstat (limited to 'src/test')
22 files changed, 22 insertions, 748 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..785f9a2c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt @@ -21,23 +21,23 @@ */ 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 import kotlin.test.Test -class HelpBlockSpec : DomSpec { +class HelpTextSpec : DomSpec { @Test 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( - "<span class=\"help-block small\">Form Error</span>", + "<small class=\"form-text text-muted\">Form Error</small>", element?.innerHTML, "Should render correct help block" ) 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 16da0c70..2c329ffa 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 @@ -45,7 +45,7 @@ class CheckBoxSpec : DomSpec { val element = document.getElementById("test") val id = ci.input.id assertEqualsHtml( - "<div class=\"checkbox checkbox-danger checkbox-circle checkbox-inline\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"checked\" name=\"name\" disabled=\"disabled\"><label for=\"$id\">Label</label></div>", + "<div class=\"form-check abc-checkbox abc-checkbox-danger abc-checkbox-circle form-check-inline\"><input class=\"form-check-input\" id=\"$id\" type=\"checkbox\" checked=\"checked\" name=\"name\" disabled=\"disabled\"><label class=\"form-check-label\" for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct checkbox form control" ) @@ -53,7 +53,7 @@ class CheckBoxSpec : DomSpec { ci.circled = false ci.inline = false assertEqualsHtml( - "<div class=\"checkbox checkbox-info\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"checked\" name=\"name\" disabled=\"disabled\"><label for=\"$id\">Label</label></div>", + "<div class=\"form-check abc-checkbox abc-checkbox-info\"><input class=\"form-check-input\" id=\"$id\" type=\"checkbox\" checked=\"checked\" name=\"name\" disabled=\"disabled\"><label class=\"form-check-label\" for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct checkbox form control" ) 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 55788c84..020ad529 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 @@ -44,7 +44,7 @@ class RadioGroupInputSpec : DomSpec { val rid1 = ci.getChildren().filterIsInstance<Radio>().first().input.id val rid2 = ci.getChildren().filterIsInstance<Radio>().last().input.id assertEqualsHtml( - "<div class=\"form-group kv-radiogroup-inline\"><div class=\"radio\"><input id=\"$rid1\" type=\"radio\" name=\"$name\" disabled=\"disabled\" value=\"a\"><label for=\"$rid1\">A</label></div><div class=\"radio\"><input id=\"$rid2\" type=\"radio\" name=\"$name\" disabled=\"disabled\" value=\"b\"><label for=\"$rid2\">B</label></div></div>", + "<div class=\"form-group kv-radiogroup-inline\"><div class=\"form-check abc-radio\"><input class=\"form-check-input\" id=\"$rid1\" type=\"radio\" name=\"$name\" disabled=\"disabled\" value=\"a\"><label class=\"form-check-label\" for=\"$rid1\">A</label></div><div class=\"form-check abc-radio\"><input class=\"form-check-input\" id=\"$rid2\" type=\"radio\" name=\"$name\" disabled=\"disabled\" value=\"b\"><label class=\"form-check-label\" for=\"$rid2\">B</label></div></div>", element?.innerHTML, "Should render correct radio button group form control" ) 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 2ed52b67..77547977 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 @@ -41,10 +41,10 @@ class RadioGroupSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.flabel.forId - val rid1 = ci.getChildren().filterIsInstance<Radio>().first().input.id - val rid2 = ci.getChildren().filterIsInstance<Radio>().last().input.id + val rid1 = ci.container.getChildren().filterIsInstance<Radio>().first().input.id + val rid2 = ci.container.getChildren().filterIsInstance<Radio>().last().input.id assertEqualsHtml( - "<div class=\"form-group kv-radiogroup-inline\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"radio\"><input id=\"$rid1\" type=\"radio\" name=\"$id\" disabled=\"disabled\" value=\"a\"><label for=\"$rid1\">A</label></div><div class=\"radio\"><input id=\"$rid2\" type=\"radio\" name=\"$id\" disabled=\"disabled\" value=\"b\"><label for=\"$rid2\">B</label></div></div>", + "<div class=\"form-group kv-radiogroup-inline\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"kv-radiogroup-container\"><div class=\"form-check abc-radio\"><input class=\"form-check-input\" id=\"$rid1\" type=\"radio\" name=\"$id\" disabled=\"disabled\" value=\"a\"><label class=\"form-check-label\" for=\"$rid1\">A</label></div><div class=\"form-check abc-radio\"><input class=\"form-check-input\" id=\"$rid2\" type=\"radio\" name=\"$id\" disabled=\"disabled\" value=\"b\"><label class=\"form-check-label\" for=\"$rid2\">B</label></div></div></div>", element?.innerHTML, "Should render correct radio button group form control" ) 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..c709b548 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 @@ -44,7 +44,7 @@ class RadioSpec : DomSpec { val element = document.getElementById("test") val id = ci.input.id assertEqualsHtml( - "<div class=\"radio radio-danger radio-inline\"><input id=\"$id\" type=\"radio\" checked=\"checked\" name=\"name\" disabled=\"disabled\" value=\"abc\"><label for=\"$id\">Label</label></div>", + "<div class=\"form-check abc-radio abc-radio-danger form-check-inline\"><input class=\"form-check-input\" id=\"$id\" type=\"radio\" checked=\"checked\" name=\"name\" disabled=\"disabled\" value=\"abc\"><label class=\"form-check-label\" for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct radio button form control" ) @@ -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=\"form-check abc-checkbox abc-checkbox-info\"><input class=\"form-check-input\" id=\"$id\" type=\"radio\" checked=\"checked\" name=\"name\" disabled=\"disabled\" value=\"abc\"><label class=\"form-check-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..02ba7643 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 is-invalid\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"disabled\" type=\"text\" value=\"abc\"><div class=\"invalid-feedback\">Validation Error</div></div>", element?.innerHTML, "Should render correct input form control with validation error" ) 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 512c3bc2..e807bfd5 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt @@ -35,13 +35,13 @@ class ButtonSpec : DomSpec { fun render() { run { val root = Root("test", fixed = true) - val button = Button("Cancel", "fa-bars", ButtonStyle.PRIMARY) + val button = Button("Cancel", "fas fa-bars", ButtonStyle.PRIMARY) button.size = ButtonSize.LARGE button.block = true root.add(button) val element = document.getElementById("test") assertEqualsHtml( - "<button class=\"btn btn-primary btn-lg btn-block\" type=\"button\"><i class=\"fa fa-bars\"></i> Cancel</button>", + "<button class=\"btn btn-primary btn-lg btn-block\" type=\"button\"><i class=\"fas fa-bars\"></i> Cancel</button>", element?.innerHTML, "Should render correct html button" ) 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 ea3425c5..9a63c68e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt @@ -33,10 +33,10 @@ class IconSpec : DomSpec { fun render() { run { val root = Root("test", fixed = true) - val icon = Icon("fa-check") + val icon = Icon("fas fa-check") root.add(icon) val element = document.getElementById("test") - assertEqualsHtml("<span class=\"fa fa-check\"></span>", element?.innerHTML, "Should render correct icon") + assertEqualsHtml("<span class=\"fas fa-check\"></span>", element?.innerHTML, "Should render correct icon") } } 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 169575fc..ed3a5347 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt @@ -41,7 +41,7 @@ class ImageSpec : DomSpec { root.add(image) val element = document.getElementById("test") assertEqualsHtml( - "<img class=\"img-responsive center-block img-rounded\" src=\"$res\" alt=\"Image\">", + "<img class=\"img-fluid center-block rounded\" src=\"$res\" alt=\"Image\">", element?.innerHTML, "Should render correct html image" ) 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..69dc05d3 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 @@ -45,16 +46,16 @@ class TableSpec : DomSpec { root.add(table) val element = document.getElementById("test") assertEqualsHtml( - "<table class=\"table\"><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>A</td><td>B</td></tr></tbody></table>", + "<table class=\"table\"><thead><tr><th scope=\"col\">a</th><th scope=\"col\">b</th></tr></thead><tbody><tr><td>A</td><td>B</td></tr></tbody></table>", element?.innerHTML, "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( - "<div class=\"table-responsive\"><table class=\"table table-bordered\"><caption>Caption</caption><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>A</td><td>B</td></tr></tbody></table></div>", + "<div class=\"table-responsive\"><table class=\"table table-bordered\"><caption>Caption</caption><thead><tr><th scope=\"col\">a</th><th scope=\"col\">b</th></tr></thead><tbody><tr><td>A</td><td>B</td></tr></tbody></table></div>", element2?.innerHTML, "Should render correct responsive table" ) 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" - ) - } - } - -} |