# Value blocks ------------------------------------------------------------ test_that("leading text parsed as paragraph", { expected <- c( "

text

", "
", "
x
", "

y

", "
" ) expect_equal(value2html("\ntext\n\\item{x}{y}"), expected) expect_equal(value2html("text\\item{x}{y}"), expected) }) test_that("leading text is optional", { expect_equal( value2html("\\item{x}{y}"), c("
", "
x
", "

y

", "
") ) }) test_that("can process empty string", { expect_equal(value2html(""), character()) }) test_that("leading text is optional", { expect_equal( value2html("text"),"

text

") }) test_that("items are optional", { value <- rd_text("\\value{text}", fragment = FALSE) expect_equal(as_data(value[[1]])$contents, "

text

") }) test_that("whitespace between items doesn't affect grouping", { expect_equal( value2html("\\item{a}{b}\n\n\\item{c}{d}\n\n\\item{e}{f}"), c( "
", "
a
", "

b

", "", "", "
c
", "

d

", "", "", "
e
", "

f

", "
" ) ) }) test_that("leading whitespace doesn't break items", { expect_equal( value2html("\n\\item{a}{b}\n\n\\item{c}{d}\n\n\\item{e}{f}"), c( "
", "
a
", "

b

", "", "", "
c
", "

d

", "", "", "
e
", "

f

", "
" ) ) }) test_that("whitespace between text is not preserved", { expect_equal( value2html("a\n\nb\n\nc"), c("

a

", "

b

", "

c

") ) }) test_that("can have multiple interleaved blocks", { expect_equal( value2html("text1\\item{a}{b}\\item{c}{d}text2\\item{e}{f}"), c( "

text1

", "
", "
a
", "

b

", "
c
", "

d

", "
", "

text2

", "
", "
e
", "

f

", "
" ) ) }) test_that("other tags don't affect breaking (#2371)", { expect_equal( value2html("1\\code{xxx}\n2\n3"), c("

1xxx", "2", "3

") ) # additionally teading whitespace expect_equal( value2html("1\\code{xxx}\n 2\n 3"), c("

1xxx", "2", "3

") ) })