| @@ -40,7 +40,7 @@ style_extra_css <- function( | |||
| has_heading <- !is.null(heading) | |||
| x <- paste0( | |||
| if (has_heading) paste0("/* ", heading, " */\n"), | |||
| list2css(css) | |||
| paste(list2css(css), collapse = "\n") | |||
| ) | |||
| if (append) x <- paste0(if (has_heading) "\n\n" else "\n", x) | |||
| if (is.null(outfile)) return(x) | |||
| @@ -73,6 +73,13 @@ describe("style_extra_css", { | |||
| strsplit(third_exp, "\n")[[1]] | |||
| ) | |||
| }) | |||
| it("only adds prepends `heading` once", { | |||
| css <- list(b = list(color = "red"), i = list(color = "blue")) | |||
| out <- style_extra_css(css, outfile = NULL, heading = "Extra CSS") | |||
| expect_equal(length(out), 1L) | |||
| expect_equal(sum(grepl("Extra CSS", out)), 1L) | |||
| }) | |||
| }) | |||