diff options
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r-- | plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt index fa1e30f6..c77a78fb 100644 --- a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt @@ -31,7 +31,43 @@ class FormattingUtilsTest { 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> + <body><span><span>Package</span></span> <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()) + } + + @Test + fun `should build breakable text for text with braces`(){ + val testedText = "[Common]kotlinx.collections.immutable" + val expectedHtml = """ + <html> + <body><span>[Common]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 for camel case notation`(){ + val testedText = "DokkkkkkkaIsTheBest" + val expectedHtml = """ + <html> + <body><span>Dokkkkkkka</span><wbr></wbr><span>Is</span><wbr></wbr><span>The</span><wbr></wbr><span><span>Best</span></span></body> </html> """.trimIndent() |