aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt34
2 files changed, 35 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index dfefbad8..43efc757 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -117,7 +117,7 @@ open class HtmlRenderer(
private fun createTabsForPackage(page: PackagePage): List<ContentTab> {
val p = page.documentables.single() as DPackage
return listOfNotNull(
- ContentTab(
+ if (p.typealiases.isEmpty() && p.classlikes.isEmpty()) null else ContentTab(
"Types",
listOf(
BasicTabbedContentType.TYPE,
diff --git a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
index 306925b3..fbadb021 100644
--- a/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/TabbedContentTest.kt
@@ -71,6 +71,40 @@ class TabbedContentTest : BaseAbstractTest() {
}
}
+ @Test
+ fun `should not have Types-tab where there are not types`() {
+ val source = """
+ |/src/main/kotlin/test/Test.kt
+ |package example
+ |
+ |val p = 0
+ |fun foo() = 0
+ |
+ |/src/main/kotlin/test/PackageTwo.kt
+ |package example2
+ |
+ |class A
+ """
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ source,
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val packagePage = writerPlugin.writer.renderedContent("root/example/index.html")
+ assertEquals(0, packagePage.select("*[data-togglable=TYPE]").size)
+ assertEquals(1, packagePage.getTabbedTable("PROPERTY").size)
+ assertEquals(1, packagePage.getTabbedTable("FUNCTION").size)
+
+ val packagePage2 = writerPlugin.writer.renderedContent("root/example2/index.html")
+ assertEquals(2, packagePage2.select("*[data-togglable=TYPE]").size)
+ assertEquals(0, packagePage2.getTabbedTable("PROPERTY").size)
+ assertEquals(0, packagePage2.getTabbedTable("FUNCTION").size)
+ }
+ }
+ }
@Test
fun `should have correct order of members and extensions`() {