diff options
Diffstat (limited to 'plugins/base/src/test/kotlin/renderers/html')
-rw-r--r-- | plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt | 63 |
1 files changed, 24 insertions, 39 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+") } } |