From 21afcb40ad5265d2214c05179614eb2f070526f2 Mon Sep 17 00:00:00 2001
From: Ignat Beresnev <ignat.beresnev@jetbrains.com>
Date: Fri, 7 Apr 2023 00:20:47 +0200
Subject: Move the `Properties` block to be above `Functions` (#2908)

---
 .../kotlin/renderers/html/TabbedContentTest.kt     | 36 ++++++++++++++++++++++
 .../signatures/InheritedAccessorsSignatureTest.kt  |  6 ++--
 2 files changed, 39 insertions(+), 3 deletions(-)

(limited to 'plugins/base/src/test/kotlin')

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
-- 
cgit