Procházet zdrojové kódy

Fix extra css heading so only added once

tags/v0.3.0
Garrick Aden-Buie před 6 roky
rodič
revize
8f57771d4e
2 změnil soubory, kde provedl 8 přidání a 1 odebrání
  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 Zobrazit soubor

@@ -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 Zobrazit soubor

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



Načítá se…
Zrušit
Uložit