diff --git a/tests/testthat/test-render_as_gtable.R b/tests/testthat/test-render_as_gtable.R index 16b940f975..4af808189e 100644 --- a/tests/testthat/test-render_as_gtable.R +++ b/tests/testthat/test-render_as_gtable.R @@ -1,17 +1,17 @@ test_that("gt_tbls can be rendered as a gtable", { - table <- pizzaplace |> - dplyr::filter(type %in% c("classic", "veggie")) |> - dplyr::group_by(type, size) |> + table <- pizzaplace %>% + dplyr::filter(type %in% c("classic", "veggie")) %>% + dplyr::group_by(type, size) %>% dplyr::summarize( sold = dplyr::n(), income = sum(price), .groups = "drop" - ) |> - gt(rowname_col = "size", groupname_col = "type") |> - tab_header(title = "Pizzas Sold in 2015") |> - fmt_integer(columns = sold) |> - fmt_currency(columns = income) |> + ) %>% + gt(rowname_col = "size", groupname_col = "type") %>% + tab_header(title = "Pizzas Sold in 2015") %>% + fmt_integer(columns = sold) %>% + fmt_currency(columns = income) %>% summary_rows( fns = list(label = "All Sizes", fn = "sum"), side = c("top"), @@ -19,27 +19,27 @@ test_that("gt_tbls can be rendered as a gtable", { ~ fmt_integer(., columns = sold), ~ fmt_currency(., columns = income) ) - ) |> + ) %>% tab_options( summary_row.background.color = "gray95", row_group.as_column = TRUE - ) |> + ) %>% tab_stub_indent( rows = everything(), indent = 2 - ) |> + ) %>% grand_summary_rows( columns = c("sold", "income"), fns = list(Sum ~ sum(.)), fmt = ~ fmt_number(.) - ) |> - tab_caption("Here be caption text") |> + ) %>% + tab_caption("Here be caption text") %>% tab_spanner( label = "Spanner", columns = c("sold", "income") - ) |> - tab_stubhead("Stubhead label") |> - tab_source_note("Source: the pizzaria") |> + ) %>% + tab_stubhead("Stubhead label") %>% + tab_source_note("Source: the pizzaria") %>% tab_footnote("Pineapples not included") gtable <- render_as_gtable(table)