diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-05-09 23:54:44 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-05-09 23:54:44 +0200 |
commit | 69a8b03ba9668be257e2db375d6ee58e51e367b7 (patch) | |
tree | a1accbde7781574c25292273de073c5231e769e3 /src/test/kotlin | |
parent | 134cb687c4e05fd81a03b682505f9fb9d741a8d7 (diff) | |
download | kvision-69a8b03ba9668be257e2db375d6ee58e51e367b7.tar.gz kvision-69a8b03ba9668be257e2db375d6ee58e51e367b7.tar.bz2 kvision-69a8b03ba9668be257e2db375d6ee58e51e367b7.zip |
Add missing tests for new html components
Diffstat (limited to 'src/test/kotlin')
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/LiSpec.kt | 43 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/ListTagSpec.kt (renamed from src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt) | 2 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/NavSpec.kt | 43 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/OlSpec.kt | 47 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/UlSpec.kt | 47 |
5 files changed, 181 insertions, 1 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LiSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LiSpec.kt new file mode 100644 index 00000000..6f18f60b --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LiSpec.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.Li +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class LiSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", containerType = pl.treksoft.kvision.panel.ContainerType.FIXED) + val li = Li("This is li element") + root.add(li) + val element = document.getElementById("test") + assertEqualsHtml("<li>This is li element</li>", element?.innerHTML, "Should render correct li element") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ListTagSpec.kt index 622b11e5..4ade5fc7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ListTagSpec.kt @@ -30,7 +30,7 @@ import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -class ListSpec : DomSpec { +class ListTagSpec : DomSpec { @Test fun renderElements() { diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/NavSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/NavSpec.kt new file mode 100644 index 00000000..a299fe43 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/NavSpec.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.Nav +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class NavSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", containerType = pl.treksoft.kvision.panel.ContainerType.FIXED) + val nav = Nav("This is nav element") + root.add(nav) + val element = document.getElementById("test") + assertEqualsHtml("<nav>This is nav element</nav>", element?.innerHTML, "Should render correct nav element") + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/OlSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/OlSpec.kt new file mode 100644 index 00000000..eeb5e5da --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/OlSpec.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.Ol +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class OlSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", containerType = pl.treksoft.kvision.panel.ContainerType.FIXED) + val ol = Ol(listOf("first", "second")) + root.add(ol) + val element = document.getElementById("test") + assertEqualsHtml( + "<ol><li>first</li><li>second</li></ol>", + element?.innerHTML, + "Should render correct ol list" + ) + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/UlSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/UlSpec.kt new file mode 100644 index 00000000..5efcb7b9 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/UlSpec.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.Ul +import pl.treksoft.kvision.panel.Root +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class UlSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", containerType = pl.treksoft.kvision.panel.ContainerType.FIXED) + val ul = Ul(listOf("first", "second")) + root.add(ul) + val element = document.getElementById("test") + assertEqualsHtml( + "<ul><li>first</li><li>second</li></ul>", + element?.innerHTML, + "Should render correct ul list" + ) + } + } + +} |