From d911caa0200eb045c8e18540b232560d7e00103e Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Wed, 3 Apr 2019 23:23:30 +0200 Subject: Add new dedicated classes for some most used html tags. Deprecate Label. Use Span class instead. --- .../test/pl/treksoft/kvision/html/FooterSpec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H1Spec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H2Spec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H3Spec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H4Spec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H5Spec.kt | 43 ++++++++++++++++++++ .../kotlin/test/pl/treksoft/kvision/html/H6Spec.kt | 43 ++++++++++++++++++++ .../test/pl/treksoft/kvision/html/HeaderSpec.kt | 43 ++++++++++++++++++++ .../test/pl/treksoft/kvision/html/LabelSpec.kt | 43 -------------------- .../kotlin/test/pl/treksoft/kvision/html/PSpec.kt | 43 ++++++++++++++++++++ .../test/pl/treksoft/kvision/html/SectionSpec.kt | 47 ++++++++++++++++++++++ .../test/pl/treksoft/kvision/html/SpanSpec.kt | 43 ++++++++++++++++++++ .../pl/treksoft/kvision/panel/DockPanelSpec.kt | 12 +++--- .../pl/treksoft/kvision/panel/FlexPanelSpec.kt | 8 ++-- .../pl/treksoft/kvision/panel/GridPanelSpec.kt | 8 ++-- .../test/pl/treksoft/kvision/panel/HPanelSpec.kt | 8 ++-- .../kvision/panel/ResponsiveGridPanelSpec.kt | 8 ++-- .../pl/treksoft/kvision/panel/SplitPanelSpec.kt | 6 +-- .../pl/treksoft/kvision/panel/StackPanelSpec.kt | 18 ++++----- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 14 +++---- .../test/pl/treksoft/kvision/panel/VPanelSpec.kt | 8 ++-- 21 files changed, 522 insertions(+), 88 deletions(-) create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt (limited to 'src/test/kotlin') diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt new file mode 100644 index 00000000..6398d95c --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/FooterSpec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.Footer +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class FooterSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val footer = Footer("This is a footer") + root.add(footer) + val element = document.getElementById("test") + assertEqualsHtml("", element?.innerHTML, "Should render correct footer") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt new file mode 100644 index 00000000..6f22b89f --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H1Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H1 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H1Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val h1 = H1("This is h1 header") + root.add(h1) + val element = document.getElementById("test") + assertEqualsHtml("

This is h1 header

", element?.innerHTML, "Should render correct h1") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt new file mode 100644 index 00000000..1ca74077 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H2Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H2 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H2Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val h2 = H2("This is h2 header") + root.add(h2) + val element = document.getElementById("test") + assertEqualsHtml("

This is h2 header

", element?.innerHTML, "Should render correct h2") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt new file mode 100644 index 00000000..a9f58473 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H3Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H3 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H3Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val h3 = H3("This is h3 header") + root.add(h3) + val element = document.getElementById("test") + assertEqualsHtml("

This is h3 header

", element?.innerHTML, "Should render correct h3") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt new file mode 100644 index 00000000..47550459 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H4Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H4 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H4Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val h4 = H4("This is h4 header") + root.add(h4) + val element = document.getElementById("test") + assertEqualsHtml("

This is h4 header

", element?.innerHTML, "Should render correct h4") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt new file mode 100644 index 00000000..6b3fc647 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H5Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H5 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H5Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val h5 = H5("This is h5 header") + root.add(h5) + val element = document.getElementById("test") + assertEqualsHtml("
This is h5 header
", element?.innerHTML, "Should render correct h5") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt new file mode 100644 index 00000000..e22bd401 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/H6Spec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.H1 +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class H6Spec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val div = H1("This is h1 header") + root.add(div) + val element = document.getElementById("test") + assertEqualsHtml("

This is h1 header

", element?.innerHTML, "Should render correct h1") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt new file mode 100644 index 00000000..e5ea8679 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/HeaderSpec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.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", true) + val header = Header("This is a header") + root.add(header) + val element = document.getElementById("test") + assertEqualsHtml("
This is a header
", element?.innerHTML, "Should render correct header") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt deleted file mode 100644 index a9f06349..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt +++ /dev/null @@ -1,43 +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.html - -import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test - -class LabelSpec : DomSpec { - - @Test - fun render() { - run { - val root = Root("test", true) - val label = Label("This is a label") - root.add(label) - val element = document.getElementById("test") - assertEqualsHtml("This is a label", element?.innerHTML, "Should render correct label") - } - } - -} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt new file mode 100644 index 00000000..d5af81e3 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/PSpec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.P +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class PSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val par = P("This is a paragraph") + root.add(par) + val element = document.getElementById("test") + assertEqualsHtml("

This is a paragraph

", element?.innerHTML, "Should render correct paragraph") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.kt new file mode 100644 index 00000000..4fb7a490 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/SectionSpec.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.html + +import pl.treksoft.kvision.html.Section +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class SectionSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val section = Section("This is a section") + root.add(section) + val element = document.getElementById("test") + assertEqualsHtml( + "
This is a section
", + element?.innerHTML, + "Should render correct section" + ) + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt new file mode 100644 index 00000000..b1f49b45 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/SpanSpec.kt @@ -0,0 +1,43 @@ +/* + * 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.html + +import pl.treksoft.kvision.html.Span +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class SpanSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val span = Span("This is a label") + root.add(span) + val element = document.getElementById("test") + assertEqualsHtml("This is a label", element?.innerHTML, "Should render correct span") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt index de4cf43d..d387be56 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.DockPanel import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.Side @@ -37,11 +37,11 @@ class DockPanelSpec : DomSpec { val root = Root("test", true) val dockPanel = DockPanel() root.add(dockPanel) - dockPanel.add(Label("abc"), Side.UP) - dockPanel.add(Label("def"), Side.RIGHT) - dockPanel.add(Label("ghi"), Side.DOWN) - dockPanel.add(Label("jkl"), Side.LEFT) - dockPanel.add(Label("mno"), Side.CENTER) + dockPanel.add(Span("abc"), Side.UP) + dockPanel.add(Span("def"), Side.RIGHT) + dockPanel.add(Span("ghi"), Side.DOWN) + dockPanel.add(Span("jkl"), Side.LEFT) + dockPanel.add(Span("mno"), Side.CENTER) val element = document.getElementById("test") assertEqualsHtml( "
def
jkl
mno
abc
ghi
", diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt index d9074dae..5bcc68f6 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.FlexDir import pl.treksoft.kvision.panel.FlexJustify import pl.treksoft.kvision.panel.FlexPanel @@ -38,9 +38,9 @@ class FlexPanelSpec : DomSpec { val root = Root("test", true) val flexPanel = FlexPanel(FlexDir.ROWREV, justify = FlexJustify.SPACEEVENLY) root.add(flexPanel) - flexPanel.add(Label("abc"), 1) - flexPanel.add(Label("def"), 2) - flexPanel.add(Label("ghi"), 3) + flexPanel.add(Span("abc"), 1) + flexPanel.add(Span("def"), 2) + flexPanel.add(Span("ghi"), 3) val element = document.getElementById("test") assertEqualsHtml( "
abc
def
ghi
", diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt index f244b02f..add3638f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.GridPanel import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec @@ -36,9 +36,9 @@ class GridPanelSpec : DomSpec { val root = Root("test", true) val gridPanel = GridPanel() root.add(gridPanel) - gridPanel.add(Label("abc"), 1, 1) - gridPanel.add(Label("def"), 2, 2) - gridPanel.add(Label("ghi"), 3, 3) + gridPanel.add(Span("abc"), 1, 1) + gridPanel.add(Span("def"), 2, 2) + gridPanel.add(Span("ghi"), 3, 3) val element = document.getElementById("test") assertEqualsHtml( "
abc
def
ghi
", diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt index da403d44..a185420c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.FlexJustify import pl.treksoft.kvision.panel.HPanel import pl.treksoft.kvision.panel.Root @@ -37,9 +37,9 @@ class HPanelSpec : DomSpec { val root = Root("test", true) val hPanel = HPanel(justify = FlexJustify.SPACEBETWEEN) root.add(hPanel) - hPanel.add(Label("abc"), 1) - hPanel.add(Label("def"), 2) - hPanel.add(Label("ghi"), 3) + hPanel.add(Span("abc"), 1) + hPanel.add(Span("def"), 2) + hPanel.add(Span("ghi"), 3) val element = document.getElementById("test") assertEqualsHtml( "
abc
def
ghi
", diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt index b2e2d4e3..eb710cef 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.ResponsiveGridPanel import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec @@ -36,9 +36,9 @@ class ResponsiveGridPanelSpec : DomSpec { val root = Root("test", true) val rgPanel = ResponsiveGridPanel() root.add(rgPanel) - rgPanel.add(Label("abc"), 1, 1) - rgPanel.add(Label("def"), 2, 2) - rgPanel.add(Label("ghi"), 3, 3) + 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
", diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt index bbe95f30..09c397ce 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.Direction import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.SplitPanel @@ -37,8 +37,8 @@ class SplitPanelSpec : DomSpec { val root = Root("test", true) val splitPanel = SplitPanel(Direction.VERTICAL) root.add(splitPanel) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") splitPanel.add(label1) splitPanel.add(label2) val element = document.getElementById("test") diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt index f8d20984..f52b6486 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.StackPanel import test.pl.treksoft.kvision.DomSpec @@ -36,8 +36,8 @@ class StackPanelSpec : DomSpec { val root = Root("test", true) val stackPanel = StackPanel() root.add(stackPanel) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") stackPanel.add(label1) stackPanel.add(label2) val element = document.getElementById("test") @@ -51,8 +51,8 @@ class StackPanelSpec : DomSpec { val root = Root("test", true) val stackPanel = StackPanel(activateLast = false) root.add(stackPanel) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") stackPanel.add(label1) stackPanel.add(label2) val element = document.getElementById("test") @@ -70,8 +70,8 @@ class StackPanelSpec : DomSpec { val root = Root("test", true) val stackPanel = StackPanel(activateLast = false) root.add(stackPanel) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") stackPanel.add(label1) stackPanel.add(label2) stackPanel.remove(label1) @@ -86,8 +86,8 @@ class StackPanelSpec : DomSpec { val root = Root("test", true) val stackPanel = StackPanel(activateLast = false) root.add(stackPanel) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") stackPanel.add(label1) stackPanel.add(label2) stackPanel.removeAll() diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt index c6e3a942..900a7268 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.TabPanel import test.pl.treksoft.kvision.DomSpec @@ -36,8 +36,8 @@ class TabPanelSpec : DomSpec { val root = Root("test", true) val tabs = TabPanel() root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") tabs.addTab("ABC", label1) tabs.addTab("DEF", label2) val element = document.getElementById("test") @@ -55,8 +55,8 @@ class TabPanelSpec : DomSpec { val root = Root("test", true) val tabs = TabPanel() root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") tabs.addTab("ABC", label1) tabs.addTab("DEF", label2) tabs.activeIndex = 1 @@ -75,8 +75,8 @@ class TabPanelSpec : DomSpec { val root = Root("test", true) val tabs = TabPanel() root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") + val label1 = Span("abc") + val label2 = Span("def") tabs.addTab("ABC", label1) tabs.addTab("DEF", label2) tabs.activeIndex = 1 diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt index 61a89fea..81ea720d 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt @@ -21,7 +21,7 @@ */ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.html.Span import pl.treksoft.kvision.panel.FlexJustify import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.VPanel @@ -37,9 +37,9 @@ class VPanelSpec : DomSpec { val root = Root("test", true) val vPanel = VPanel(justify = FlexJustify.SPACEBETWEEN) root.add(vPanel) - vPanel.add(Label("abc"), 1) - vPanel.add(Label("def"), 2) - vPanel.add(Label("ghi"), 3) + vPanel.add(Span("abc"), 1) + vPanel.add(Span("def"), 2) + vPanel.add(Span("ghi"), 3) val element = document.getElementById("test") assertEqualsHtml( "
abc
def
ghi
", -- cgit