ソースを参照

Fix extra css heading so only added once

tags/v0.3.0
コミット
8f57771d4e
2個のファイルの変更8行の追加1行の削除
  1. +1
    -1
      R/style_extra_css.R
  2. +7
    -0
      tests/testthat/test-style_extra_css.R

+ 1
- 1
R/style_extra_css.R ファイルの表示

@@ -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)

+ 7
- 0
tests/testthat/test-style_extra_css.R ファイルの表示

@@ -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)
})
})



読み込み中…
キャンセル
保存