diff options
Diffstat (limited to 'src/test/kotlin')
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt index fec45a47..23caf3a7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt @@ -1,6 +1,7 @@ package test.pl.treksoft.kvision.dropdown import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.dropdown.DD import pl.treksoft.kvision.dropdown.DropDown import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document @@ -31,4 +32,37 @@ class DropDownSpec : DomSpec { } } + @Test + fun render_HeaderElement() { + run { + val root = Root("test") + val dd = DropDown("Dropdown", listOf("abc" to DD.HEADER.POS), "flag") + root.add(dd) + val element = document.getElementById("test") + assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"kv_dropdown_2\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"kv_dropdown_2\"><li class=\"dropdown-header\">abc</li></ul></div>", element?.innerHTML, "Should render correct drop down") + } + } + + @Test + fun render_SeparatorElement() { + run { + val root = Root("test") + val dd = DropDown("Dropdown", listOf("abc" to DD.SEPARATOR.POS), "flag") + root.add(dd) + val element = document.getElementById("test") + assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"kv_dropdown_3\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"kv_dropdown_3\"><li class=\"divider\" role=\"separator\">abc</li></ul></div>", element?.innerHTML, "Should render correct drop down") + } + } + + @Test + fun render_DisabledElement() { + run { + val root = Root("test") + val dd = DropDown("Dropdown", listOf("abc" to DD.DISABLED.POS), "flag") + root.add(dd) + val element = document.getElementById("test") + assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"kv_dropdown_4\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"kv_dropdown_4\"><li class=\"disabled\"><a href=\"#\">abc</a></li></ul></div>", element?.innerHTML, "Should render correct drop down") + } + } + }
\ No newline at end of file |