forked from Kotlin/dokka
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix names of nested inheritors (Kotlin#2188)
- Loading branch information
1 parent
5461b72
commit ee20f09
Showing
2 changed files
with
48 additions
and
1 deletion.
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
47 changes: 47 additions & 0 deletions
47
plugins/base/src/test/kotlin/renderers/html/CoverPageTest.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,47 @@ | ||
package renderers.html | ||
|
||
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest | ||
import org.junit.jupiter.api.Test | ||
import signatures.renderedContent | ||
import utils.TestOutputWriterPlugin | ||
import kotlin.test.assertEquals | ||
|
||
class CoverPageTest : BaseAbstractTest() { | ||
|
||
private val configuration = dokkaConfiguration { | ||
sourceSets { | ||
sourceSet { | ||
sourceRoots = listOf("src/") | ||
classpath = listOf(commonStdlibPath!!) | ||
externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun `names of nested inheritors`() { | ||
val source = """ | ||
|/src/main/kotlin/test/Test.kt | ||
|package example | ||
| | ||
| sealed class Result{ | ||
| class Success(): Result() | ||
| class Failed(): Result() | ||
| } | ||
""" | ||
val writerPlugin = TestOutputWriterPlugin() | ||
|
||
testInline( | ||
source, | ||
configuration, | ||
pluginOverrides = listOf(writerPlugin) | ||
) { | ||
renderingStage = { _, _ -> | ||
val content = writerPlugin.writer.renderedContent("root/example/-result/index.html") | ||
val tableInheritors = content.select("div.table[data-togglable=Inheritors]").single() | ||
assertEquals(tableInheritors.getElementsContainingOwnText("Failed").singleOrNull()?.tagName(), "a") | ||
assertEquals(tableInheritors.getElementsContainingOwnText("Success").singleOrNull()?.tagName(), "a") | ||
} | ||
} | ||
} | ||
} |