aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-04-07 00:20:47 +0200
committerGitHub <noreply@github.com>2023-04-07 00:20:47 +0200
commit21afcb40ad5265d2214c05179614eb2f070526f2 (patch)
treef1fec88d9b8a87fa0a37e7f2030a1641f27f5653 /plugins/base
parentf5789ed721c1609899d9197a34d73b223289fc96 (diff)
downloaddokka-21afcb40ad5265d2214c05179614eb2f070526f2.tar.gz
dokka-21afcb40ad5265d2214c05179614eb2f070526f2.tar.bz2
dokka-21afcb40ad5265d2214c05179614eb2f070526f2.zip
Move the `Properties` block to be above `Functions` (#2908)
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt6
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt4
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt36
-rw-r--r--plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt6
4 files changed, 44 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 43efc757..768b2c6b 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -90,8 +90,8 @@ open class HtmlRenderer(
listOf(
BasicTabbedContentType.CONSTRUCTOR,
BasicTabbedContentType.TYPE,
- BasicTabbedContentType.FUNCTION,
- BasicTabbedContentType.PROPERTY
+ BasicTabbedContentType.PROPERTY,
+ BasicTabbedContentType.FUNCTION
)
),
if (extensions.isEmpty()) null else ContentTab(
@@ -99,8 +99,8 @@ open class HtmlRenderer(
listOf(
BasicTabbedContentType.CONSTRUCTOR,
BasicTabbedContentType.TYPE,
- BasicTabbedContentType.FUNCTION,
BasicTabbedContentType.PROPERTY,
+ BasicTabbedContentType.FUNCTION,
BasicTabbedContentType.EXTENSION_PROPERTY,
BasicTabbedContentType.EXTENSION_FUNCTION
)
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index a9c6dcca..98cf6ab6 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -318,10 +318,10 @@ open class DefaultPageCreator(
"Inherited functions", inheritedFunctions + inheritedExtensionFunctions
)
} else {
- functionsBlock("Functions", functions + extensionFuns)
propertiesBlock(
"Properties", properties + extensionProps
)
+ functionsBlock("Functions", functions + extensionFuns)
}
}
@@ -740,4 +740,4 @@ internal inline fun <reified T : NamedTagWrapper> GroupedTags.withTypeNamed(): M
// Annotations might have constructors to substitute reflection invocations
// and for internal/compiler purposes, but they are not expected to be documented
// and instantiated directly under normal circumstances, so constructors should not be rendered.
-internal fun List<Documentable>.shouldDocumentConstructors() = !this.any { it is DAnnotation } \ No newline at end of file
+internal fun List<Documentable>.shouldDocumentConstructors() = !this.any { it is DAnnotation }
diff --git a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
index fbadb021..7c42c22b 100644
--- a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
@@ -142,4 +142,40 @@ class TabbedContentTest : BaseAbstractTest() {
}
}
}
+
+ @Test
+ fun `should have expected order of content types within a members tab`() {
+ val source = """
+ |/src/main/kotlin/test/Result.kt
+ |package example
+ |
+ |class Result(val d: Int = 0) {
+ | class Success(): Result()
+ |
+ | val isFailed = false
+ | fun reset() = 0
+ | fun String.extension() = 0
+ |}
+ """
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ source,
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val classContent = writerPlugin.writer.renderedContent("root/example/-result/index.html")
+ val tabSectionNames = classContent.select("div .tabs-section-body > div[data-togglable]")
+ .map { it.attr("data-togglable") }
+
+ val expectedOrder = listOf("CONSTRUCTOR", "TYPE", "PROPERTY", "FUNCTION")
+
+ assertEquals(expectedOrder.size, tabSectionNames.size)
+ expectedOrder.forEachIndexed { index, element ->
+ assertEquals(element, tabSectionNames[index])
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
index 49a70f1c..0767b2df 100644
--- a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
@@ -205,13 +205,13 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
"Expected 5 signatures: class signature, constructor, property and two accessor lookalikes"
)
- val getterLookalikeFunction = signatures[2]
+ val getterLookalikeFunction = signatures[3]
getterLookalikeFunction.match(
"open fun ", A("getA"), "():", A("Int"),
ignoreSpanWithTokenStyle = true
)
- val setterLookalikeFunction = signatures[3]
+ val setterLookalikeFunction = signatures[4]
setterLookalikeFunction.match(
"open fun ", A("setA"), "(", Parameters(
Parameter("a: ", A("Int"))
@@ -219,7 +219,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
ignoreSpanWithTokenStyle = true
)
- val property = signatures[4]
+ val property = signatures[2]
property.match(
"var ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true