blob: 3d9636ef9ef8e98cdbf7a3fa19c403227e5af4c5 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package org.jetbrains.dokka.allModulesPage.templates
import matchers.content.*
import org.jetbrains.dokka.allModulesPage.MultiModuleAbstractTest
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentResolvedLink
import org.jetbrains.dokka.pages.MultimoduleRootPageNode
import org.junit.jupiter.api.io.TempDir
import java.io.File
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
class MultiModuleDocumentationTest : MultiModuleAbstractTest() {
@field:TempDir
lateinit var tempDir: File
val documentationContent = """
# Sample project
Sample documentation with [external link](https://www.google.pl)
""".trimIndent()
@BeforeTest
fun setup() {
tempDir.resolve("README.md").writeText(documentationContent)
}
@AfterTest
fun teardown(){
tempDir.resolve("README.md").delete()
}
@Test
fun `documentation should be included in all modules page`() {
val configuration = dokkaConfiguration {
includes = listOf(tempDir.resolve("README.md"))
}
testFromData(configuration) {
allModulesPageCreationStage = { rootPage ->
(rootPage as? MultimoduleRootPageNode)?.content?.dfs { it.dci.kind == ContentKind.Cover }?.children?.firstOrNull()
?.assertNode {
group {
group {
group {
header(1) {
+"Sample project"
}
group {
+"Sample documentation with "
link {
+"external link"
check {
assertEquals(
"https://www.google.pl",
(this as ContentResolvedLink).address
)
}
}
}
}
}
}
}
}
}
}
}
|