-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
187 new filter panel api #222
187 new filter panel api #222
Conversation
Is it possible to use the This works for me: testthat::test_that("switching disable/enable button caches and restores state", {
filtered_data <- FilteredData$new(
list(
iris = list(dataset = iris),
mtcars = list(dataset = mtcars)
)
)
fs <- filter_settings(
filter_var(dataname = "iris", varname = "Sepal.Length", selected = c(5.1, 6.4), keep_na = TRUE, keep_inf = FALSE),
filter_var(dataname = "iris", varname = "Species", selected = c("setosa", "versicolor"), keep_na = FALSE),
filter_var(dataname = "mtcars", varname = "cyl", selected = c(4, 6), keep_na = FALSE, keep_inf = FALSE),
filter_var(dataname = "mtcars", varname = "disp", keep_na = FALSE, keep_inf = FALSE)
)
filtered_data$set_filter_state(fs)
shiny::testServer(
filtered_data$srv_filter_panel,
expr = {
cached <- filtered_data$get_filter_state()
testthat::expect_true(filtered_data$get_filter_panel_active())
filtered_data$filter_panel_disable() # here
testthat::expect_null(filtered_data$get_filter_state())
testthat::expect_false(filtered_data$get_filter_panel_active())
testthat::expect_warning(filtered_data$filter_panel_enable(), "Choices adjusted") # here
testthat::expect_identical(filtered_data$get_filter_state(), cached)
testthat::expect_true(filtered_data$get_filter_panel_active())
}
)
}) |
That is done in another test. It is very suspect that |
So I tried, I don't get it. |
requested changes have been implemented
The test failure was caused by the fact that the button We consider this a bug ar at least a limitation on The test was changed to run in |
Introduces changes necessary to handle the new Filter Panel API coming from [this PR](insightsengineering/teal.slice#222). --------- Co-authored-by: Dawid Kałędkowski <dawid.kaledkowski@gmail.com> Co-authored-by: Andrew Bates <andrew.bates@atorusresearch.com> Co-authored-by: asbates <asbates@users.noreply.github.com> Co-authored-by: chlebowa <chlebowa@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
This PR contains work towards a new filter panel API as outlined in #187.
TESTING class methods:
☝️ this happens in
FilteredData$set_filter_state
with a warningNote
as.teal_slices
does not perform any validation, so a list-like filter state that specifies filters on columns ofMAE@colData
that is not wrapped aslist(MAE = list(...))
but is onlylist(var = list(...))
will be interpreted as adata.frame
filter.teal_slices
Note that calls are not generated. This is these filters are instantiated and constructors don't know how to handle choices yet, so by default they are created with everything selected, hence no calls.
teal_slices
TESTING wrapper functions: