-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate dedicated pages for typealiases (#3051)
- Loading branch information
Showing
12 changed files
with
212 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
plugins/base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
plugins/base/src/test/kotlin/content/typealiases/TypealiasTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package content.typealiases | ||
|
||
import matchers.content.* | ||
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest | ||
import org.jetbrains.dokka.model.dfs | ||
import org.jetbrains.dokka.pages.* | ||
import org.junit.jupiter.api.Test | ||
import utils.assertNotNull | ||
|
||
|
||
class TypealiasTest : BaseAbstractTest() { | ||
private val configuration = dokkaConfiguration { | ||
sourceSets { | ||
sourceSet { | ||
sourceRoots = listOf("src/") | ||
classpath = listOf(commonStdlibPath!!) | ||
externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun `typealias should have a dedicated page with full documentation`() { | ||
testInline( | ||
""" | ||
|/src/main/kotlin/test/Test.kt | ||
|package example | ||
| | ||
| /** | ||
| * Brief text | ||
| * | ||
| * some text | ||
| * | ||
| * @see String | ||
| * @throws Unit | ||
| */ | ||
| typealias A = String | ||
""", | ||
configuration | ||
) { | ||
pagesTransformationStage = { module -> | ||
val content = (module.dfs { it.name == "A" } as ClasslikePageNode).content | ||
val platformHinted = content.dfs { it is PlatformHintedContent } | ||
platformHinted.assertNotNull("platformHinted").assertNode { | ||
group { | ||
group { | ||
group { | ||
+"typealias " | ||
group { group { link { +"A" } } } | ||
+" = " | ||
group { link { +"String" } } | ||
} | ||
} | ||
|
||
group { | ||
group { | ||
group { | ||
group { +"Brief text" } | ||
group { +"some text" } | ||
} | ||
} | ||
} | ||
|
||
header { +"See also" } | ||
table { | ||
group { link { +"String" } } | ||
} | ||
|
||
header { +"Throws" } | ||
table { | ||
group { group { link { +"Unit" } } } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.