aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-02-24 17:44:24 +0200
committerGitHub <noreply@github.com>2023-02-24 17:44:24 +0200
commit1040288ca76e070445f1400df2fcc5a56310be28 (patch)
tree52bed40e8a320f0835540b0cd38ea1899800e395 /plugins/base/src/test/kotlin
parent8d23340d1c377b8f490cdee3c2c874453d321dd8 (diff)
downloaddokka-1040288ca76e070445f1400df2fcc5a56310be28.tar.gz
dokka-1040288ca76e070445f1400df2fcc5a56310be28.tar.bz2
dokka-1040288ca76e070445f1400df2fcc5a56310be28.zip
Reorganize tabs for Classlike (#2764)
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt171
-rw-r--r--plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt12
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt111
-rw-r--r--plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt19
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt17
-rw-r--r--plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt10
-rw-r--r--plugins/base/src/test/kotlin/utils/contentUtils.kt95
11 files changed, 294 insertions, 151 deletions
diff --git a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
index c8c088f7..0cf94c18 100644
--- a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
@@ -2,6 +2,7 @@ package content.signatures
import matchers.content.*
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.pages.BasicTabbedContentType
import org.jetbrains.dokka.pages.ContentPage
import org.junit.jupiter.api.Test
@@ -189,27 +190,31 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
}
}
- group {
- header { +"Constructors" }
- table {
- group {
- link { +"SomeClass" }
- platformHinted {
- group {
- +"constructor"
- +"("
- +")"
- }
+ tabbedGroup {
+ group {
+ tab(BasicTabbedContentType.CONSTRUCTOR) {
+ header { +"Constructors" }
+ table {
group {
- +"constructor"
- +"("
- group {
+ link { +"SomeClass" }
+ platformHinted {
+ group {
+ +"constructor"
+ +"("
+ +")"
+ }
group {
- +"a: "
- group { link { +"String" } }
+ +"constructor"
+ +"("
+ group {
+ group {
+ +"a: "
+ group { link { +"String" } }
+ }
+ }
+ +")"
}
}
- +")"
}
}
}
@@ -268,56 +273,60 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
skipAllNotMatching()
}
}
- group {
- header { +"Constructors" }
- table {
- group {
- link { +"SomeClass" }
- platformHinted {
- group {
- +"constructor"
- +"("
- +")"
- }
- group {
- group {
- group { +"ctor one" }
- }
- }
+ tabbedGroup {
+ group {
+ tab(BasicTabbedContentType.CONSTRUCTOR) {
+ header { +"Constructors" }
+ table {
group {
- +"constructor"
- +"("
- group {
+ link { +"SomeClass" }
+ platformHinted {
+ group {
+ +"constructor"
+ +"("
+ +")"
+ }
group {
- +"b: "
group {
- link { +"Int" }
+ group { +"ctor one" }
}
}
- }
- +")"
- }
- group {
- group {
- group { +"ctor two" }
- }
- }
- group {
- +"constructor"
- +"("
- group {
group {
- +"a: "
+ +"constructor"
+ +"("
group {
- link { +"String" }
+ group {
+ +"b: "
+ group {
+ link { +"Int" }
+ }
+ }
+ }
+ +")"
+ }
+ group {
+ group {
+ group { +"ctor two" }
+ }
+ }
+ group {
+ +"constructor"
+ +"("
+ group {
+ group {
+ +"a: "
+ group {
+ link { +"String" }
+ }
+ }
+ }
+ +")"
+ }
+ group {
+ group {
+ group { +"ctor comment" }
}
}
- }
- +")"
- }
- group {
- group {
- group { +"ctor comment" }
}
}
}
@@ -366,28 +375,32 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
skipAllNotMatching()
}
}
- group {
- header { +"Constructors" }
- table {
- group {
- link { +"SomeClass" }
- platformHinted {
+ tabbedGroup {
+ group {
+ tab(BasicTabbedContentType.CONSTRUCTOR) {
+ header { +"Constructors" }
+ table {
group {
- +"constructor"
- +"("
- group {
+ link { +"SomeClass" }
+ platformHinted {
group {
- +"a: "
+ +"constructor"
+ +"("
group {
- link { +"String" }
+ group {
+ +"a: "
+ group {
+ link { +"String" }
+ }
+ }
+ }
+ +")"
+ }
+ group {
+ group {
+ group { +"ctor comment" }
}
}
- }
- +")"
- }
- group {
- group {
- group { +"ctor comment" }
}
}
}
@@ -434,9 +447,11 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
group {
group {
- header { +"Properties" }
- table {
- skipAllNotMatching()
+ group {
+ header { +"Properties" }
+ table {
+ skipAllNotMatching()
+ }
}
}
}
diff --git a/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt b/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt
index 58cb3f9f..3b2720c9 100644
--- a/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/KotlinEnumsTest.kt
@@ -168,7 +168,7 @@ class KotlinEnumsTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
val enumEntriesOnPage = writerPlugin.writer.renderedContent("root/testpackage/-test-enum/index.html")
- .select("div.table[data-togglable=Entries]")
+ .select("div[data-togglable=ENTRY] .table")
.select("div.table-row")
.select("div.keyValue")
.select("div.title")
diff --git a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt
index 01fefd3c..6e85fe01 100644
--- a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt
+++ b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt
@@ -190,7 +190,7 @@ class PageNodeMergerTest : BaseAbstractTest() {
defaultConfiguration
) {
renderingStage = { rootPageNode, _ ->
- val extensions = rootPageNode.findExtensionsOfClass("ExtensionReceiver")
+ val extensions = rootPageNode.findDivergencesOfClass("ExtensionReceiver", ContentKind.Extensions)
extensions.assertContainsKDocsInOrder(
"Top level val extension",
@@ -238,7 +238,7 @@ class PageNodeMergerTest : BaseAbstractTest() {
defaultConfiguration
) {
renderingStage = { rootPageNode, _ ->
- val extensions = rootPageNode.findExtensionsOfClass("ExtensionReceiver")
+ val extensions = rootPageNode.findDivergencesOfClass("ExtensionReceiver", ContentKind.Extensions)
extensions.assertContainsKDocsInOrder(
"Top level fun extension",
"Companion fun extension",
@@ -300,7 +300,7 @@ class PageNodeMergerTest : BaseAbstractTest() {
defaultConfiguration
) {
renderingStage = { rootPageNode, _ ->
- val extensions = rootPageNode.findExtensionsOfClass("ExtensionReceiver")
+ val extensions = rootPageNode.findDivergencesOfClass("ExtensionReceiver", ContentKind.Extensions)
extensions.assertContainsKDocsInOrder(
"Top level fun extension with one int param",
"Top level fun extension with one string param",
@@ -421,10 +421,10 @@ class PageNodeMergerTest : BaseAbstractTest() {
}
}
- private fun RootPageNode.findExtensionsOfClass(name: String): ContentDivergentGroup {
- val extensionReceiverPage = this.dfs { it is ClasslikePageNode && it.name == name } as ClasslikePageNode
+ private fun RootPageNode.findDivergencesOfClass(className: String, kind: ContentKind): ContentDivergentGroup {
+ val extensionReceiverPage = this.dfs { it is ClasslikePageNode && it.name == className } as ClasslikePageNode
return extensionReceiverPage.content
- .dfs { it is ContentDivergentGroup && it.groupID.name == "Extensions" } as ContentDivergentGroup
+ .dfs { it is ContentDivergentGroup && it.dci.kind == kind } as ContentDivergentGroup
}
private fun RootPageNode.findPackageFunctionBlocks(packageName: String): List<ContentDivergentGroup> {
diff --git a/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt b/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt
index 0e1f53ec..522f9037 100644
--- a/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/CoverPageTest.kt
@@ -38,7 +38,7 @@ class CoverPageTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
val content = writerPlugin.writer.renderedContent("root/example/-result/index.html")
- val tableInheritors = content.select("div.table[data-togglable=Inheritors]").single()
+ val tableInheritors = content.select("div.table").single { it.previousElementSibling()?.text() == "Inheritors" && it.childrenSize() == 2 }
assertEquals(tableInheritors.getElementsContainingOwnText("Failed").singleOrNull()?.tagName(), "a")
assertEquals(tableInheritors.getElementsContainingOwnText("Success").singleOrNull()?.tagName(), "a")
}
diff --git a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
index 94fcd5bf..56329940 100644
--- a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
@@ -3,7 +3,6 @@ package renderers.html
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.DokkaBase
-import org.jetbrains.dokka.base.renderers.DefaultTabSortingStrategy
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProviderFactory
import org.jetbrains.dokka.base.resolvers.external.javadoc.JavadocExternalLocationProviderFactory
@@ -53,7 +52,6 @@ abstract class HtmlRenderingOnlyTestBase : RenderingOnlyTestBase<Element>() {
DokkaBase().htmlPreprocessors to { RootCreator },
DokkaBase().externalLocationProviderFactory to ::JavadocExternalLocationProviderFactory,
DokkaBase().externalLocationProviderFactory to ::DefaultExternalLocationProviderFactory,
- DokkaBase().tabSortingStrategy to { DefaultTabSortingStrategy() },
testConfiguration = configuration
)
diff --git a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
new file mode 100644
index 00000000..306925b3
--- /dev/null
+++ b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
@@ -0,0 +1,111 @@
+package renderers.html
+
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jsoup.nodes.Element
+import org.junit.jupiter.api.Test
+import signatures.renderedContent
+import utils.TestOutputWriterPlugin
+import kotlin.test.assertEquals
+
+class TabbedContentTest : BaseAbstractTest() {
+
+ private val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src/")
+ classpath = listOf(commonStdlibPath!!)
+ externalDocumentationLinks = listOf(stdlibExternalDocumentationLink)
+ }
+ }
+ }
+
+ private fun Element.getTabbedRow(type: String) = select(".table-row[data-togglable=$type]")
+ private fun Element.getTabbedTable(type: String) = select("div[data-togglable=$type] .table")
+
+ @Test
+ fun `should have correct tabbed content type`() {
+ val source = """
+ |/src/main/kotlin/test/Test.kt
+ |package example
+ |
+ |val p = 0
+ |fun foo() = 0
+ |
+ | class A(val d: Int = 0) {
+ | class Success(): Result()
+ | class Failed(): Result()
+ |
+ | fun fn() = 0
+ | }
+ |
+ | fun A.fn() = 0
+ | fun A.fn2() = 0
+ | fun A.fn3() = 0
+ | val A.p = 0
+ | val A.p2 = 0
+ """
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ source,
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val classContent = writerPlugin.writer.renderedContent("root/example/-a/index.html")
+ assertEquals(1, classContent.getTabbedTable("CONSTRUCTOR").size)
+ assertEquals(1, classContent.getTabbedTable("PROPERTY").size)
+ assertEquals(1, classContent.getTabbedTable("CONSTRUCTOR").size)
+ assertEquals(1, classContent.getTabbedTable("FUNCTION").size)
+ assertEquals(1, classContent.getTabbedTable("TYPE").size)
+ assertEquals(3, classContent.getTabbedRow("EXTENSION_FUNCTION").size)
+ assertEquals(2, classContent.getTabbedRow("EXTENSION_PROPERTY").size)
+
+ val packagePage = writerPlugin.writer.renderedContent("root/example/index.html")
+ assertEquals(1, packagePage.getTabbedTable("TYPE").size)
+ assertEquals(1, packagePage.getTabbedTable("PROPERTY").size)
+ assertEquals(1, packagePage.getTabbedTable("FUNCTION").size)
+ assertEquals(3, packagePage.getTabbedRow("EXTENSION_FUNCTION").size)
+ assertEquals(2, packagePage.getTabbedRow("EXTENSION_PROPERTY").size)
+ }
+ }
+ }
+
+
+ @Test
+ fun `should have correct order of members and extensions`() {
+ val source = """
+ |/src/main/kotlin/test/Test.kt
+ |package example
+ |
+ |val p = 0
+ |fun foo() = 0
+ |
+ |class A(val d: Int = 0) {
+ | fun fn() = 0
+ | fun a() = 0
+ | fun g() = 0
+ |}
+ |
+ | fun A.fn() = 0
+ """
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ source,
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val classContent = writerPlugin.writer.renderedContent("root/example/-a/index.html")
+ val funTable = classContent.select("div[data-togglable=FUNCTION] .table")
+ val orders =
+ funTable.select(".table-row").map { it.attr("data-togglable") }
+ assertEquals(listOf("", "", "EXTENSION_FUNCTION", ""), orders)
+ val names =
+ funTable.select(".main-subrow .inline-flex a").map { it.text() }
+ assertEquals(listOf("a", "fn", "fn", "g"), names)
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt b/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt
index 839fb7fe..5a6d95eb 100644
--- a/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt
@@ -62,12 +62,12 @@ class ObviousTypeSkippingTest : BaseAbstractTest(
forProperty("val underTest = if (true) println(5) else null", "val underTest: Unit?"),
forProperty("val underTest: Any = if (true) println(5) else 5", "val underTest: Any"),
forProperty("val underTest = if (true) println(5) else 5", "val underTest: Any"),
- forFunction("fun <T: Iterable<Any>> T.underTest() {}", "fun <T : Iterable<Any>> T.underTest()"),
- forFunction("fun <T: Iterable<Any?>> T.underTest() {}", "fun <T : Iterable<Any?>> T.underTest()"),
- forFunction("fun <T: Iterable<Any?>?> T.underTest() {}", "fun <T : Iterable<Any?>?> T.underTest()"),
- forFunction("fun <T: Any> T.underTest() {}", "fun <T : Any> T.underTest()"),
- forFunction("fun <T: Any?> T.underTest() {}", "fun <T> T.underTest()"),
- forFunction("fun <T> T.underTest() {}", "fun <T> T.underTest()"),
+ forExtension("fun <T: Iterable<Any>> T.underTest() {}", "fun <T : Iterable<Any>> T.underTest()"),
+ forExtension("fun <T: Iterable<Any?>> T.underTest() {}", "fun <T : Iterable<Any?>> T.underTest()"),
+ forExtension("fun <T: Iterable<Any?>?> T.underTest() {}", "fun <T : Iterable<Any?>?> T.underTest()"),
+ forExtension("fun <T: Any> T.underTest() {}", "fun <T : Any> T.underTest()"),
+ forExtension("fun <T: Any?> T.underTest() {}", "fun <T> T.underTest()"),
+ forExtension("fun <T> T.underTest() {}", "fun <T> T.underTest()"),
forClass("class Testable<T: Any>", "class Testable<T : Any>"),
forClass("class Testable<T: Any?>", "class Testable<T>"),
forClass("class Testable<T: Any?>(t: T)", "class Testable<T>(t: T)"),
@@ -167,6 +167,13 @@ private fun forFunction(codeFragment: String, expectedSignature: String, functio
OnOwnPage(functionName)
)
+private fun forExtension(codeFragment: String, expectedSignature: String, functionName: String = "underTest") =
+ TestData(
+ codeFragment,
+ expectedSignature,
+ OnParentPage(PackagePageNode::class, ContentKind.Extensions),
+ OnOwnPage(functionName)
+ )
private fun forMethod(
codeFragment: String,
expectedSignature: String,
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index f017c815..3a263fd0 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -829,7 +829,7 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
val constructorTabFirstElement =
writerPlugin.writer.renderedContent("root/example/-primary-constructor-class/index.html")
- .tab("Constructors")
+ .tab("CONSTRUCTOR")
.first() ?: throw NoSuchElementException("No Constructors tab found or it is empty")
constructorTabFirstElement.firstSignature().match(
@@ -926,7 +926,7 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
val enumEntrySignatures = writerPlugin.writer.renderedContent("root/example/-enum-class/index.html")
- .select("div.table[data-togglable=Entries]")
+ .select("div[data-togglable=ENTRY] .table")
.single()
.signature()
.select("div.block")
diff --git a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
index 0ed5af9f..686b4990 100644
--- a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
+++ b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
@@ -4,6 +4,7 @@ import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.transformers.pages.PageTransformer
import org.jetbrains.dokka.transformers.pages.pageMapper
import org.jetbrains.dokka.transformers.pages.pageScanner
@@ -12,8 +13,7 @@ import org.jsoup.Jsoup
import org.junit.jupiter.api.Test
import utils.TestOutputWriterPlugin
import utils.assertContains
-import kotlin.test.assertEquals
-
+import utils.assertNotNull
class PageTransformerBuilderTest : BaseAbstractTest() {
class ProxyPlugin(transformer: PageTransformer) : DokkaPlugin() {
@@ -136,7 +136,7 @@ class PageTransformerBuilderTest : BaseAbstractTest() {
}
@Test
- fun `kotlin constructors tab should exist even though there is primary constructor only`() {
+ fun `kotlin constructors should exist even though there is primary constructor only`() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
@@ -160,13 +160,12 @@ class PageTransformerBuilderTest : BaseAbstractTest() {
.filterIsInstance<ContentGroup>()
.single { it.dci.kind == ContentKind.Main }.children
- val constructorTabsCount = content.filter { it is ContentHeader }.flatMap {
- it.children.filter { it is ContentText }
- }.count {
- (it as? ContentText)?.text == "Constructors"
- }
+ val contentWithConstructorsHeader = content.find { tabContent -> tabContent.dfs { it is ContentText && (it as? ContentText)?.text == "Constructors"} != null }
+
+ contentWithConstructorsHeader.assertNotNull("contentWithConstructorsHeader")
- assertEquals(1, constructorTabsCount)
+ contentWithConstructorsHeader?.dfs { it.dci.kind == ContentKind.Constructors && it is ContentGroup }
+ .assertNotNull("constructor group")
}
}
}
diff --git a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
index 33ec2372..5e335209 100644
--- a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
@@ -57,6 +57,12 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() {
}?.children?.dropWhile { child -> child != sectionHeader }?.drop(1)?.firstOrNull()
}
+ private fun ContentNode.findTabWithType(type: TabbedContentType): ContentNode? = dfs { node ->
+ node.children.filterIsInstance<ContentGroup>().any { gr ->
+ gr.extra[TabbedContentTypeExtra]?.value == type
+ }
+ }
+
@Test
fun `should merge fun`() {
testInline(
@@ -173,7 +179,7 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() {
assertEquals(
2,
- prop1.firstChildOfType<PlatformHintedContent>().inner.children.size,
+ prop1.firstChildOfType<ContentDivergentGroup>().children.size,
"Incorrect number of divergent instances found"
)
@@ -217,7 +223,7 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() {
val classPage = root.dfs { it.name == "classA" } as? ClasslikePageNode
assertNotNull(classPage, "Tested class not found!")
- val entries = classPage.findSectionWithName("Entries").assertNotNull("Entries")
+ val entries = classPage.content.findTabWithType(BasicTabbedContentType.ENTRY).assertNotNull("Entries")
entries.children.singleOrNull().assertNotNull("ENTRY")
val props = classPage.findSectionWithName("Properties").assertNotNull("Properties")
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt
index d38af3f4..4fce1155 100644
--- a/plugins/base/src/test/kotlin/utils/contentUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt
@@ -1,9 +1,7 @@
package utils
import matchers.content.*
-import org.jetbrains.dokka.pages.ContentGroup
-import org.jetbrains.dokka.pages.ContentPage
-import org.jetbrains.dokka.pages.RootPageNode
+import org.jetbrains.dokka.pages.*
//TODO: Try to unify those functions after update to 1.4
fun ContentMatcherBuilder<*>.functionSignature(
@@ -197,35 +195,43 @@ fun ContentMatcherBuilder<*>.propertySignature(
header { +"Package-level declarations" }
skipAllNotMatching()
}
- group {
+ tabbedGroup {
group {
skipAllNotMatching()
- header { +"Properties" }
- table {
- group {
- link { +name }
- platformHinted {
- group {
- annotations.entries.forEach {
- group {
- unwrapAnnotation(it)
- }
- }
- if (visibility.isNotBlank()) +"$visibility "
- if (modifier.isNotBlank()) +"$modifier "
- +("${keywords.joinToString("") { "$it " }}$preposition ")
- link { +name }
- if (type != null) {
- +(": ")
- group {
- link {
- +(type)
+ tab(BasicTabbedContentType.PROPERTY) {
+ header{ + "Properties" }
+ table {
+ group {
+ link { +name }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ group {
+ group {
+ annotations.entries.forEach {
+ group {
+ unwrapAnnotation(it)
+ }
+ }
+ if (visibility.isNotBlank()) +"$visibility "
+ if (modifier.isNotBlank()) +"$modifier "
+ +("${keywords.joinToString("") { "$it " }}$preposition ")
+ link { +name }
+ if (type != null) {
+ +(": ")
+ group {
+ link {
+ +(type)
+ }
+ }
+ }
+ if (value != null) {
+ +(" = $value")
+ }
+ }
}
}
}
- if (value != null) {
- +(" = $value")
- }
}
}
}
@@ -242,39 +248,40 @@ fun ContentMatcherBuilder<*>.typealiasSignature(name: String, expressionTarget:
}
group {
group {
- skipAllNotMatching()
- header { +"Types" }
- table {
- group {
- link { +name }
- divergentGroup {
- divergentInstance {
- group {
+ tab(BasicTabbedContentType.TYPE) {
+ header{ + "Types" }
+ table {
+ group {
+ link { +name }
+ divergentGroup {
+ divergentInstance {
group {
group {
group {
- +"typealias "
group {
+ +"typealias "
group {
- link { +name }
+ group {
+ link { +name }
+ }
+ skipAllNotMatching()
+ }
+ +" = "
+ group {
+ link { +expressionTarget }
}
- skipAllNotMatching()
- }
- +" = "
- group {
- link { +expressionTarget }
}
}
}
}
}
+ skipAllNotMatching()
}
- skipAllNotMatching()
}
+ skipAllNotMatching()
}
skipAllNotMatching()
}
- skipAllNotMatching()
}
}
}