Skip to content

Commit

Permalink
Add an icon test for packages/modules
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Jul 23, 2022
1 parent d399547 commit 6855ae1
Showing 1 changed file with 28 additions and 1 deletion.
Expand Up @@ -68,7 +68,6 @@ class NavigationIconTest : BaseAbstractTest() {
)
}


@Test
fun `should add icon styles to java class navigation item`() {
assertNavigationIcon(
Expand Down Expand Up @@ -251,6 +250,34 @@ class NavigationIconTest : BaseAbstractTest() {
}
}

@Test
fun `should not generate nav link grids or icons for packages and modules`() {
val writerPlugin = TestOutputWriterPlugin()
testInline(
"""
|/src/main/kotlin/com/example/Example.kt
|package com.example
|
|class Example {}
""".trimIndent(),
configuration,
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
val content = writerPlugin.writer.navigationHtml().select("div.sideMenuPart")

assertEquals(3, content.size)
assertEquals("root-nav-submenu", content[0].id())
assertEquals("root-nav-submenu-0", content[1].id())
assertEquals("root-nav-submenu-0-0", content[2].id())

// there's 3 nav items, but only one icon
val navLinkGrids = content.select("span.nav-icon")
assertEquals(1, navLinkGrids.size)
}
}
}

private fun TestOutputWriter.navigationHtml(): Element = contents.getValue("navigation.html").let { Jsoup.parse(it) }

private fun Elements.selectNavigationGrid(): Element {
Expand Down

0 comments on commit 6855ae1

Please sign in to comment.