mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 15:38:19 -05:00
WIP more markdown() tests
This commit is contained in:
@@ -175,6 +175,6 @@ Collate:
|
||||
'test-module.R'
|
||||
'test.R'
|
||||
'update-input.R'
|
||||
RoxygenNote: 7.0.2
|
||||
RoxygenNote: 7.1.0
|
||||
Encoding: UTF-8
|
||||
Roxygen: list(markdown = TRUE)
|
||||
|
||||
@@ -2318,7 +2318,7 @@ missingOutput <- function(...) req(FALSE)
|
||||
#' concatenated HTML is returned.
|
||||
#' @param extensions Enable Github syntax extensions; defaults to `TRUE`.
|
||||
#' @param .noWS Character vector used to omit some of the whitespace that would
|
||||
#' normally be written around this HTML. Valid options include `before`,
|
||||
#' normally be written around generated HTML. Valid options include `before`,
|
||||
#' `after`, and `outside` (equivalent to `before` and `end`).
|
||||
#' @param ... Additional arguments to pass to [commonmark::markdown_html()].
|
||||
#' These arguments are _[dynamic][rlang::dyn-dots]_.
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
context("inline-markdown")
|
||||
|
||||
test_that("Markdown without newlines is converted properly", {
|
||||
expect_equivalent(markdown("# a top level"), HTML("<h1>a top level</h1>"))
|
||||
test_that("Markdown without newlines translates", {
|
||||
expect_equivalent(markdown("# a top level"), HTML("<h1>a top level</h1>\n"))
|
||||
expect_equivalent(markdown("## a subheading"), HTML("<h2>a subheading</h2>\n"))
|
||||
expect_equivalent(markdown("[rstudio](https://rstudio.com)"), HTML("<p><a href=\"https://rstudio.com\">rstudio</a></p>\n"))
|
||||
})
|
||||
|
||||
test_that("HTML has correct attributes", {
|
||||
html <- markdown("a paragraph", .noWS = "outside")
|
||||
expect_is(html, "html")
|
||||
expect_equal(attr(html, "noWS"), "outside")
|
||||
})
|
||||
|
||||
test_that("Github extensions are on by default", {
|
||||
html <- markdown("a ~paragraph~ with a link: https://example.com")
|
||||
expect_equivalent(html, HTML("<p>a <del>paragraph</del> with a link: <a href=\"https://example.com\">https://example.com</a></p>\n"))
|
||||
})
|
||||
|
||||
test_that("Github extensions can be disabled", {
|
||||
html <- markdown("a ~paragraph~", extensions = FALSE)
|
||||
expect_equivalent(html, HTML("<p>a ~paragraph~</p>\n"))
|
||||
})
|
||||
|
||||
test_that("Additional options are respected", {
|
||||
html <- markdown("a ~paragraph~", extensions = FALSE, sourcepos = TRUE)
|
||||
expect_equivalent(html, HTML("<p data-sourcepos=\"1:1-1:13\">a ~paragraph~</p>\n"))
|
||||
})
|
||||
|
||||
test_that("Multiline markdown works properly", {
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user