From 857afb0fa7e8bdf435e2bb7cb5d951ba29449362 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 7 May 2019 20:42:30 +0200 Subject: Closable tabs in the TabPanel container. --- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/test/kotlin') 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( + "
def
", + element?.innerHTML, + "Should select correct tab by clicking" + ) + } + } } \ No newline at end of file -- cgit