diff --git a/tests/testthat/test-class-workbook-wrappers.R b/tests/testthat/test-class-workbook-wrappers.R index cd6882e99..ca81087ed 100644 --- a/tests/testthat/test-class-workbook-wrappers.R +++ b/tests/testthat/test-class-workbook-wrappers.R @@ -645,6 +645,23 @@ test_that("wb_add_style() is a wrapper", { }) +# wb_add_style_across() --------------------------------------------------- + +test_that("wb_add_style() is a wrapper", { + + wb <- wb_workbook() %>% + wb_add_worksheet() %>% + wb_add_fill(dims = "C3", color = wb_color("yellow")) + + expect_wrapper( + "add_style_across", + wb = wb, + params = list(from = "C3", cols = "C:D", rows = 3:4) + ) + +}) + + # wb_get_cell_style() ----------------------------------------------------- test_that("wb_get_cell_style() is a wrapper", { diff --git a/tests/testthat/test-wb_styles.R b/tests/testthat/test-wb_styles.R index b4dcc6737..1c2269b6d 100644 --- a/tests/testthat/test-wb_styles.R +++ b/tests/testthat/test-wb_styles.R @@ -836,3 +836,27 @@ test_that("initialized styles remain available", { expect_equal(exp, got) }) + +test_that("apply styles across columns and rows", { + + wb <- wb_workbook() %>% + wb_add_worksheet() %>% + wb_add_fill(dims = "C3", color = wb_color("yellow")) %>% + wb_add_style_across(from = "C3", cols = "C:D", rows = 3:4) + + exp <- c( + "", + "" + ) + got <- wb$worksheets[[1]]$cols_attr + expect_equal(exp, got) + + exp <- data.frame( + customFormat = c("1", "1"), + r = c("3", "4"), + s = c("1", "1") + ) + got <- wb$worksheets[[1]]$sheet_data$row_attr[c("customFormat", "r", "s")] + expect_equal(exp, got) + +})