aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-28 13:55:54 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-28 13:55:54 +0100
commitc8922a145826834a0be8059cb5b8c6fd5da593dd (patch)
tree2c88740971796734cabec2641f10c17826860aae /src/test/kotlin
parent9f1bc01e0e42a92cdfc483037df89ca28069abdd (diff)
downloadkvision-c8922a145826834a0be8059cb5b8c6fd5da593dd.tar.gz
kvision-c8922a145826834a0be8059cb5b8c6fd5da593dd.tar.bz2
kvision-c8922a145826834a0be8059cb5b8c6fd5da593dd.zip
More stable DropDown implementation
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt18
1 files changed, 9 insertions, 9 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 cd4f8930..41931abd 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt
@@ -21,7 +21,7 @@ class DropDownSpec : DomSpec {
val element = document.getElementById("test")
val id = dd.button.id
assertEquals(
- "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>",
+ "<div class=\"dropdown open\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\" aria-expanded=\"true\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>",
element?.innerHTML,
"Should render correct drop down"
)
@@ -38,7 +38,7 @@ class DropDownSpec : DomSpec {
val element = document.getElementById("test")
val id = dd.button.id
assertEquals(
- "<div class=\"dropup\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>",
+ "<div class=\"dropup open\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\" aria-expanded=\"true\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>",
element?.innerHTML,
"Should render correct drop down"
)
@@ -55,7 +55,7 @@ class DropDownSpec : DomSpec {
val element = document.getElementById("test")
val id = dd.button.id
assertEquals(
- "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\"><li class=\"dropdown-header\">abc</li></ul></div>",
+ "<div class=\"dropdown open\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\" aria-expanded=\"true\"><li class=\"dropdown-header\">abc</li></ul></div>",
element?.innerHTML,
"Should render correct drop down"
)
@@ -72,7 +72,7 @@ class DropDownSpec : DomSpec {
val element = document.getElementById("test")
val id = dd.button.id
assertEquals(
- "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\"><li class=\"divider\" role=\"separator\">abc</li></ul></div>",
+ "<div class=\"dropdown open\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\" aria-expanded=\"true\"><li class=\"divider\" role=\"separator\">abc</li></ul></div>",
element?.innerHTML,
"Should render correct drop down"
)
@@ -89,7 +89,7 @@ class DropDownSpec : DomSpec {
val element = document.getElementById("test")
val id = dd.button.id
assertEquals(
- "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\"><li class=\"disabled\"><a href=\"#\">abc</a></li></ul></div>",
+ "<div class=\"dropdown open\"><button class=\"dropdown btn btn-default\" id=\"$id\" 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=\"$id\" aria-expanded=\"true\"><li class=\"disabled\"><a href=\"#\">abc</a></li></ul></div>",
element?.innerHTML,
"Should render correct drop down"
)
@@ -102,11 +102,11 @@ class DropDownSpec : DomSpec {
val root = Root("test")
val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag")
root.add(dd)
- val menu = dd.list.getElementJQuery()
- assertTrue("Dropdown menu is not rendered before toggle") { menu == null }
+ val visible = dd.getElementJQuery()?.hasClass("open") ?: false
+ assertTrue("Dropdown menu is not visible before toggle") { !visible }
dd.toggle()
- val menu2 = dd.list.getElementJQuery()
- assertTrue("Dropdown menu is rendered after toggle") { menu2 != null }
+ val visible2 = dd.getElementJQuery()?.hasClass("open") ?: false
+ assertTrue("Dropdown menu is visible after toggle") { visible2 }
}
}
} \ No newline at end of file