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) --- .../main/kotlin/matchers/content/ContentMatchersDsl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/content-matcher-test-utils/src/main/kotlin') diff --git a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt index 08442536..13780718 100644 --- a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt +++ b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt @@ -3,6 +3,7 @@ package matchers.content import assertk.assertThat import assertk.assertions.contains import assertk.assertions.isEqualTo +import assertk.assertions.isNotNull import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.test.tools.matchers.content.* @@ -70,6 +71,23 @@ fun ContentMatcherBuilder<*>.skipAllNotMatching() { // Convenience functions: fun ContentMatcherBuilder<*>.group(block: ContentMatcherBuilder.() -> Unit) = composite(block) +fun ContentMatcherBuilder<*>.tabbedGroup( + block: ContentMatcherBuilder.() -> Unit +) = composite { + block() + check { assertThat(this::style).transform { style -> style.contains(ContentStyle.TabbedContent) }.isEqualTo(true) } +} + +fun ContentMatcherBuilder<*>.tab( + tabbedContentType: TabbedContentType, block: ContentMatcherBuilder.() -> Unit +) = composite { + block() + check { + assertThat(this::extra).transform { extra -> extra[TabbedContentTypeExtra]?.value } + .isEqualTo(tabbedContentType) + } +} + fun ContentMatcherBuilder<*>.header(expectedLevel: Int? = null, block: ContentMatcherBuilder.() -> Unit) = composite { block() -- cgit