diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-06-30 16:44:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 16:44:20 +0300 |
commit | 12a386bb7185f862a1cbd831e6856c4235953833 (patch) | |
tree | 9fcfaba5bf87587e008fb9feb52264618e4180a2 /plugins/base/src/test/kotlin/content/functions | |
parent | 26112637ba3511afc218fbe0ead6f72421ac7c77 (diff) | |
download | dokka-12a386bb7185f862a1cbd831e6856c4235953833.tar.gz dokka-12a386bb7185f862a1cbd831e6856c4235953833.tar.bz2 dokka-12a386bb7185f862a1cbd831e6856c4235953833.zip |
Generate dedicated pages for typealiases (#3051)
Diffstat (limited to 'plugins/base/src/test/kotlin/content/functions')
-rw-r--r-- | plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt b/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt index f86506af..c09a0e4d 100644 --- a/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt +++ b/plugins/base/src/test/kotlin/content/functions/ContentForBriefTest.kt @@ -4,6 +4,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.TypeConstructor import org.jetbrains.dokka.model.DClass +import org.jetbrains.dokka.model.DPackage import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.pages.* import org.junit.jupiter.api.Assertions.assertEquals @@ -132,6 +133,32 @@ class ContentForBriefTest : BaseAbstractTest() { } @Test + fun `brief should work for typealias`() { + testInline( + """ + |/src/main/kotlin/test/source.kt + |package test + | + |/** + |* This is an example <!-- not visible --> of html + |* + |* This is definitely not a brief + |*/ + |typealias A = Int + """.trimIndent(), + testConfiguration + ) { + pagesTransformationStage = { module -> + val functionBriefDocs = module.singleTypeAliasesDescription("test") + + assertEquals( + "This is an example <!-- not visible --> of html", + functionBriefDocs.children.joinToString("") { (it as ContentText).text }) + } + } + } + + @Test fun `brief for functions should work with html`() { testInline( """ @@ -344,4 +371,14 @@ class ContentForBriefTest : BaseAbstractTest() { val function = functionsTable.children.first() return function.dfs { it is ContentGroup && it.dci.kind == ContentKind.Comment && it.children.all { it is ContentText } } as ContentGroup } + private fun RootPageNode.singleTypeAliasesDescription(packageName: String): ContentGroup { + val packagePage = + dfs { it.name == packageName && (it as WithDocumentables).documentables.firstOrNull() is DPackage } as ContentPage + val contentTable = + packagePage.content.dfs { it is ContentTable && it.dci.kind == ContentKind.Classlikes } as ContentTable + + assertEquals(1, contentTable.children.size) + val row = contentTable.children.first() + return row.dfs { it is ContentGroup && it.dci.kind == ContentKind.Comment && it.children.all { it is ContentText } } as ContentGroup + } }
\ No newline at end of file |