aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt63
-rw-r--r--plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt33
-rw-r--r--plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt8
4 files changed, 45 insertions, 60 deletions
diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
index 4592f6e6..6a504634 100644
--- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
@@ -5,9 +5,8 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
import renderers.testPage
-import utils.Div
-import utils.Span
import utils.match
+import kotlin.test.assertEquals
class DivergentTest : HtmlRenderingOnlyTestBase() {
@@ -23,7 +22,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div(Div(Div("a")))))
+ renderedContent.select("[data-togglable=DEFAULT/js]").single().match("a")
}
@Test
@@ -38,7 +37,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div("a")))
+ renderedContent.match("a")
}
@Test
@@ -64,7 +63,10 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div(Div(Div("a"), Div("b"), Div("c")))))
+ val content = renderedContent
+ content.select("[data-togglable=DEFAULT/js]").single().match("a")
+ content.select("[data-togglable=DEFAULT/jvm]").single().match("b")
+ content.select("[data-togglable=DEFAULT/native]").single().match("c")
}
@Test
@@ -90,7 +92,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div((Div(Div("abc"))))))
+ renderedContent.select("[data-togglable=DEFAULT/js]").single().match("abc")
}
@Test
@@ -126,7 +128,14 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div(Div(Div("bd"), Div("c"), Div("ae")))))
+ val content = renderedContent
+ val orderOfTabs = content.select(".platform-bookmarks-row").single().children().map { it.attr("data-toggle") }
+
+ assertEquals(listOf("DEFAULT/js", "DEFAULT/jvm", "DEFAULT/native"), orderOfTabs)
+
+ content.select("[data-togglable=DEFAULT/native]").single().match("ae")
+ content.select("[data-togglable=DEFAULT/js]").single().match("bd")
+ content.select("[data-togglable=DEFAULT/jvm]").single().match("c")
}
@Test
@@ -174,12 +183,10 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(
- Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("a"))), "a+"),
- Div(Div(Span(Div(Div("JS")))), Div(Div(Div("bd"))), "bd+"),
- Div(Div(Span(Div(Div("JVM")))), Div(Div(Div("c")))),
- Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("e"))), "e+"),
- )
+ val content = renderedContent
+ content.select("[data-togglable=DEFAULT/native]").single().match("aa+ee+")
+ content.select("[data-togglable=DEFAULT/js]").single().match("bdbd+")
+ content.select("[data-togglable=DEFAULT/jvm]").single().match("c")
}
@Test
@@ -206,15 +213,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(
- Div(
- Div(
- "ab-",
- Span()
- ),
- Div(Div(Div("ab")))
- )
- )
+ renderedContent.select("[data-togglable=DEFAULT/native]").single().match("ab-ab")
}
@Test
@@ -241,12 +240,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(
- Div(
- Div(Div(Div("ab"))),
- "ab+"
- )
- )
+ renderedContent.select("[data-togglable=DEFAULT/native]").single().match("abab+")
}
@Test
@@ -279,13 +273,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(
- Div(
- Div("ab-", Span()),
- Div(Div(Div("ab"))),
- "ab+"
- )
- )
+ renderedContent.select("[data-togglable=DEFAULT/native]").single().match("ab-abab+")
}
@Test
@@ -318,9 +306,6 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(
- Div(Div("a-", Span()), Div(Div(Div("a"))), "ab+"),
- Div(Div("b-", Span()), Div(Div(Div(("b")))), "ab+")
- )
+ renderedContent.select("[data-togglable=DEFAULT/native]").single().match("a-aab+b-bab+")
}
}
diff --git a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt
index 5ea5c02c..171e510c 100644
--- a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt
@@ -46,6 +46,7 @@ abstract class AbstractRenderingTest : BaseAbstractTest() {
.let { Jsoup.parse(it) }.select("#content").single()
fun TestOutputWriterPlugin.renderedDivergentContent(path: String) = renderedContent(path).select("div.divergent-group")
+ fun TestOutputWriterPlugin.renderedSourceDepenentContent(path: String) = renderedContent(path).select("div.sourceset-depenent-content")
val Element.brief: String
get() = children().select("p").text()
diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
index 6471f555..f03103d8 100644
--- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
@@ -1,13 +1,7 @@
package signatures
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.jsoup.Jsoup
-import org.jsoup.nodes.Element
-import org.jsoup.select.Elements
import org.junit.jupiter.api.Test
-import java.nio.file.Paths
import utils.TestOutputWriterPlugin
-import kotlin.test.assertEquals
class DivergentSignatureTest : AbstractRenderingTest() {
@@ -21,10 +15,13 @@ class DivergentSignatureTest : AbstractRenderingTest() {
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
- val content = writerPlugin.renderedDivergentContent("example/example/-clock/get-time.html")
+ val content = writerPlugin.renderedSourceDepenentContent("example/example/-clock/get-time.html")
- assert(content.count() == 1)
- assert(content.select("[data-filterable-current=example/common example/js example/jvm]").single().brief == "")
+ assert(content.count() == 3)
+ val sourceSets = listOf("example/common", "example/js", "example/jvm")
+ sourceSets.forEach {
+ assert(content.select("[data-togglable=$it]").single().brief == "")
+ }
}
}
}
@@ -39,10 +36,12 @@ class DivergentSignatureTest : AbstractRenderingTest() {
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
- val content = writerPlugin.renderedDivergentContent("example/example/-clock/get-times-in-millis.html")
- assert(content.count() == 2)
- assert(content.select("[data-filterable-current=example/common example/jvm]").single().brief == "Time in minis")
- assert(content.select("[data-filterable-current=example/js]").single().brief == "JS implementation of getTimeInMillis" )
+ val content = writerPlugin.renderedSourceDepenentContent("example/example/-clock/get-times-in-millis.html")
+
+ assert(content.count() == 3)
+ assert(content.select("[data-togglable=example/common]").single().brief == "Time in minis")
+ assert(content.select("[data-togglable=example/jvm]").single().brief == "Time in minis")
+ assert(content.select("[data-togglable=example/js]").single().brief == "JS implementation of getTimeInMillis" )
}
}
}
@@ -57,11 +56,11 @@ class DivergentSignatureTest : AbstractRenderingTest() {
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
- val content = writerPlugin.renderedDivergentContent("example/example/-clock/get-year.html")
+ val content = writerPlugin.renderedSourceDepenentContent("example/example/-clock/get-year.html")
assert(content.count() == 3)
- assert(content.select("[data-filterable-current=example/jvm]").single().brief == "JVM custom kdoc")
- assert(content.select("[data-filterable-current=example/js]").single().brief == "JS custom kdoc")
- assert(content.select("[data-filterable-current=example/common]").single().brief == "")
+ assert(content.select("[data-togglable=example/jvm]").single().brief == "JVM custom kdoc")
+ assert(content.select("[data-togglable=example/js]").single().brief == "JS custom kdoc")
+ assert(content.select("[data-togglable=example/common]").single().brief == "")
}
}
}
diff --git a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt
index c741ac8b..4ac21c59 100644
--- a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt
@@ -16,9 +16,9 @@ class RawHtmlRenderingTest: AbstractRenderingTest() {
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
- val content = writerPlugin.renderedDivergentContent("example/example/-html-test/test.html")
+ val content = writerPlugin.renderedSourceDepenentContent("example/example/-html-test/test.html")
assert(content.count() == 1)
- assertEquals(content.select("[data-filterable-current=example/jvm]").single().rawBrief,"This is an example <!-- not visible --> of html")
+ assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief,"This is an example <!-- not visible --> of html")
val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html")
.let { Jsoup.parse(it) }
@@ -53,9 +53,9 @@ class RawHtmlRenderingTest: AbstractRenderingTest() {
pluginOverrides = listOf(writerPlugin)
) {
renderingStage = { _, _ ->
- val content = writerPlugin.renderedDivergentContent("example/example/-html-test/test-p.html")
+ val content = writerPlugin.renderedSourceDepenentContent("example/example/-html-test/test-p.html")
assert(content.count() == 1)
- assertEquals(content.select("[data-filterable-current=example/jvm]").single().rawBrief, "This is an <b> documentation </b>")
+ assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief, "This is an <b> documentation </b>")
val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html")
.let { Jsoup.parse(it) }