blob: fa1e30f676ff51478cdb549e296e66b16d9aa54c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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())
}
}
|