aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src')
-rw-r--r--plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt4
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt19
2 files changed, 14 insertions, 9 deletions
diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
index 686baf04..f77ec086 100644
--- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
@@ -1,6 +1,7 @@
package renderers
import org.jetbrains.dokka.base.DokkaBase
+import org.jetbrains.dokka.base.renderers.html.RootCreator
import org.jetbrains.dokka.base.resolvers.DefaultLocationProviderFactory
import org.jetbrains.dokka.base.resolvers.LocationProvider
import org.jetbrains.dokka.base.resolvers.LocationProviderFactory
@@ -24,7 +25,8 @@ abstract class RenderingOnlyTestBase {
val files = TestOutputWriter()
val context = MockContext(
DokkaBase().outputWriter to { _ -> files },
- DokkaBase().locationProviderFactory to ::DefaultLocationProviderFactory
+ DokkaBase().locationProviderFactory to ::DefaultLocationProviderFactory,
+ DokkaBase().htmlPreprocessors to { _ -> RootCreator }
)
protected val renderedContent: Element by lazy {
diff --git a/plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt
index f1d50007..f46f8b59 100644
--- a/plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt
@@ -5,8 +5,10 @@ import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
+import renderers.Div
import renderers.RenderingOnlyTestBase
import renderers.TestPage
+import renderers.match
class PlatformDependentHintTest : RenderingOnlyTestBase() {
private val pl1 = PlatformData("pl1", Platform.js, listOf("pl1"))
@@ -24,7 +26,7 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>abc</div></div>"))
+ renderedContent.match(Div("abc"))
}
@Test
@@ -38,7 +40,7 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>a</div> [pl1]<div>b</div> [pl2]<div>c</div> [pl3]</div>"))
+ renderedContent.match(Div("a"), "[pl1]", Div("b"), "[pl2]", Div("c"), "[pl3]")
}
@Test
@@ -52,7 +54,7 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>ab</div> [pl1]<div>bc</div> [pl2]</div>"))
+ renderedContent.match(Div("ab"), "[pl1]", Div("bc"), "[pl2]")
}
@Test
@@ -66,7 +68,7 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>ab</div></div>"))
+ renderedContent.match(Div("ab"))
}
@Test
@@ -82,13 +84,13 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div><div>ab</div></div> [pl1]<div><div>a</div>b</div> [pl2]</div>"))
+ renderedContent.match(Div(Div("ab")), "[pl1]", Div(Div("a"), "b"), "[pl2]")
}
@Test
fun caseWithGroupNotBreakingSimplification() {
val page = TestPage {
- platformDependentHint(platformData = setOf(pl1, pl2), styles = setOf(TextStyle.Block)) {
+ platformDependentHint(platformData = setOf(pl1, pl2)) {
group {
text("a", platformData = setOf(pl1, pl2))
text("b", platformData = setOf(pl1))
@@ -98,7 +100,8 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>ab</div></div>"))
+ println(renderedContent)
+ renderedContent.match("ab")
}
@Test
@@ -112,6 +115,6 @@ class PlatformDependentHintTest : RenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- assert(linesAfterContentTag().contains("<div>a</div> [pl1, pl2]<div>b</div> [pl3]</div>"))
+ renderedContent.match(Div("a"), "[pl1, pl2]", Div("b"), "[pl3]")
}
} \ No newline at end of file