From 6b53324c97bfc80ed14dfca6a5dbc879950715b9 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 3 Oct 2019 19:03:21 +0200 Subject: Upgrade to Bootstrap 4. Upgrade to Font Awesome 5. Restructure modules. --- .../treksoft/kvision/dropdown/ContextMenuSpec.kt | 75 ------------- .../pl/treksoft/kvision/dropdown/HeaderSpec.kt | 46 -------- .../pl/treksoft/kvision/dropdown/SeparatorSpec.kt | 46 -------- .../test/pl/treksoft/kvision/form/HelpBlockSpec.kt | 47 --------- .../test/pl/treksoft/kvision/form/HelpTextSpec.kt | 47 +++++++++ .../pl/treksoft/kvision/form/check/RadioSpec.kt | 2 +- .../test/pl/treksoft/kvision/form/text/TextSpec.kt | 2 +- .../test/pl/treksoft/kvision/navbar/NavFormSpec.kt | 54 ---------- .../test/pl/treksoft/kvision/navbar/NavSpec.kt | 54 ---------- .../test/pl/treksoft/kvision/navbar/NavbarSpec.kt | 70 ------------ .../kvision/panel/ResponsiveGridPanelSpec.kt | 50 --------- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 117 --------------------- .../treksoft/kvision/progress/ProgressBarSpec.kt | 56 ---------- .../kvision/progress/ProgressIndicatorSpec.kt | 55 ---------- .../test/pl/treksoft/kvision/table/TableSpec.kt | 3 +- .../pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt | 57 ---------- .../pl/treksoft/kvision/toolbar/ToolbarSpec.kt | 47 --------- 17 files changed, 51 insertions(+), 777 deletions(-) delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt (limited to 'src/test') 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( - "", - 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( - "", - 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( - "
  • Test
  • ", - 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( - "
  • ", - 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/HelpBlockSpec.kt deleted file mode 100644 index c7c4ede5..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.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.form - -import pl.treksoft.kvision.form.HelpBlock -import pl.treksoft.kvision.panel.Root -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test - -class HelpBlockSpec : DomSpec { - - @Test - fun render() { - run { - val root = Root("test", fixed = true) - val fl = HelpBlock("Form Error") - root.add(fl) - val element = document.getElementById("test") - assertEqualsHtml( - "Form Error", - element?.innerHTML, - "Should render correct help block" - ) - } - } - -} \ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt new file mode 100644 index 00000000..4be84d22 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package test.pl.treksoft.kvision.form + +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 { + + @Test + fun render() { + run { + val root = Root("test", fixed = true) + val fl = HelpText("Form Error") + root.add(fl) + val element = document.getElementById("test") + assertEqualsHtml( + "Form Error", + element?.innerHTML, + "Should render correct help block" + ) + } + } + +} \ No newline at end of file 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( - "
    ", + "
    ", 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( - "
    Validation Error
    ", + "
    Validation Error
    ", 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( - "
    ", - element?.innerHTML, - "Should render correct nav form" - ) - navf.rightAlign = true - assertEqualsHtml( - "
    ", - 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( - "", - element?.innerHTML, - "Should render correct nav" - ) - nav.rightAlign = true - assertEqualsHtml( - "", - 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( - "", - element?.innerHTML, - "Should render correct navbar" - ) - navbar.inverted = true - assertEqualsHtml( - "", - element?.innerHTML, - "Should render correct inverted navbar" - ) - navbar.add(Nav { - tag(TAG.LI) { - link("Test", "#!/test") - } - }) - assertEqualsHtml( - "", - 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( - "
    abc
    def
    ghi
    ", - 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( - "
    abc
    ", - 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( - "
    def
    ", - 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( - "
    abc
    ", - 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( - "
    def
    ", - 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( - "
    Processing ...
    ", - element?.innerHTML, - "Should render correct progress bar" - ) - progressBar.max = 200 - assertEqualsHtml( - "
    Processing ...
    ", - 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( - "
    ", - element?.innerHTML, - "Should render correct progress bar indicator" - ) - ind.max = 200 - assertEqualsHtml( - "
    ", - 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( - "
    ", - element?.innerHTML, - "Should render correct button group" - ) - group.size = ButtonGroupSize.LARGE - group.style = ButtonGroupStyle.JUSTIFIED - assertEqualsHtml( - "
    ", - 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( - "
    ", - element?.innerHTML, - "Should render correct toolbar" - ) - } - } - -} -- cgit