diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-09-02 22:58:49 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-09-02 22:58:49 +0200 |
commit | 64e2bca354a1eb6018086427365336c3acb75cb8 (patch) | |
tree | 0a154d36120fc731d5704d4320af3dba711de37b /src/test | |
parent | 0407e661dced3adcf8386b27738295e285a043a0 (diff) | |
download | kvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.gz kvision-64e2bca354a1eb6018086427365336c3acb75cb8.tar.bz2 kvision-64e2bca354a1eb6018086427365336c3acb75cb8.zip |
Tag widget refactoring
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt | 38 |
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 <b>h1</b></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 |