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. --- src/main/kotlin/pl/treksoft/kvision/html/Footer.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H1.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H2.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H3.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H4.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H5.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/H6.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/Header.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/Label.kt | 5 +- src/main/kotlin/pl/treksoft/kvision/html/P.kt | 68 ++++++++++++++++++++++ .../kotlin/pl/treksoft/kvision/html/Section.kt | 68 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/html/Span.kt | 68 ++++++++++++++++++++++ .../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 +-- 33 files changed, 1274 insertions(+), 89 deletions(-) create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/Footer.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H1.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H2.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H3.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H4.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H5.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/H6.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/Header.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/P.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/Section.kt create mode 100644 src/main/kotlin/pl/treksoft/kvision/html/Span.kt 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 diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt b/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt new file mode 100644 index 00000000..8b44dfc0 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *footer*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class Footer( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Footer.() -> Unit)? = null +) : + Tag(TAG.FOOTER, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.footer( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Footer.() -> Unit)? = null + ): Footer { + val footer = Footer(content, rich, align, classes).apply { init?.invoke(this) } + this.add(footer) + return footer + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H1.kt b/src/main/kotlin/pl/treksoft/kvision/html/H1.kt new file mode 100644 index 00000000..894baf72 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H1.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h1*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H1( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H1.() -> Unit)? = null +) : + Tag(TAG.H1, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h1( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H1.() -> Unit)? = null + ): H1 { + val h1 = H1(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h1) + return h1 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H2.kt b/src/main/kotlin/pl/treksoft/kvision/html/H2.kt new file mode 100644 index 00000000..54e12b4a --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H2.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h2*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H2( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H2.() -> Unit)? = null +) : + Tag(TAG.H2, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h2( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H2.() -> Unit)? = null + ): H2 { + val h2 = H2(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h2) + return h2 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H3.kt b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt new file mode 100644 index 00000000..af71cdc5 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h3*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H3( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H3.() -> Unit)? = null +) : + Tag(TAG.H3, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h3( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H3.() -> Unit)? = null + ): H3 { + val h3 = H3(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h3) + return h3 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H4.kt b/src/main/kotlin/pl/treksoft/kvision/html/H4.kt new file mode 100644 index 00000000..9c1b92ab --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H4.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h4*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H4( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H4.() -> Unit)? = null +) : + Tag(TAG.H4, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h4( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H4.() -> Unit)? = null + ): H4 { + val h4 = H4(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h4) + return h4 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H5.kt b/src/main/kotlin/pl/treksoft/kvision/html/H5.kt new file mode 100644 index 00000000..ac993c4d --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H5.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h5*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H5( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H5.() -> Unit)? = null +) : + Tag(TAG.H5, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h5( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H5.() -> Unit)? = null + ): H5 { + val h5 = H5(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h5) + return h5 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H6.kt b/src/main/kotlin/pl/treksoft/kvision/html/H6.kt new file mode 100644 index 00000000..eaef18ff --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/H6.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *h6*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class H6( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H6.() -> Unit)? = null +) : + Tag(TAG.H6, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.h6( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (H6.() -> Unit)? = null + ): H6 { + val h6 = H6(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h6) + return h6 + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Header.kt b/src/main/kotlin/pl/treksoft/kvision/html/Header.kt new file mode 100644 index 00000000..94a9c079 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/Header.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *header*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class Header( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Header.() -> Unit)? = null +) : + Tag(TAG.HEADER, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.header( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Header.() -> Unit)? = null + ): Header { + val header = Header(content, rich, align, classes).apply { init?.invoke(this) } + this.add(header) + return header + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Label.kt b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt index 41406cf2..827c90fd 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Label.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt @@ -30,13 +30,16 @@ import pl.treksoft.kvision.core.Container * @param content label text * @param rich determines if [content] can contain HTML code */ -open class Label(content: String? = null, rich: Boolean = false) : Tag(TAG.SPAN, content, rich) { +@Deprecated("Use Span class instead.") +open class Label(content: String? = null, rich: Boolean = false) : Span(content, rich) { companion object { /** * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ + @Deprecated("User Span.Companion.span function instead.") + @Suppress("DEPRECATION") fun Container.label( content: String? = null, rich: Boolean = false, init: (Label.() -> Unit)? = null ): Label { diff --git a/src/main/kotlin/pl/treksoft/kvision/html/P.kt b/src/main/kotlin/pl/treksoft/kvision/html/P.kt new file mode 100644 index 00000000..feadc54a --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/P.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *p*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class P( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (P.() -> Unit)? = null +) : + Tag(TAG.P, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.p( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (P.() -> Unit)? = null + ): P { + val p = P(content, rich, align, classes).apply { init?.invoke(this) } + this.add(p) + return p + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Section.kt b/src/main/kotlin/pl/treksoft/kvision/html/Section.kt new file mode 100644 index 00000000..94413943 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/Section.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *section*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class Section( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Section.() -> Unit)? = null +) : + Tag(TAG.SECTION, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.section( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Section.() -> Unit)? = null + ): Section { + val section = Section(content, rich, align, classes).apply { init?.invoke(this) } + this.add(section) + return section + } + } +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Span.kt b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt new file mode 100644 index 00000000..bc5e93cd --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt @@ -0,0 +1,68 @@ +/* + * 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 pl.treksoft.kvision.html + +import pl.treksoft.kvision.core.Container + +/** + * Simple component rendered as *span*. + * + * @constructor + * @param content element text + * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function + */ +open class Span( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Span.() -> Unit)? = null +) : + Tag(TAG.SPAN, content, rich, align, classes) { + + init { + @Suppress("LeakingThis") + init?.invoke(this) + } + + companion object { + /** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ + fun Container.span( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set = setOf(), + init: (Span.() -> Unit)? = null + ): Span { + val span = Span(content, rich, align, classes).apply { init?.invoke(this) } + this.add(span) + return span + } + } +} 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("
This is a footer
", 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