diff options
Diffstat (limited to 'core/content-matcher-test-utils')
-rw-r--r-- | core/content-matcher-test-utils/api/content-matcher-test-utils.api | 2 | ||||
-rw-r--r-- | core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/content-matcher-test-utils/api/content-matcher-test-utils.api b/core/content-matcher-test-utils/api/content-matcher-test-utils.api index 0a7f153b..58881a15 100644 --- a/core/content-matcher-test-utils/api/content-matcher-test-utils.api +++ b/core/content-matcher-test-utils/api/content-matcher-test-utils.api @@ -30,6 +30,8 @@ public final class matchers/content/ContentMatchersDslKt { public static final fun platformHinted (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V public static final fun skipAllNotMatching (Lmatchers/content/ContentMatcherBuilder;)V public static final fun somewhere (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V + public static final fun tab (Lmatchers/content/ContentMatcherBuilder;Lorg/jetbrains/dokka/pages/TabbedContentType;Lkotlin/jvm/functions/Function1;)V + public static final fun tabbedGroup (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V public static final fun table (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V } 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<ContentGroup>.() -> Unit) = composite(block) +fun ContentMatcherBuilder<*>.tabbedGroup( + block: ContentMatcherBuilder<ContentGroup>.() -> Unit +) = composite<ContentGroup> { + block() + check { assertThat(this::style).transform { style -> style.contains(ContentStyle.TabbedContent) }.isEqualTo(true) } +} + +fun ContentMatcherBuilder<*>.tab( + tabbedContentType: TabbedContentType, block: ContentMatcherBuilder<ContentGroup>.() -> Unit +) = composite<ContentGroup> { + block() + check { + assertThat(this::extra).transform { extra -> extra[TabbedContentTypeExtra]?.value } + .isEqualTo(tabbedContentType) + } +} + fun ContentMatcherBuilder<*>.header(expectedLevel: Int? = null, block: ContentMatcherBuilder<ContentHeader>.() -> Unit) = composite<ContentHeader> { block() |