Skip to content

Commit

Permalink
Revert "update snapshots"
Browse files Browse the repository at this point in the history
This reverts commit 84653a8.
  • Loading branch information
vincentarelbundock committed Feb 1, 2024
1 parent 84653a8 commit 3f56a16
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
Binary file modified inst/tinytest/_tinysnapshot/html-heatmap.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-issue58.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-issue88.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-issue92.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-striped.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-striped_orange.rds
Binary file not shown.
Binary file modified inst/tinytest/_tinysnapshot/html-vectorized_color_j.rds
Binary file not shown.
30 changes: 16 additions & 14 deletions inst/tinytest/test-html.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,52 @@ source("helpers.R")
using("tinysnapshot")
options(tinytable_print_output = "html")


clean <- function(x) {
x <- knitr::knit_print(x)
x <- gsub("tinytable_\\w+\\b", "tinytable", x)
x <- gsub("styleCell_\\w+\\b", "tinytable", x)
x <- gsub("styleHeaderCell_\\w+\\b", "tinytable", x)
x
}

x <- mtcars[1:4, 1:5]

set.seed(1024)
tab <- tt(x, theme = "striped")
expect_equal_to_reference(tab, "_tinysnapshot/html-striped.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-striped.rds")

set.seed(1024)
tab <- tt(x, theme = "striped") |>
style_tt(color = "orange")
expect_equal_to_reference(tab, "_tinysnapshot/html-striped_orange.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-striped_orange.rds")


# Issue #92: header alignment
set.seed(1024)
k <- structure(list(Column1 = c("Some text", "123"), Column2 = c("Some text",
"456")), row.names = c(NA, -2L), class = "data.frame")
tab <- tt(k, width = 1) |> style_tt(j = 2, align = "r")
expect_equal_to_reference(tab, "_tinysnapshot/html-issue92.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-issue92.rds")


# tutorial.qmd: vectorized settings
set.seed(1024)
tab <- tt(x) |>
style_tt(
j = 2:3,
color = c("orange", "green"),
background = "black")
expect_equal_to_reference(tab, "_tinysnapshot/html-vectorized_color_j.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-vectorized_color_j.rds")

# Issue #58
set.seed(1024)
tab <- tt(iris[1:10,]) |>
style_tt(align = "c") |>
group_tt(j = list("Sepal" = 1:2, "Petal" = 3:4))
expect_equal_to_reference(tab, "_tinysnapshot/html-issue58.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-issue58.rds")

# Issue #88: indent
set.seed(1024)
tab <- tt(iris[1:10,]) |>
style_tt(i = 2:4, indent = 3)
expect_equal_to_reference(tab, "_tinysnapshot/html-issue88.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-issue88.rds")

# tutorial.qmd: heatmap
set.seed(1024)
k <- data.frame(matrix(1:20, ncol = 5))
colnames(k) <- NULL
bg <- hcl.colors(20, "Inferno")
Expand All @@ -59,7 +61,7 @@ tab <- tt(k, width = .5, theme = "void") |>
color = fg,
background = bg,
fontsize = fs)
expect_equal_to_reference(tab, "_tinysnapshot/html-heatmap.rds")
expect_equal_to_reference(clean(tab), "_tinysnapshot/html-heatmap.rds")


options(tinytable_print_output = NULL)

0 comments on commit 3f56a16

Please sign in to comment.