diff --git a/NEWS.md b/NEWS.md index 23cb10eb..e24e5b2e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # htmltools (development version) +## Bug fixes + +* `bindFillRole()` now attaches its `HTMLDependency()` to fill items, thus reducing the possibility of filling layout breaking due to missing CSS. (#421) + + # htmltools 0.5.7 ## New Features diff --git a/R/fill.R b/R/fill.R index 2309de64..710b51fa 100644 --- a/R/fill.R +++ b/R/fill.R @@ -91,7 +91,7 @@ bindFillRole <- function(x, ..., item = FALSE, container = FALSE, overwrite = FA class = if (container) "html-fill-container" ) - if (container) { + if (container || item) { x <- attachDependencies(x, fillDependencies(), append = TRUE) } diff --git a/tests/testthat/test-fill.R b/tests/testthat/test-fill.R index fef0cdff..a33e1038 100644 --- a/tests/testthat/test-fill.R +++ b/tests/testthat/test-fill.R @@ -8,11 +8,13 @@ test_that("asFillContainer() and asFillItem()", { expect_true( doRenderTags(x) == "
" ) + expect_equal(htmlDependencies(x), list(fillDependencies())) x <- bindFillRole(div(), item = TRUE) expect_true( doRenderTags(x) == "" ) + expect_equal(htmlDependencies(x), list(fillDependencies())) x <- bindFillRole(x, container = TRUE, overwrite = TRUE) expect_true(