Просмотр исходного кода

Fix extra css heading so only added once

tags/v0.3.0
Garrick Aden-Buie 6 лет назад
Родитель
Сommit
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 Просмотреть файл

has_heading <- !is.null(heading) has_heading <- !is.null(heading)
x <- paste0( x <- paste0(
if (has_heading) paste0("/* ", heading, " */\n"), 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 (append) x <- paste0(if (has_heading) "\n\n" else "\n", x)
if (is.null(outfile)) return(x) if (is.null(outfile)) return(x)

+ 7
- 0
tests/testthat/test-style_extra_css.R Просмотреть файл

strsplit(third_exp, "\n")[[1]] 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)
})
}) })





Загрузка…
Отмена
Сохранить