summaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-02 22:58:49 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-02 22:58:49 +0200
commit64e2bca354a1eb6018086427365336c3acb75cb8 (patch)
tree0a154d36120fc731d5704d4320af3dba711de37b /src/test/kotlin
parent0407e661dced3adcf8386b27738295e285a043a0 (diff)
downloadkvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.gz
kvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.bz2
kvision-64e2bca354a1eb6018086427365336c3acb75cb8.zip
Tag widget refactoring
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt
new file mode 100644
index 00000000..1ba7f97b
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt
@@ -0,0 +1,38 @@
+package test.pl.treksoft.kvision.html
+
+import pl.treksoft.kvision.core.Root
+import pl.treksoft.kvision.html.ALIGN
+import pl.treksoft.kvision.html.TAG
+import pl.treksoft.kvision.html.Tag
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+class TagSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test")
+ val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = false, align = ALIGN.CENTER)
+ root.add(tag)
+ val element = document.getElementById("test")
+ assertEquals("<h1 class=\"text-center\">This is &lt;b&gt;h1&lt;/b&gt;</h1>", element?.innerHTML, "Should render correct html tag")
+ }
+ }
+
+ @Test
+ fun render_rich() {
+ run {
+ val root = Root("test")
+ val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = true, align = ALIGN.CENTER)
+ root.add(tag)
+ val element = document.getElementById("test")
+ assertEquals("<h1 class=\"text-center\"><span>This is <b>h1</b></span></h1>", element?.innerHTML, "Should render correct html tag")
+ }
+ }
+
+
+} \ No newline at end of file