package dotty.tools package dottydoc package staticsite import org.junit.Test import org.junit.Assert._ class PageTests extends DottyDocTest with SourceFileOps { import scala.collection.JavaConverters._ @Test def mdHas1Key = { val page = markdownPage( """|--- |key: |--- | |great""".stripMargin ) assert( page.yaml == Map("key" -> List.empty.asJava), s"""incorrect yaml, expected "key:" without key in: ${page.yaml}""" ) assertEquals("
great
\n", page.html.get) } @Test def yamlPreservesLiquidTags = { val page1 = markdownPage( """|--- |key: |--- | |{{ content }}""".stripMargin, params = Map("content" -> "Hello, world!") ) assert( page1.yaml == Map("key" -> List.empty.asJava), s"""incorrect yaml, expected "key:" without key in: ${page1.yaml}""" ) assertEquals("Hello, world!
\n", page1.html.get) val page2 = markdownPage( """|{{ content }}""".stripMargin, params = Map("content" -> "hello") ) assert( page2.yaml == Map(), s"""incorrect yaml, expected "key:" without key in: ${page2.yaml}""" ) assertEquals("hello
\n", page2.html.get) val page3 = markdownPage( """|{% if product.title == "Awesome Shoes" %} |These shoes are awesome! |{% endif %}""".stripMargin, params = Map("product" -> Map("title" -> "Awesome Shoes").asJava) ) assertEquals( "These shoes are awesome!
\n", page3.html.get ) } @Test def simpleHtmlPage = { val p1 = htmlPage("""