diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt | 39 | ||||
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt | 29 |
2 files changed, 68 insertions, 0 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt new file mode 100644 index 00000000..c1695d74 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018. Robert Jaros + */ +package test.pl.treksoft.kvision.toolbar + +import pl.treksoft.kvision.panel.Root +import pl.treksoft.kvision.toolbar.ButtonGroup +import pl.treksoft.kvision.toolbar.ButtonGroupSize +import pl.treksoft.kvision.toolbar.ButtonGroupStyle +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class ButtonGroupSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val group = ButtonGroup() + root.add(group) + val element = document.getElementById("test") + assertEqualsHtml( + "<div class=\"btn-group\" role=\"group\"></div>", + element?.innerHTML, + "Should render correct button group" + ) + group.size = ButtonGroupSize.LARGE + group.style = ButtonGroupStyle.JUSTIFIED + assertEqualsHtml( + "<div class=\"btn-group btn-group-lg btn-group-justified\" role=\"group\"></div>", + element?.innerHTML, + "Should render correct button group with large and justified buttons" + ) + + } + } + +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt new file mode 100644 index 00000000..5363640a --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ToolbarSpec.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018. Robert Jaros + */ +package test.pl.treksoft.kvision.toolbar + +import pl.treksoft.kvision.panel.Root +import pl.treksoft.kvision.toolbar.Toolbar +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test + +class ToolbarSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test", true) + val toolbar = Toolbar() + root.add(toolbar) + val element = document.getElementById("test") + assertEqualsHtml( + "<div class=\"btn-toolbar\" role=\"toolbar\"></div>", + element?.innerHTML, + "Should render correct toolbar" + ) + } + } + +} |