aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src/test/kotlin/org
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc/src/test/kotlin/org')
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt69
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt95
2 files changed, 153 insertions, 11 deletions
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
index d192abde..f6b8439f 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
@@ -3,9 +3,10 @@ package org.jetbrains.dokka.javadoc
import org.jetbrains.dokka.javadoc.pages.JavadocModulePageNode
import org.jetbrains.dokka.javadoc.pages.RowJavadocListEntry
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.test.assertIsInstance
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
-import org.jetbrains.dokka.test.assertIsInstance
+import java.io.File
internal class JavadocModuleTemplateMapTest : AbstractJavadocTemplateMapTest() {
@@ -77,4 +78,70 @@ internal class JavadocModuleTemplateMapTest : AbstractJavadocTemplateMapTest() {
assertEquals(DRI("com.test.package1"), assertIsInstance<RowJavadocListEntry>(list[1]).link.dri.single())
}
}
+
+ @Test
+ fun `single class with module documentation (kotlin)`() {
+ testTemplateMapInline(
+ query =
+ """
+ /src/module.md
+ # Module module1
+ ABC
+
+ /src/source0.kt
+ package com.test.package0
+ class Test
+ """,
+ configuration = config.copy(
+ sourceSets = config.sourceSets.map { sourceSet ->
+ sourceSet.copy(
+ includes = setOf(File("src/module.md"))
+ )
+ },
+ moduleName = "module1"
+ )
+ ) {
+ val modulePage = singlePageOfType<JavadocModulePageNode>()
+
+ val map = modulePage.templateMap
+ assertEquals("<p>ABC</p>", map["subtitle"].toString().trim())
+ }
+ }
+
+ @Test
+ fun `single class with long module documentation (kotlin)`() {
+ testTemplateMapInline(
+ query =
+ """
+ /src/module.md
+ # Module module1
+ Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ Omnis qui ducimus ut et perspiciatis sint.
+
+ Veritatis nam eaque sequi laborum voluptas voluptate aut.
+
+ /src/source0.kt
+ package com.test.package0
+ class Test
+ """,
+ configuration = config.copy(
+ sourceSets = config.sourceSets.map { sourceSet ->
+ sourceSet.copy(
+ includes = setOf(File("src/module.md"))
+ )
+ },
+ moduleName = "module1"
+ )
+ ) {
+ val modulePage = singlePageOfType<JavadocModulePageNode>()
+
+ val map = modulePage.templateMap
+ val expectedText = """
+ <p>Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ Omnis qui ducimus ut et perspiciatis sint.</p>
+ <p>Veritatis nam eaque sequi laborum voluptas voluptate aut.</p>
+ """.trimIndent().replace("\n", "")
+ assertEquals(expectedText, map["subtitle"].toString().trim())
+ }
+ }
}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
index 592d7b0d..4a761ca6 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
@@ -4,10 +4,9 @@ import org.jetbrains.dokka.javadoc.pages.JavadocContentKind
import org.jetbrains.dokka.javadoc.pages.JavadocPackagePageNode
import org.jetbrains.dokka.javadoc.pages.RowJavadocListEntry
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.test.assertIsInstance
import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
-import org.jetbrains.dokka.test.assertIsInstance
import java.io.File
internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest() {
@@ -82,11 +81,33 @@ internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest()
}
}
- @Disabled("To be implemented / To be fixed")
@Test
- fun `single class with package documentation`() {
- dualTestTemplateMapInline(
- kotlin =
+ fun `single class with package documentation (java)`() {
+ testTemplateMapInline(
+ query =
+ """
+ /src/com/test/package0/package-info.java
+ /**
+ * ABC
+ */
+ package com.test.package0;
+
+ /src/com/test/package0/Test.java
+ package com.test.package0;
+ public class Test{}
+ """
+ ) {
+ val packagePage = singlePageOfType<JavadocPackagePageNode>()
+
+ val map = packagePage.templateMap
+ assertEquals("<p>ABC</p>", map["subtitle"].toString().trim())
+ }
+ }
+
+ @Test
+ fun `single class with package documentation (kotlin)`() {
+ testTemplateMapInline(
+ query =
"""
/src/packages.md
# Package com.test.package0
@@ -96,23 +117,72 @@ internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest()
package com.test.package0
class Test
""",
+ configuration = config.copy(
+ sourceSets = config.sourceSets.map { sourceSet ->
+ sourceSet.copy(
+ includes = setOf(File("src/packages.md"))
+ )
+ }
+ )
+ ) {
+ val packagePage = singlePageOfType<JavadocPackagePageNode>()
- java =
+ val map = packagePage.templateMap
+ assertEquals("<p>ABC</p>", map["subtitle"].toString().trim())
+ }
+ }
+
+ @Test
+ fun `single class with long package documentation (java)`() {
+ testTemplateMapInline(
+ query =
"""
/src/com/test/package0/package-info.java
/**
- * ABC
+ * Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ * Omnis qui ducimus ut et perspiciatis sint.
+ *
+ * Veritatis nam eaque sequi laborum voluptas voluptate aut.
*/
package com.test.package0;
/src/com/test/package0/Test.java
package com.test.package0;
public class Test{}
+ """
+ ) {
+ val packagePage = singlePageOfType<JavadocPackagePageNode>()
+
+ val map = packagePage.templateMap
+ val expectedText = """
+ <p>Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ Omnis qui ducimus ut et perspiciatis sint.
+ Veritatis nam eaque sequi laborum voluptas voluptate aut.</p>
+ """.trimIndent().replace("\n", "")
+ assertEquals(expectedText, map["subtitle"].toString().trim())
+ }
+ }
+
+ @Test
+ fun `single class with long package documentation (kotlin)`() {
+ testTemplateMapInline(
+ query =
+ """
+ /src/packages.md
+ # Package com.test.package0
+ Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ Omnis qui ducimus ut et perspiciatis sint.
+
+ Veritatis nam eaque sequi laborum voluptas voluptate aut.
+
+ /src/source0.kt
+ package com.test.package0
+ class Test
""",
configuration = config.copy(
sourceSets = config.sourceSets.map { sourceSet ->
sourceSet.copy(
- includes = setOf(File("packages.md"))
+ includes = setOf(File("src/packages.md"))
)
}
)
@@ -120,7 +190,12 @@ internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest()
val packagePage = singlePageOfType<JavadocPackagePageNode>()
val map = packagePage.templateMap
- assertEquals("ABD", map["subtitle"].toString().trim())
+ val expectedText = """
+ <p>Aliquam rerum est vel. Molestiae eos expedita animi repudiandae sed commodi.
+ Omnis qui ducimus ut et perspiciatis sint.</p>
+ <p>Veritatis nam eaque sequi laborum voluptas voluptate aut.</p>
+ """.trimIndent().replace("\n", "")
+ assertEquals(expectedText, map["subtitle"].toString().trim())
}
}
}