aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-03 03:34:26 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-03 03:34:26 +0200
commit2072d1b9c1b9d4f515cc1759b12ca19db7106d82 (patch)
tree8c5ce16b9802d39ea99ee5f7f31f3198201344e2 /src/test
parent70bc6412e0b54119d3f0b6a82c1def78a9088d16 (diff)
downloadkvision-2072d1b9c1b9d4f515cc1759b12ca19db7106d82.tar.gz
kvision-2072d1b9c1b9d4f515cc1759b12ca19db7106d82.tar.bz2
kvision-2072d1b9c1b9d4f515cc1759b12ca19db7106d82.zip
DropDown attributes
Diffstat (limited to 'src/test')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt34
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