Skip to content

Commit 893e6c9

Browse files
committed
Add test for all pages sorting
1 parent df386ff commit 893e6c9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

plugins/base/src/test/kotlin/renderers/html/NavigationTest.kt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
99
import org.jsoup.nodes.Element
1010
import utils.TestOutputWriterPlugin
1111
import utils.navigationHtml
12+
import utils.withAllTypesPage
1213
import kotlin.test.Test
1314
import kotlin.test.assertEquals
1415
import kotlin.test.assertNotNull
@@ -98,6 +99,50 @@ class NavigationTest : BaseAbstractTest() {
9899
}
99100
}
100101

102+
@Test
103+
fun `all types page should be in the end`() = withAllTypesPage{
104+
val writerPlugin = TestOutputWriterPlugin()
105+
testInline(
106+
"""
107+
|/src/main/kotlin/com/example/Sequences.kt
108+
|package com.example
109+
|interface Sequence<T>
110+
""".trimMargin(),
111+
configuration,
112+
pluginOverrides = listOf(writerPlugin)
113+
) {
114+
renderingStage = { _, _ ->
115+
val content = writerPlugin.writer.navigationHtml().select("div.sideMenuPart")
116+
assertEquals(4, content.size)
117+
118+
content[0].assertNavigationLink(
119+
id = "root-nav-submenu",
120+
text = "root",
121+
address = "index.html",
122+
)
123+
124+
content[1].assertNavigationLink(
125+
id = "root-nav-submenu-0",
126+
text = "com.example",
127+
address = "root/com.example/index.html",
128+
)
129+
130+
content[2].assertNavigationLink(
131+
id = "root-nav-submenu-0-0",
132+
text = "Sequence",
133+
address = "root/com.example/-sequence/index.html",
134+
icon = NavigationNodeIcon.INTERFACE_KT
135+
)
136+
137+
content[3].assertNavigationLink(
138+
id = "root-nav-submenu-1",
139+
text = "All Types",
140+
address = "root/all-types.html",
141+
)
142+
}
143+
}
144+
}
145+
101146
@Test
102147
fun `should strike deprecated class link`() {
103148
val writerPlugin = TestOutputWriterPlugin()

0 commit comments

Comments
 (0)