aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/transformerBuilders
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-09-21 13:14:51 +0200
committerGitHub <noreply@github.com>2022-09-21 13:14:51 +0200
commit879d4f2652d528f20c95d5bb17899d6cb10c5e85 (patch)
tree27b2ee08207aeba43a58bb7dd9a26315f4470d4d /plugins/base/src/test/kotlin/transformerBuilders
parente49726f2b9a61278ba3ced9eb2438d925f5d364c (diff)
downloaddokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.tar.gz
dokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.tar.bz2
dokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.zip
Wrap long signatures dynamically based on client width (#2659)
Diffstat (limited to 'plugins/base/src/test/kotlin/transformerBuilders')
-rw-r--r--plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt36
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
index 8685e3c9..67e4d16f 100644
--- a/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
+++ b/plugins/base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt
@@ -8,7 +8,10 @@ import org.jetbrains.dokka.transformers.pages.PageTransformer
import org.jetbrains.dokka.transformers.pages.pageMapper
import org.jetbrains.dokka.transformers.pages.pageScanner
import org.jetbrains.dokka.transformers.pages.pageStructureTransformer
+import org.jsoup.Jsoup
import org.junit.jupiter.api.Test
+import utils.TestOutputWriterPlugin
+import utils.assertContains
import kotlin.test.assertEquals
class PageTransformerBuilderTest : BaseAbstractTest() {
@@ -168,6 +171,39 @@ class PageTransformerBuilderTest : BaseAbstractTest() {
}
}
+ @Test
+ fun `should load script as defer if name ending in _deferred`() {
+ val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src/main/kotlin")
+ }
+ }
+ }
+ val writerPlugin = TestOutputWriterPlugin()
+ testInline(
+ """
+ |/src/main/kotlin/test/Test.kt
+ |package test
+ |
+ |class Test
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val generatedFiles = writerPlugin.writer.contents
+
+ assertContains(generatedFiles.keys, "scripts/symbol-parameters-wrapper_deferred.js")
+
+ val scripts = generatedFiles.getValue("root/test/-test/-test.html").let { Jsoup.parse(it) }.select("script")
+ val deferredScriptSources = scripts.filter { it.hasAttr("defer") }.map { it.attr("src") }
+
+ // important to check symbol-parameters-wrapper_deferred specifically since it might break some features
+ assertContains(deferredScriptSources, "../../../scripts/symbol-parameters-wrapper_deferred.js")
+ }
+ }
+ }
private fun <T> Collection<T>.assertCount(n: Int, prefix: String = "") =
assert(count() == n) { "${prefix}Expected $n, got ${count()}" }