From f54597c754c9be6afb4ea374dc959dcc9fd551ce Mon Sep 17 00:00:00 2001 From: Jacob Wysko Date: Mon, 21 Feb 2022 10:30:59 -0500 Subject: Fix MathJax rendering bug (#2342) * Fix MathJax rendering bug (#2175) Fix a bug where using the `@usesMathJax` custom tag would cause the documentation to fail to render. --- .../mathjax/src/test/kotlin/MathjaxPluginTest.kt | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'plugins/mathjax/src/test/kotlin') diff --git a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt index da166083..a354365b 100644 --- a/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt +++ b/plugins/mathjax/src/test/kotlin/MathjaxPluginTest.kt @@ -53,15 +53,15 @@ class MathjaxPluginTest : BaseAbstractTest() { } } } + val math = "a^2 = b^2 + c^2" val source = """ |/src/main/kotlin/test/Test.kt |package example | /** | * @usesMathJax - | * - | * \(\alpha_{out} = \alpha_{dst}\) - | * \(C_{out} = C_{dst}\) + | * + | * \($math\) | */ | fun test(): String = "" """.trimIndent() @@ -71,14 +71,16 @@ class MathjaxPluginTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(writerPlugin, MathjaxPlugin()) ) { - renderingStage = { - _, _ -> Jsoup - .parse(writerPlugin.writer.contents["root/example/test.html"]) - .head() - .select("link, script") - .let { - assert(it.`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) - } + renderingStage = { _, _ -> + val parsed = Jsoup.parse(writerPlugin.writer.contents["root/example/test.html"]) + + // Ensure the MathJax CDN is loaded + assert(parsed.select("link, script").`is`("[href=$LIB_PATH], [src=$LIB_PATH]")) + + // Ensure the contents are displayed + assert(parsed.select("p").any { + it.text().contains(math) + }) } } } -- cgit