diff options
author | Aurimas Liutikas <aurimas@google.com> | 2020-07-14 09:16:40 -0700 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-15 13:26:16 +0200 |
commit | c2b2f62dbce00e927214416cba33653048582443 (patch) | |
tree | 38cbfc4bf6609dd00834856f150e67d36dcc93b5 /plugins/mathjax | |
parent | 0c848be52c90cc1136d9ccbcd55b9a290bc7b58b (diff) | |
download | dokka-c2b2f62dbce00e927214416cba33653048582443.tar.gz dokka-c2b2f62dbce00e927214416cba33653048582443.tar.bz2 dokka-c2b2f62dbce00e927214416cba33653048582443.zip |
Add fixes so the test actually passes
Diffstat (limited to 'plugins/mathjax')
-rw-r--r-- | plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt | 2 | ||||
-rw-r--r-- | plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt index 9e6ed965..63699585 100644 --- a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt +++ b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt @@ -15,7 +15,7 @@ class MathjaxPlugin : DokkaPlugin() { } private const val ANNOTATION = "usesMathJax" -private const val LIB_PATH = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest" +internal const val LIB_PATH = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest" object MathjaxTransformer : PageTransformer { override fun invoke(input: RootPageNode) = input.transformContentPagesTree { diff --git a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt index 33269ce7..4a4ada23 100644 --- a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt +++ b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt @@ -1,5 +1,6 @@ package mathjaxTest +import org.jetbrains.dokka.mathjax.LIB_PATH import org.jetbrains.dokka.mathjax.MathjaxPlugin import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest import org.jsoup.Jsoup @@ -8,7 +9,7 @@ import utils.TestOutputWriterPlugin class MathjaxPluginTest : AbstractCoreTest() { @Test - fun basicMathjaxTest() { + fun noMathjaxTest() { val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -21,11 +22,9 @@ class MathjaxPluginTest : AbstractCoreTest() { |/src/main/kotlin/test/Test.kt |package example | /** - | * {@usesMathJax} - | * - | * <p>\(\alpha_{out} = \alpha_{dst}\)</p> - | * <p>\(C_{out} = C_{dst}\)</p> + | * Just a regular kdoc | */ + | fun test(): String = "" """.trimIndent() val writerPlugin = TestOutputWriterPlugin() testInline( @@ -35,19 +34,18 @@ class MathjaxPluginTest : AbstractCoreTest() { ) { renderingStage = { _, _ -> Jsoup - .parse(writerPlugin.writer.contents["root/example.html"]) + .parse(writerPlugin.writer.contents["root/example/test.html"]) .head() .select("link, script") .let { - val link = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest" - assert(it.`is`("[href=$link], [src=$link]")) + assert(!it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) } } } } @Test - fun basicNoMathjaxTest() { + fun usingMathjaxTest() { val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -60,9 +58,12 @@ class MathjaxPluginTest : AbstractCoreTest() { |/src/main/kotlin/test/Test.kt |package example | /** - | * <p>\(\alpha_{out} = \alpha_{dst}\)</p> - | * <p>\(C_{out} = C_{dst}\)</p> + | * @usesMathJax + | * + | * \(\alpha_{out} = \alpha_{dst}\) + | * \(C_{out} = C_{dst}\) | */ + | fun test(): String = "" """.trimIndent() val writerPlugin = TestOutputWriterPlugin() testInline( @@ -72,12 +73,11 @@ class MathjaxPluginTest : AbstractCoreTest() { ) { renderingStage = { _, _ -> Jsoup - .parse(writerPlugin.writer.contents["root/example.html"]) + .parse(writerPlugin.writer.contents["root/example/test.html"]) .head() .select("link, script") .let { - val link = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest" - assert(!it.`is`("[href=$link], [src=$link]")) + assert(it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) } } } |