diff options
Diffstat (limited to 'plugins/javadoc/src/test/kotlin/javadoc/JavadocAllClassesTemplateMapTest.kt')
-rw-r--r-- | plugins/javadoc/src/test/kotlin/javadoc/JavadocAllClassesTemplateMapTest.kt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/javadoc/src/test/kotlin/javadoc/JavadocAllClassesTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/javadoc/JavadocAllClassesTemplateMapTest.kt new file mode 100644 index 00000000..314ba0a3 --- /dev/null +++ b/plugins/javadoc/src/test/kotlin/javadoc/JavadocAllClassesTemplateMapTest.kt @@ -0,0 +1,49 @@ +package javadoc + +import javadoc.pages.AllClassesPage +import javadoc.pages.LinkJavadocListEntry +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.pages.ContentKind +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import testApi.utils.assertIsInstance + +internal class JavadocAllClassesTemplateMapTest : AbstractJavadocTemplateMapTest() { + @Test + fun `two classes from different packages`() { + dualTestTemplateMapInline( + """ + /src/source0.kt + package package0 + /** + * Documentation for ClassA + */ + class ClassA + + /src/source1.kt + package package1 + /** + * Documentation for ClassB + */ + class ClassB + """ + ) { + val map = singlePageOfType<AllClassesPage>().templateMap + assertEquals("main", map["kind"]) + assertEquals("All Classes", map["title"]) + + val list = assertIsInstance<List<*>>(map["list"]) + assertEquals(2, list.size, "Expected two classes") + + val classA = assertIsInstance<LinkJavadocListEntry>(list[0]) + assertEquals("ClassA", classA.name) + assertEquals(DRI("package0", "ClassA"), classA.dri.single()) + assertEquals(ContentKind.Classlikes, classA.kind) + + val classB = assertIsInstance<LinkJavadocListEntry>(list[1]) + assertEquals("ClassB", classB.name) + assertEquals(DRI("package1", "ClassB"), classB.dri.single()) + assertEquals(ContentKind.Classlikes, classB.kind) + } + } +} |