diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-08-04 17:02:31 +0200 |
---|---|---|
committer | Marcin Aman <marcin.aman@gmail.com> | 2021-08-12 13:21:40 +0200 |
commit | 0fe8352ab057dfbbf690a723b2ccfc15b9977f4a (patch) | |
tree | 7017e7169950f907206832c862dce5e711e3cae8 /plugins/base/src/test/kotlin/renderers/html | |
parent | 42c0320e0c5f2d79a5438558bb87d4668aa4c3cc (diff) | |
download | dokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.tar.gz dokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.tar.bz2 dokka-0fe8352ab057dfbbf690a723b2ccfc15b9977f4a.zip |
Webhelp-like frontend
Diffstat (limited to 'plugins/base/src/test/kotlin/renderers/html')
-rw-r--r-- | plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt new file mode 100644 index 00000000..fa1e30f6 --- /dev/null +++ b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt @@ -0,0 +1,46 @@ +package renderers.html + +import junit.framework.Assert.assertEquals +import kotlinx.html.body +import kotlinx.html.html +import kotlinx.html.stream.createHTML +import org.jetbrains.dokka.base.renderers.html.buildBreakableText +import org.junit.jupiter.api.Test + +class FormattingUtilsTest { + @Test + fun `should build breakable text`(){ + val testedText = "kotlinx.collections.immutable" + val expectedHtml = """ + <html> + <body><span>kotlinx.</span><wbr></wbr><span>collections.</span><wbr></wbr><span>immutable</span></body> + </html> + """.trimIndent() + + val html = createHTML(prettyPrint = true).html { + body { + buildBreakableText(testedText) + } + } + + assertEquals(expectedHtml.trim(), html.trim()) + } + + @Test + fun `should build breakable text without empty spans`(){ + val testedText = "Package org.jetbrains.dokka.it.moduleC" + val expectedHtml = """ + <html> + <body><span>Package</span><wbr></wbr> <span>org.</span><wbr></wbr><span>jetbrains.</span><wbr></wbr><span>dokka.</span><wbr></wbr><span>it.</span><wbr></wbr><span>moduleC</span></body> + </html> + """.trimIndent() + + val html = createHTML(prettyPrint = true).html { + body { + buildBreakableText(testedText) + } + } + + assertEquals(expectedHtml.trim(), html.trim()) + } +}
\ No newline at end of file |