From 0a970057bddbb4e4a40ed796e0102c19ce805e31 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Thu, 6 Apr 2023 21:39:57 +0200 Subject: [PATCH] Add a test for the content order within class tabs --- .../renderers/html/TabbedContentTest.kt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt index fbadb021a9..7c42c22b0d 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