aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-05-07 20:42:30 +0200
committerRobert Jaros <rjaros@finn.pl>2019-05-07 20:42:30 +0200
commit857afb0fa7e8bdf435e2bb7cb5d951ba29449362 (patch)
tree4903fc89115edf8bf7a97330b6d80d33b47b9343 /src/test/kotlin
parente5e523d4a9a5c90156f6dc20410be06bd151eee9 (diff)
downloadkvision-857afb0fa7e8bdf435e2bb7cb5d951ba29449362.tar.gz
kvision-857afb0fa7e8bdf435e2bb7cb5d951ba29449362.tar.bz2
kvision-857afb0fa7e8bdf435e2bb7cb5d951ba29449362.zip
Closable tabs in the TabPanel container.
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
index 900a7268..f1f3beeb 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
@@ -21,6 +21,7 @@
*/
package test.pl.treksoft.kvision.panel
+import pl.treksoft.jquery.jQuery
import pl.treksoft.kvision.html.Span
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.panel.TabPanel
@@ -89,4 +90,28 @@ class TabPanelSpec : DomSpec {
)
}
}
+
+
+ @Test
+ fun tabClick() {
+ run {
+ val root = Root("test", true)
+ val tabs = TabPanel()
+ root.add(tabs)
+ val label1 = Span("abc")
+ val label2 = Span("def")
+ tabs.addTab("ABC", label1)
+ tabs.addTab("DEF", label2)
+ tabs.removeTab(0)
+ val label3 = Span("ghi")
+ tabs.addTab("GHI", label3)
+ jQuery("#test a")[0]?.click()
+ val element = document.getElementById("test")
+ assertEqualsHtml(
+ "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">DEF</a></li><li role=\"presentation\"><a href=\"#\">GHI</a></li></ul><div><span>def</span></div></div>",
+ element?.innerHTML,
+ "Should select correct tab by clicking"
+ )
+ }
+ }
} \ No newline at end of file