From 9589161d9861a1d2eb02df1c5858b3ff67ca0c7a Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Fri, 26 Mar 2021 17:35:44 +0100 Subject: Reintroduce multimodule documentation (#1804) --- .../templates/MultiModuleDocumentationTest.kt | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt (limited to 'plugins/all-modules-page/src/test/kotlin') diff --git a/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt new file mode 100644 index 00000000..11a03bc4 --- /dev/null +++ b/plugins/all-modules-page/src/test/kotlin/templates/MultiModuleDocumentationTest.kt @@ -0,0 +1,65 @@ +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.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.rules.TemporaryFolder +import kotlin.test.assertEquals + +class MultiModuleDocumentationTest : MultiModuleAbstractTest() { + @get:Rule + val folder: TemporaryFolder = TemporaryFolder() + + val documentationContent = """ + # Sample project + Sample documentation with [external link](https://www.google.pl) + """.trimIndent() + + @BeforeEach + fun setup() { + folder.create() + folder.root.resolve("README.md").writeText(documentationContent) + } + + @Test + fun `documentation should be included in all modules page`() { + val configuration = dokkaConfiguration { + includes = listOf(folder.root.resolve("README.md")) + } + + testFromData(configuration, preserveOutputLocation = true) { + 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 + ) + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file -- cgit