aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-04-29 15:03:08 +0300
committerGitHub <noreply@github.com>2022-04-29 15:03:08 +0300
commit8c218ff4dd5f970233c43845c19299fc74256389 (patch)
treeb6818183ce8faa2c58d6571ca1c86aa28d4f0431 /plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
parent84aacad29982240ae367b21e9d283d38dab672ae (diff)
downloaddokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.gz
dokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.bz2
dokka-8c218ff4dd5f970233c43845c19299fc74256389.zip
Enable warnings as errors and fix all warnings (#2451)
* Enable warnings as errors and fix all warnings * Enable skip-metadata-version-check compiler setting
Diffstat (limited to 'plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt')
-rw-r--r--plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt111
1 files changed, 0 insertions, 111 deletions
diff --git a/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
deleted file mode 100644
index c31f63c7..00000000
--- a/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.jetbrains.dokka.templates
-
-import kotlinx.html.a
-import kotlinx.html.div
-import kotlinx.html.id
-import kotlinx.html.span
-import kotlinx.html.stream.createHTML
-import org.jetbrains.dokka.DokkaModuleDescriptionImpl
-import org.jetbrains.dokka.base.renderers.html.templateCommand
-import org.jetbrains.dokka.base.renderers.html.templateCommandAsHtmlComment
-import org.jetbrains.dokka.base.templating.PathToRootSubstitutionCommand
-import org.junit.Rule
-import org.junit.jupiter.api.Test
-import org.junit.rules.TemporaryFolder
-import utils.assertHtmlEqualsIgnoringWhitespace
-import java.io.File
-
-class SubstitutionCommandResolutionTest : TemplatingAbstractTest() {
-
- @get:Rule
- val folder: TemporaryFolder = TemporaryFolder()
-
- @Test
- fun `should handle PathToRootCommand`() {
- val template = createHTML()
- .templateCommand(PathToRootSubstitutionCommand(pattern = "###", default = "default")) {
- a {
- href = "###index.html"
- div {
- id = "logo"
- }
- }
- }
-
- val expected = createHTML().a {
- href = "../index.html"
- div {
- id = "logo"
- }
- }
- checkSubstitutedResult(template, expected)
- }
-
- @Test
- fun `should handle PathToRootCommand as HTML comment`() {
- val template = createHTML().span {
- templateCommandAsHtmlComment(PathToRootSubstitutionCommand(pattern = "###", default = "default")) {
- this@span.a {
- href = "###index.html"
- div {
- id = "logo"
- }
- }
- templateCommandAsHtmlComment(PathToRootSubstitutionCommand(pattern = "####", default = "default")) {
- this@span.a {
- href = "####index.html"
- div {
- id = "logo"
- }
- }
- }
- }
- }
-
- val expected = createHTML().span {
- a {
- href = "../index.html"
- div {
- id = "logo"
- }
- }
- a {
- href = "../index.html"
- div {
- id = "logo"
- }
- }
- }
- checkSubstitutedResult(template, expected)
- }
-
- private fun createDirectoriesAndWriteContent(content: String): File {
- folder.create()
- val module1 = folder.newFolder("module1")
- val module1Content = module1.resolve("index.html")
- module1Content.writeText(content)
- return module1Content
- }
-
- private fun checkSubstitutedResult(template: String, expected:String) {
- val testedFile = createDirectoriesAndWriteContent(template)
-
- val configuration = dokkaConfiguration {
- modules = listOf(
- DokkaModuleDescriptionImpl(
- name = "module1",
- relativePathToOutputDirectory = folder.root.resolve("module1"),
- includes = emptySet(),
- sourceOutputDirectory = folder.root.resolve("module1"),
- )
- )
- this.outputDir = folder.root
- }
-
- testFromData(configuration, useOutputLocationFromConfig = true){
- finishProcessingSubmodules = {
- assertHtmlEqualsIgnoringWhitespace(expected, testedFile.readText())
- }
- }
- }
-}