Skip to content

Commit

Permalink
Add a test for the content order within class tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Apr 6, 2023
1 parent a0d8b9c commit 0a97005
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
Expand Up @@ -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])
}
}
}
}
}

0 comments on commit 0a97005

Please sign in to comment.