-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a0af56
commit c04295a
Showing
6 changed files
with
137 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
plugins/base/src/test/kotlin/renderers/html/CustomFooterTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package renderers.html | ||
|
||
import org.jetbrains.dokka.DokkaConfiguration | ||
import org.jetbrains.dokka.DokkaConfigurationImpl | ||
import org.jetbrains.dokka.PluginConfigurationImpl | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.base.DokkaBaseConfiguration | ||
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer | ||
import org.jetbrains.dokka.base.templating.toJsonString | ||
import org.jsoup.Jsoup | ||
import org.jsoup.nodes.Element | ||
import org.junit.jupiter.api.Test | ||
import renderers.testPage | ||
import utils.A | ||
import utils.Div | ||
import utils.Span | ||
import utils.match | ||
|
||
class CustomFooterTest : HtmlRenderingOnlyTestBase() { | ||
@Test | ||
fun `should include message from custom footer`() { | ||
val page = testPage { } | ||
HtmlRenderer(context).render(page) | ||
renderedContent.match( | ||
Span(A()), | ||
Span(Div("Custom message")), | ||
Span(Span("Generated by "), A(Span("dokka"), Span())) | ||
) | ||
} | ||
|
||
override val configuration: DokkaConfigurationImpl | ||
get() = super.configuration.copy( | ||
pluginsConfiguration = listOf( | ||
PluginConfigurationImpl( | ||
DokkaBase::class.java.canonicalName, | ||
DokkaConfiguration.SerializationFormat.JSON, | ||
toJsonString(DokkaBaseConfiguration(footerMessage = """<div style="color: red">Custom message</div>""")) | ||
) | ||
) | ||
) | ||
|
||
override val renderedContent: Element | ||
get() = files.contents.getValue("test-page.html").let { Jsoup.parse(it) }.select(".footer").single() | ||
} |
27 changes: 27 additions & 0 deletions
27
plugins/base/src/test/kotlin/renderers/html/FooterMessageTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package renderers.html | ||
|
||
import org.jetbrains.dokka.base.DokkaBaseConfiguration.Companion.defaultFooterMessage | ||
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer | ||
import org.jsoup.Jsoup | ||
import org.jsoup.nodes.Element | ||
import org.junit.jupiter.api.Test | ||
import renderers.testPage | ||
import utils.A | ||
import utils.Span | ||
import utils.match | ||
|
||
class FooterMessageTest : HtmlRenderingOnlyTestBase() { | ||
@Test | ||
fun `should include defaultFooter`() { | ||
val page = testPage { } | ||
HtmlRenderer(context).render(page) | ||
renderedContent.match( | ||
Span(A()), | ||
Span(defaultFooterMessage), | ||
Span(Span("Generated by "), A(Span("dokka"), Span())) | ||
) | ||
} | ||
|
||
override val renderedContent: Element | ||
get() = files.contents.getValue("test-page.html").let { Jsoup.parse(it) }.select(".footer").single() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters