From e84b78594c89d4b333906eed6ab48498adb9c16a Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 12 Dec 2022 11:24:28 -0500 Subject: [PATCH] Use correctly typed missing value for lists --- R/gui-gui_global.R | 6 +++--- tests/testthat/test-validate.R | 2 +- tests/testthat/test-zoom.R | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/gui-gui_global.R b/R/gui-gui_global.R index d9166a15b..2b89234f5 100644 --- a/R/gui-gui_global.R +++ b/R/gui-gui_global.R @@ -75,17 +75,17 @@ reactable_column <- function(data, table_name) { dplyr::if_else( data$is_pk[index], list(htmltools::span(style = "margin-right: 10px;", title = "Primary key", shiny::icon(verify_fa = FALSE, "key"))), - NULL + list(NULL) ), dplyr::if_else( data$is_child_fk[index], list(htmltools::span(style = "margin-right: 10px;", title = "Child in foreign key", shiny::icon(verify_fa = FALSE, "angle-double-right"))), - NULL + list(NULL) ), dplyr::if_else( data$is_parent_key[index], list(htmltools::span(style = "margin-right: 10px;", title = "Parent key", shiny::icon(verify_fa = FALSE, "angle-double-left"))), - NULL + list(NULL) ), shiny::span(class = "tag", style = "color: #999; border-color: #999;", title = paste0("Data type: ", data$type[index]), data$type[index]) ) diff --git a/tests/testthat/test-validate.R b/tests/testthat/test-validate.R index 4f6959ee4..179e1b071 100644 --- a/tests/testthat/test-validate.R +++ b/tests/testthat/test-validate.R @@ -75,7 +75,7 @@ test_that("validator speaks up when something's wrong", { dm_for_filter() %>% dm_zoom_to(tf_1) %>% dm_get_def() %>% - mutate(zoom = if_else(table == "tf_1", list(1), NULL)) %>% + mutate(zoom = if_else(table == "tf_1", list(1), list(NULL))) %>% new_dm3(zoomed = TRUE) %>% dm_validate(), "dm_invalid" diff --git a/tests/testthat/test-zoom.R b/tests/testthat/test-zoom.R index 89e10156d..5346d0017 100644 --- a/tests/testthat/test-zoom.R +++ b/tests/testthat/test-zoom.R @@ -99,8 +99,8 @@ test_that("dm_update_tbl() works", { new_dm_for_filter <- dm_get_def(dm_for_filter()) %>% mutate( - zoom = if_else(table == "tf_6", list(tf_7()), NULL), - col_tracker_zoom = if_else(table == "tf_6", list(character()), NULL), + zoom = if_else(table == "tf_6", list(tf_7()), list(NULL)), + col_tracker_zoom = if_else(table == "tf_6", list(character()), list(NULL)), ) %>% new_dm3(zoomed = TRUE)