From 0fe8352ab057dfbbf690a723b2ccfc15b9977f4a Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Wed, 4 Aug 2021 17:02:31 +0200 Subject: Webhelp-like frontend --- .../kotlin/renderers/html/FormattingUtilsTest.kt | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt (limited to 'plugins/base/src/test/kotlin') 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 = """ + + kotlinx.collections.immutable + + """.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 = """ + + Package org.jetbrains.dokka.it.moduleC + + """.trimIndent() + + val html = createHTML(prettyPrint = true).html { + body { + buildBreakableText(testedText) + } + } + + assertEquals(expectedHtml.trim(), html.trim()) + } +} \ No newline at end of file -- cgit