From 1040288ca76e070445f1400df2fcc5a56310be28 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Fri, 24 Feb 2023 17:44:24 +0200 Subject: Reorganize tabs for Classlike (#2764) --- .../transformerBuilders/PageTransformerBuilderTest.kt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt') diff --git a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt index 0ed5af9f..686b4990 100644 --- a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt +++ b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt @@ -4,6 +4,7 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.transformers.pages.PageTransformer import org.jetbrains.dokka.transformers.pages.pageMapper import org.jetbrains.dokka.transformers.pages.pageScanner @@ -12,8 +13,7 @@ import org.jsoup.Jsoup import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin import utils.assertContains -import kotlin.test.assertEquals - +import utils.assertNotNull class PageTransformerBuilderTest : BaseAbstractTest() { class ProxyPlugin(transformer: PageTransformer) : DokkaPlugin() { @@ -136,7 +136,7 @@ class PageTransformerBuilderTest : BaseAbstractTest() { } @Test - fun `kotlin constructors tab should exist even though there is primary constructor only`() { + fun `kotlin constructors should exist even though there is primary constructor only`() { val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -160,13 +160,12 @@ class PageTransformerBuilderTest : BaseAbstractTest() { .filterIsInstance() .single { it.dci.kind == ContentKind.Main }.children - val constructorTabsCount = content.filter { it is ContentHeader }.flatMap { - it.children.filter { it is ContentText } - }.count { - (it as? ContentText)?.text == "Constructors" - } + val contentWithConstructorsHeader = content.find { tabContent -> tabContent.dfs { it is ContentText && (it as? ContentText)?.text == "Constructors"} != null } + + contentWithConstructorsHeader.assertNotNull("contentWithConstructorsHeader") - assertEquals(1, constructorTabsCount) + contentWithConstructorsHeader?.dfs { it.dci.kind == ContentKind.Constructors && it is ContentGroup } + .assertNotNull("constructor group") } } } -- cgit