aboutsummaryrefslogtreecommitdiff
path: root/core/content-matcher-test-utils/src/main
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-02-24 17:44:24 +0200
committerGitHub <noreply@github.com>2023-02-24 17:44:24 +0200
commit1040288ca76e070445f1400df2fcc5a56310be28 (patch)
tree52bed40e8a320f0835540b0cd38ea1899800e395 /core/content-matcher-test-utils/src/main
parent8d23340d1c377b8f490cdee3c2c874453d321dd8 (diff)
downloaddokka-1040288ca76e070445f1400df2fcc5a56310be28.tar.gz
dokka-1040288ca76e070445f1400df2fcc5a56310be28.tar.bz2
dokka-1040288ca76e070445f1400df2fcc5a56310be28.zip
Reorganize tabs for Classlike (#2764)
Diffstat (limited to 'core/content-matcher-test-utils/src/main')
-rw-r--r--core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt18
1 files changed, 18 insertions, 0 deletions
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()