aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt
blob: 33f86e9fe66905ad6a50d0b97ecd9209dfe86fe3 (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 org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.Test
import org.junit.jupiter.api.Assertions
import utils.TestOutputWriterPlugin
import utils.pagesJson

class SearchbarDataInstallerTest: BaseAbstractTest() {

    @Test // see #2289
    fun `should display description of root declarations without a leading dot`() {
        val configuration = dokkaConfiguration {
            moduleName = "Dokka Module"

            sourceSets {
                sourceSet {
                    sourceRoots = listOf("src/kotlin/Test.kt")
                }
            }
        }

        val source = """
            |/src/kotlin/Test.kt
            |
            |class Test
            |
        """.trimIndent()

        val writerPlugin = TestOutputWriterPlugin()
        testInline(
            source,
            configuration,
            pluginOverrides = listOf(writerPlugin)
        ) {
            renderingStage = { _, _ ->
                val searchRecords = writerPlugin.writer.pagesJson()

                Assertions.assertEquals(
                    "Test",
                    searchRecords.find { record -> record.name == "class Test" }?.description ?: ""
                )
            }
        }
    }
}