From c68c05a1e8876e9b8555df7bcdfeaca3e100f0d1 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Mon, 6 Dec 2021 16:20:51 +0300 Subject: Description list support for JavaDocs (#2213) --- .../transformers/CommentsToContentConverterTest.kt | 57 ++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'plugins/base/src/test/kotlin/transformers') diff --git a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt index 8703a4a9..6d8730f1 100644 --- a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt @@ -1,13 +1,14 @@ package transformers +import matchers.content.* import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.* -import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.Test -import matchers.content.* import org.jetbrains.dokka.pages.* import org.jetbrains.kotlin.utils.addToStdlib.assertedCast +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test class CommentsToContentConverterTest { private val converter = DocTagToContentConverter() @@ -422,4 +423,54 @@ class CommentsToContentConverterTest { } } } + + @Test + fun `description list`() { + val docTag = + Dl( + listOf( + Dt( + listOf( + Text("description list can have...") + ) + ), + Dt( + listOf( + Text("... two consecutive description terms") + ) + ), + Dd( + listOf( + Text("and usually has some sort of a description, like this one") + ) + ) + ) + ) + + executeTest(docTag) { + composite { + check { + assertTrue(style.contains(ListStyle.DescriptionList)) { "Expected DL style" } + } + group { + check { + assertTrue(style.contains(ListStyle.DescriptionTerm)) { "Expected DT style" } + } + +"description list can have..." + } + group { + check { + assertTrue(style.contains(ListStyle.DescriptionTerm)) { "Expected DT style" } + } + +"... two consecutive description terms" + } + group { + check { + assertTrue(style.contains(ListStyle.DescriptionDetails)) { "Expected DD style" } + } + +"and usually has some sort of a description, like this one" + } + } + } + } } \ No newline at end of file -- cgit