diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-06-30 11:29:29 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-07-02 13:17:28 +0200 |
commit | 6a15ef4a921058a86bd831f464ec00f6f33b56c9 (patch) | |
tree | 13b1fbae0b8f8daaa1af95d9976a6b23869bfbe0 /plugins | |
parent | ae8b4481b56d6bac4a3feb6a427e77afdbe36b2f (diff) | |
download | dokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.tar.gz dokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.tar.bz2 dokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.zip |
Javadoc location test
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt | 1 | ||||
-rw-r--r-- | plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt | 63 |
2 files changed, 63 insertions, 1 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt index 2d24bbf1..6e467542 100644 --- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt +++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt @@ -5,7 +5,6 @@ import javadoc.location.JavadocLocationProviderFactory import javadoc.renderer.KorteJavadocRenderer import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.base.DokkaBase -import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProviderFactory import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.plugability.querySingle diff --git a/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt new file mode 100644 index 00000000..cbaa3dd6 --- /dev/null +++ b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt @@ -0,0 +1,63 @@ +package javadoc.location + +import javadoc.pages.JavadocClasslikePageNode +import javadoc.pages.JavadocPackagePageNode +import javadoc.renderer.JavadocContentToHtmlTranslator +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.ExternalDocumentationLinkImpl +import org.jetbrains.dokka.javadoc.JavadocPlugin +import org.jetbrains.dokka.model.firstChildOfType +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.querySingle +import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.junit.jupiter.api.Test + +class JavadocTest : AbstractCoreTest() { + + @Test + fun `resolved signature with external links`() { + + fun externalLink(link: String) = DokkaConfiguration.ExternalDocumentationLink + .Builder(link) + .build() as ExternalDocumentationLinkImpl + + val config = dokkaConfiguration { + format = "javadoc" + passes { + pass { + sourceRoots = listOf("jvmSrc/") + externalDocumentationLinks = listOf( + externalLink("https://docs.oracle.com/javase/8/docs/api/"), + externalLink("https://kotlinlang.org/api/latest/jvm/stdlib/") + ) + analysisPlatform = "jvm" + } + } + } + + testInline( + """ + |/jvmSrc/javadoc/Test.kt + |package javadoc + |class Test() : Serializable, Cloneable + """.trimIndent(), + config, + cleanupOutput = false, + pluginOverrides = listOf(JavadocPlugin()) + ) { + renderingStage = { rootPageNode, dokkaContext -> + val transformer = JavadocContentToHtmlTranslator( + dokkaContext.plugin<JavadocPlugin>().querySingle { locationProviderFactory } + .getLocationProvider(rootPageNode), + dokkaContext + ) + val testClass = rootPageNode.firstChildOfType<JavadocPackagePageNode>() + .firstChildOfType<JavadocClasslikePageNode>() + assert( + "public final class <a href=javadoc/Test.html>Test</a> extends <a href=https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html>Cloneable</a>" + == transformer.htmlForContentNode(testClass.signature, null) + ) + } + } + } +}
\ No newline at end of file |