Skip to content

Commit c8148d3

Browse files
authored
823 block test table without validation error (#840)
Fixes #823
1 parent a88ca28 commit c8148d3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

R/tm_g_distribution.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,17 @@ ui_distribution <- function(id, ...) {
245245
tags$h3("Statistics Table"),
246246
DT::dataTableOutput(ns("summary_table")),
247247
tags$h3("Tests"),
248-
DT::dataTableOutput(ns("t_stats"))
248+
conditionalPanel(
249+
sprintf("input['%s'].length === 0", ns("dist_tests")),
250+
div(
251+
id = ns("please_select_a_test"),
252+
"Please select a test"
253+
)
254+
),
255+
conditionalPanel(
256+
sprintf("input['%s'].length > 0", ns("dist_tests")),
257+
DT::dataTableOutput(ns("t_stats"))
258+
)
249259
),
250260
encoding = tags$div(
251261
### Reporter
@@ -1101,7 +1111,7 @@ srv_distribution <- function(id,
11011111
dist_tests <- input$dist_tests
11021112
t_dist <- input$t_dist
11031113

1104-
validate(need(dist_tests, "Please select a test"))
1114+
req(dist_tests)
11051115

11061116
teal::validate_inputs(iv_dist)
11071117

tests/testthat/test-shinytest2-tm_g_distribution.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ testthat::test_that("e2e - tm_g_distribution: Histogram encoding inputs produce
7474
app_driver <- app_driver_tm_g_distribution()
7575

7676
app_driver$set_active_module_input("main_type", "Density")
77-
app_driver$expect_validation_error() # test needs to be updated to remove validation error
77+
app_driver$expect_no_validation_error()
7878
app_driver$set_active_module_input("dist_tests", "Shapiro-Wilk")
7979

8080
# Encodings in the Histogram tab
@@ -112,8 +112,6 @@ testthat::test_that("e2e - tm_g_distribution: QQ plot encoding inputs produce ou
112112

113113
# Encodings in the QQplot tab
114114
app_driver$set_active_module_input("main_type", "Density")
115-
app_driver$expect_validation_error() # test needs to be updated to remove validation error
116-
app_driver$set_active_module_input("dist_tests", "Shapiro-Wilk")
117115
app_driver$expect_no_validation_error()
118116

119117
app_driver$set_active_module_input("tabs", "QQplot")

0 commit comments

Comments
 (0)