From d732f672bfbfa565c6ec4fc037381554de251ad3 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 1 Oct 2017 03:12:58 +0200 Subject: GridPanel, HPanel and VPanel --- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 60 ++++++++++++++++++++++ .../test/pl/treksoft/kvision/tabs/TabsSpec.kt | 60 ---------------------- 2 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt delete mode 100644 src/test/kotlin/test/pl/treksoft/kvision/tabs/TabsSpec.kt (limited to 'src/test') diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt new file mode 100644 index 00000000..4a1f9652 --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -0,0 +1,60 @@ +package test.pl.treksoft.kvision.panel + +import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.panel.TabPanel +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test +import kotlin.test.assertEquals + +class TabPanelSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test") + val tabs = TabPanel() + root.add(tabs) + val label1 = Label("abc") + val label2 = Label("def") + tabs.addTab("ABC", label1) + tabs.addTab("DEF", label2) + val element = document.getElementById("test") + assertEquals("
abc
", element?.innerHTML, "Should render correct tabs") + } + } + + @Test + fun setActiveIndex() { + run { + val root = Root("test") + val tabs = TabPanel() + root.add(tabs) + val label1 = Label("abc") + val label2 = Label("def") + tabs.addTab("ABC", label1) + tabs.addTab("DEF", label2) + tabs.activeIndex = 1 + val element = document.getElementById("test") + assertEquals("
def
", element?.innerHTML, "Should change selected tab") + } + } + + @Test + fun removeTab() { + run { + val root = Root("test") + val tabs = TabPanel() + root.add(tabs) + val label1 = Label("abc") + val label2 = Label("def") + tabs.addTab("ABC", label1) + tabs.addTab("DEF", label2) + tabs.activeIndex = 1 + tabs.removeTab(1) + val element = document.getElementById("test") + assertEquals("
abc
", element?.innerHTML, "Should remove tab") + } + } +} \ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/tabs/TabsSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/tabs/TabsSpec.kt deleted file mode 100644 index 60e2ef60..00000000 --- a/src/test/kotlin/test/pl/treksoft/kvision/tabs/TabsSpec.kt +++ /dev/null @@ -1,60 +0,0 @@ -package test.pl.treksoft.kvision.tabs - -import pl.treksoft.kvision.basic.Label -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.tabs.Tabs -import test.pl.treksoft.kvision.DomSpec -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertEquals - -class TabsSpec : DomSpec { - - @Test - fun render() { - run { - val root = Root("test") - val tabs = Tabs() - root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") - tabs.addTab("ABC", label1) - tabs.addTab("DEF", label2) - val element = document.getElementById("test") - assertEquals("
abc
", element?.innerHTML, "Should render correct tabs") - } - } - - @Test - fun setActiveIndex() { - run { - val root = Root("test") - val tabs = Tabs() - root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") - tabs.addTab("ABC", label1) - tabs.addTab("DEF", label2) - tabs.activeIndex = 1 - val element = document.getElementById("test") - assertEquals("
def
", element?.innerHTML, "Should change selected tab") - } - } - - @Test - fun removeTab() { - run { - val root = Root("test") - val tabs = Tabs() - root.add(tabs) - val label1 = Label("abc") - val label2 = Label("def") - tabs.addTab("ABC", label1) - tabs.addTab("DEF", label2) - tabs.activeIndex = 1 - tabs.removeTab(1) - val element = document.getElementById("test") - assertEquals("
abc
", element?.innerHTML, "Should remove tab") - } - } -} \ No newline at end of file -- cgit